{
  "openapi": "3.1.0",
  "info": {
    "title": "Shardlens collector API",
    "version": "1.2.0",
    "description": "Self-hosted collector for Shardlens. SDKs send batches with an ingest key; dashboards and scripts read with a read key or a session. Every route validates its input; SQL is always parameterised.",
    "license": {
      "name": "MIT",
      "identifier": "MIT"
    }
  },
  "servers": [
    {
      "url": "https://stats.example.com",
      "description": "Your collector"
    }
  ],
  "components": {
    "securitySchemes": {
      "ingestKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Ingest-only key: `slk_ingest_…`"
      },
      "readKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Read-only key: `slk_read_…`"
      },
      "activityKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Activity key: `slk_activity_…`. Reads what a read key does, and who ran what in audit mode. Server side only."
      },
      "session": {
        "type": "apiKey",
        "in": "cookie",
        "name": "shardlens_session",
        "description": "Dashboard session. State-changing requests also need the header `x-shardlens-csrf: 1`."
      },
      "discordSignature": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Signature-Ed25519",
        "description": "Ed25519 signature of `X-Signature-Timestamp` + raw body, checked with the app’s public key."
      }
    }
  },
  "tags": [
    {
      "name": "SDK",
      "description": "Used by the Shardlens SDKs"
    },
    {
      "name": "Discord",
      "description": "Called by Discord"
    },
    {
      "name": "Data",
      "description": "Queries for dashboards and scripts"
    },
    {
      "name": "Admin",
      "description": "Settings, keys, alerts and reports (Discord sign-in)"
    },
    {
      "name": "Audit mode",
      "description": "Who ran what (audit mode only; every access is logged)"
    },
    {
      "name": "Privacy",
      "description": "Erasure"
    },
    {
      "name": "Auth",
      "description": "Dashboard sign-in"
    },
    {
      "name": "Health",
      "description": "Liveness and readiness"
    }
  ],
  "paths": {
    "/v1/ingest": {
      "post": {
        "tags": [
          "SDK"
        ],
        "summary": "Send a batch of events",
        "description": "Gzipped JSON (`Content-Encoding: gzip`), at most 500 events, 1 MB compressed and 5 MB decompressed. Invalid events are rejected one by one; duplicates (retries) are counted, not stored twice.",
        "security": [
          {
            "ingestKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "v": {
                    "type": "number",
                    "const": 1
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "privacy",
                      "audit"
                    ]
                  },
                  "sdk": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "maxLength": 64,
                        "pattern": "^[^\\u0000]*$"
                      },
                      "version": {
                        "type": "string",
                        "maxLength": 32,
                        "pattern": "^[^\\u0000]*$"
                      }
                    },
                    "required": [
                      "name",
                      "version"
                    ]
                  },
                  "app": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                      },
                      "env": {
                        "type": "string",
                        "maxLength": 32,
                        "pattern": "^[^\\u0000]*$"
                      },
                      "release": {
                        "type": "string",
                        "maxLength": 64,
                        "pattern": "^[^\\u0000]*$"
                      }
                    },
                    "required": [
                      "id",
                      "env"
                    ]
                  },
                  "source": {
                    "type": "object",
                    "properties": {
                      "shards": {
                        "type": "array",
                        "items": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "cluster": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "instance": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^[^\\u0000]*$"
                      }
                    },
                    "required": [
                      "shards",
                      "instance"
                    ]
                  },
                  "sentAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  },
                  "events": {
                    "minItems": 1,
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "interaction"
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "chat_input",
                                "user_context",
                                "message_context",
                                "primary_entry_point",
                                "button",
                                "select",
                                "modal_submit",
                                "autocomplete"
                              ]
                            },
                            "command": {
                              "type": "string",
                              "maxLength": 32,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "group": {
                              "type": "string",
                              "maxLength": 32,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "sub": {
                              "type": "string",
                              "maxLength": 32,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "commandId": {
                              "type": "string",
                              "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                            },
                            "commandScope": {
                              "type": "string",
                              "enum": [
                                "global",
                                "guild"
                              ]
                            },
                            "options": {
                              "default": [],
                              "maxItems": 25,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "maxLength": 32,
                                "pattern": "^[^\\u0000]*$"
                              }
                            },
                            "optionValues": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string",
                                "maxLength": 32,
                                "pattern": "^[^\\u0000]*$"
                              },
                              "additionalProperties": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "maxLength": 100,
                                    "pattern": "^[^\\u0000]*$"
                                  },
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "boolean"
                                  }
                                ]
                              }
                            },
                            "customId": {
                              "type": "string",
                              "maxLength": 100,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "componentType": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "sourceCommand": {
                              "type": "string",
                              "maxLength": 32,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "context": {
                              "anyOf": [
                                {
                                  "type": "number",
                                  "const": 0
                                },
                                {
                                  "type": "number",
                                  "const": 1
                                },
                                {
                                  "type": "number",
                                  "const": 2
                                }
                              ]
                            },
                            "install": {
                              "type": "string",
                              "enum": [
                                "guild",
                                "user",
                                "both"
                              ]
                            },
                            "guild": {
                              "type": "string",
                              "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                            },
                            "channelType": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "locale": {
                              "type": "string",
                              "maxLength": 10,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "guildLocale": {
                              "type": "string",
                              "maxLength": 10,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "memberTier": {
                              "type": "string",
                              "enum": [
                                "admin",
                                "manager",
                                "member",
                                "dm"
                              ]
                            },
                            "user": {
                              "type": "string",
                              "pattern": "^h1:(\\d{4}-\\d{2}(-\\d{2})?|\\d{4}-W\\d{2}):[0-9a-f]{32}$"
                            },
                            "actor": {
                              "type": "object",
                              "properties": {
                                "userId": {
                                  "type": "string",
                                  "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                                },
                                "username": {
                                  "type": "string",
                                  "maxLength": 64,
                                  "pattern": "^[^\\u0000]*$"
                                },
                                "avatar": {
                                  "type": "string",
                                  "pattern": "^(a_)?[0-9a-f]{32}$"
                                }
                              },
                              "required": [
                                "userId"
                              ]
                            },
                            "premium": {
                              "type": "boolean"
                            },
                            "outcome": {
                              "type": "string",
                              "enum": [
                                "ok",
                                "error",
                                "timeout",
                                "no_response"
                              ]
                            },
                            "errorCode": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "errorClass": {
                              "type": "string",
                              "maxLength": 64,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "ackMs": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "responseType": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "deferred": {
                              "type": "boolean"
                            },
                            "ephemeral": {
                              "type": "boolean"
                            },
                            "handlerMs": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "shard": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "kind",
                            "locale",
                            "user",
                            "premium",
                            "outcome"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "interaction_error"
                            },
                            "interaction": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "command": {
                              "type": "string",
                              "maxLength": 32,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "errorClass": {
                              "type": "string",
                              "maxLength": 64,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "errorCode": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "handlerMs": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "interaction",
                            "errorClass"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "message_command"
                            },
                            "command": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 32,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "group": {
                              "type": "string",
                              "maxLength": 32,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "sub": {
                              "type": "string",
                              "maxLength": 32,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "options": {
                              "default": [],
                              "maxItems": 25,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "maxLength": 32,
                                "pattern": "^[^\\u0000]*$"
                              }
                            },
                            "optionValues": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string",
                                "maxLength": 32,
                                "pattern": "^[^\\u0000]*$"
                              },
                              "additionalProperties": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "maxLength": 100,
                                    "pattern": "^[^\\u0000]*$"
                                  },
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "boolean"
                                  }
                                ]
                              }
                            },
                            "guild": {
                              "type": "string",
                              "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                            },
                            "channelType": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "guildLocale": {
                              "type": "string",
                              "maxLength": 10,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "memberTier": {
                              "type": "string",
                              "enum": [
                                "admin",
                                "manager",
                                "member",
                                "dm"
                              ]
                            },
                            "user": {
                              "type": "string",
                              "pattern": "^h1:(\\d{4}-\\d{2}(-\\d{2})?|\\d{4}-W\\d{2}):[0-9a-f]{32}$"
                            },
                            "actor": {
                              "type": "object",
                              "properties": {
                                "userId": {
                                  "type": "string",
                                  "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                                },
                                "username": {
                                  "type": "string",
                                  "maxLength": 64,
                                  "pattern": "^[^\\u0000]*$"
                                },
                                "avatar": {
                                  "type": "string",
                                  "pattern": "^(a_)?[0-9a-f]{32}$"
                                }
                              },
                              "required": [
                                "userId"
                              ]
                            },
                            "outcome": {
                              "type": "string",
                              "enum": [
                                "ok",
                                "error"
                              ]
                            },
                            "errorClass": {
                              "type": "string",
                              "maxLength": 64,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "errorCode": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "handlerMs": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "shard": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "command",
                            "user",
                            "outcome"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "command_permissions"
                            },
                            "guild": {
                              "type": "string",
                              "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                            },
                            "command": {
                              "type": "string",
                              "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                            },
                            "overwrites": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "guild",
                            "command",
                            "overwrites"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "guild_join"
                            },
                            "info": {
                              "type": "object",
                              "properties": {
                                "guild": {
                                  "type": "string",
                                  "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                                },
                                "name": {
                                  "type": "string",
                                  "maxLength": 100,
                                  "pattern": "^[^\\u0000]*$"
                                },
                                "icon": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 64,
                                      "pattern": "^[^\\u0000]*$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "memberCount": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "large": {
                                  "type": "boolean"
                                },
                                "preferredLocale": {
                                  "type": "string",
                                  "maxLength": 10,
                                  "pattern": "^[^\\u0000]*$"
                                },
                                "features": {
                                  "maxItems": 64,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "maxLength": 64,
                                    "pattern": "^[^\\u0000]*$"
                                  }
                                },
                                "premiumTier": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 3
                                },
                                "boosts": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "verificationLevel": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "nsfwLevel": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "mfaLevel": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "createdAt": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "joinedAt": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "shard": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "channelCounts": {
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string",
                                    "pattern": "^[^\\u0000]*$"
                                  },
                                  "additionalProperties": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "roleCount": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "emojiCount": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "stickerCount": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "botPermissions": {
                                  "type": "string",
                                  "pattern": "^(?:\\d{1,19}|18446744073709551615|[0-0]\\d{19}|1[0-7]\\d{18}|18[0-3]\\d{17}|184[0-3]\\d{16}|1844[0-5]\\d{15}|18446[0-6]\\d{14}|184467[0-3]\\d{13}|1844674[0-3]\\d{12}|184467440[0-6]\\d{10}|1844674407[0-2]\\d{9}|18446744073[0-6]\\d{8}|1844674407370[0-8]\\d{6}|18446744073709[0-4]\\d{5}|184467440737095[0-4]\\d{4}|1844674407370955[0-0]\\d{3}|18446744073709551[0-5]\\d{2}|184467440737095516[0-0]\\d{1}|1844674407370955161[0-4]\\d{0})$"
                                }
                              },
                              "required": [
                                "guild",
                                "name",
                                "icon",
                                "memberCount",
                                "large",
                                "preferredLocale",
                                "features",
                                "premiumTier",
                                "boosts",
                                "verificationLevel",
                                "nsfwLevel",
                                "mfaLevel",
                                "createdAt",
                                "joinedAt",
                                "shard",
                                "channelCounts",
                                "roleCount",
                                "emojiCount",
                                "stickerCount",
                                "botPermissions"
                              ]
                            },
                            "detectedAtStartup": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "info",
                            "detectedAtStartup"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "guild_update"
                            },
                            "info": {
                              "type": "object",
                              "properties": {
                                "guild": {
                                  "type": "string",
                                  "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                                },
                                "name": {
                                  "type": "string",
                                  "maxLength": 100,
                                  "pattern": "^[^\\u0000]*$"
                                },
                                "icon": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 64,
                                      "pattern": "^[^\\u0000]*$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "memberCount": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "large": {
                                  "type": "boolean"
                                },
                                "preferredLocale": {
                                  "type": "string",
                                  "maxLength": 10,
                                  "pattern": "^[^\\u0000]*$"
                                },
                                "features": {
                                  "maxItems": 64,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "maxLength": 64,
                                    "pattern": "^[^\\u0000]*$"
                                  }
                                },
                                "premiumTier": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 3
                                },
                                "boosts": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "verificationLevel": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "nsfwLevel": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "mfaLevel": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "createdAt": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "joinedAt": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "shard": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "channelCounts": {
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string",
                                    "pattern": "^[^\\u0000]*$"
                                  },
                                  "additionalProperties": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "roleCount": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "emojiCount": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "stickerCount": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "botPermissions": {
                                  "type": "string",
                                  "pattern": "^(?:\\d{1,19}|18446744073709551615|[0-0]\\d{19}|1[0-7]\\d{18}|18[0-3]\\d{17}|184[0-3]\\d{16}|1844[0-5]\\d{15}|18446[0-6]\\d{14}|184467[0-3]\\d{13}|1844674[0-3]\\d{12}|184467440[0-6]\\d{10}|1844674407[0-2]\\d{9}|18446744073[0-6]\\d{8}|1844674407370[0-8]\\d{6}|18446744073709[0-4]\\d{5}|184467440737095[0-4]\\d{4}|1844674407370955[0-0]\\d{3}|18446744073709551[0-5]\\d{2}|184467440737095516[0-0]\\d{1}|1844674407370955161[0-4]\\d{0})$"
                                }
                              },
                              "required": [
                                "guild",
                                "name",
                                "icon",
                                "memberCount",
                                "large",
                                "preferredLocale",
                                "features",
                                "premiumTier",
                                "boosts",
                                "verificationLevel",
                                "nsfwLevel",
                                "mfaLevel",
                                "createdAt",
                                "joinedAt",
                                "shard",
                                "channelCounts",
                                "roleCount",
                                "emojiCount",
                                "stickerCount",
                                "botPermissions"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "info"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "guild_leave"
                            },
                            "guild": {
                              "type": "string",
                              "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                            },
                            "detectedAtStartup": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "guild",
                            "detectedAtStartup"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "guild_availability"
                            },
                            "guild": {
                              "type": "string",
                              "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                            },
                            "available": {
                              "type": "boolean"
                            },
                            "shard": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "guild",
                            "available",
                            "shard"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "guild_snapshot"
                            },
                            "shards": {
                              "type": "array",
                              "items": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "shardCount": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "guilds": {
                              "maxItems": 40000,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                              }
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "shards",
                            "shardCount",
                            "guilds"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "command_registry"
                            },
                            "commands": {
                              "maxItems": 5000,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                                  },
                                  "name": {
                                    "type": "string",
                                    "maxLength": 32,
                                    "pattern": "^[^\\u0000]*$"
                                  },
                                  "type": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "guild": {
                                    "type": "string",
                                    "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                                  },
                                  "subcommands": {
                                    "default": [],
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "maxLength": 65,
                                      "pattern": "^[^\\u0000]*$"
                                    }
                                  }
                                },
                                "required": [
                                  "id",
                                  "name",
                                  "type"
                                ]
                              }
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "commands"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "shard_state"
                            },
                            "shard": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "ready",
                                "resumed",
                                "reconnecting",
                                "disconnected",
                                "error",
                                "invalidated"
                              ]
                            },
                            "closeCode": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "replayed": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "unavailableGuilds": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "shard",
                            "state"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "rest_window"
                            },
                            "windowMs": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "rows": {
                              "maxItems": 2000,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "method": {
                                    "type": "string",
                                    "maxLength": 8,
                                    "pattern": "^[^\\u0000]*$"
                                  },
                                  "route": {
                                    "type": "string",
                                    "maxLength": 200,
                                    "pattern": "^[^\\u0000]*$"
                                  },
                                  "status": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "count": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "retries": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "latency": {
                                    "minItems": 40,
                                    "maxItems": 40,
                                    "type": "array",
                                    "items": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 1000000000
                                    }
                                  }
                                },
                                "required": [
                                  "method",
                                  "route",
                                  "status",
                                  "count",
                                  "retries",
                                  "latency"
                                ]
                              }
                            },
                            "invalid": {
                              "type": "object",
                              "properties": {
                                "count401": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "count403": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "count429": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "shared429": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "count401",
                                "count403",
                                "count429",
                                "shared429"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "windowMs",
                            "rows",
                            "invalid"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "rate_limit"
                            },
                            "scope": {
                              "type": "string",
                              "enum": [
                                "user",
                                "global",
                                "shared"
                              ]
                            },
                            "global": {
                              "type": "boolean"
                            },
                            "route": {
                              "type": "string",
                              "maxLength": 200,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "method": {
                              "type": "string",
                              "maxLength": 8,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "limit": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "retryAfter": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 2592000000
                            },
                            "sublimitTimeout": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 2592000000
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "scope",
                            "global",
                            "route",
                            "method",
                            "limit",
                            "retryAfter",
                            "sublimitTimeout"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "invalid_request_warning"
                            },
                            "count": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "remainingTime": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "count",
                            "remainingTime"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "gauge_window"
                            },
                            "gauges": {
                              "maxItems": 500,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": "string",
                                    "maxLength": 64,
                                    "pattern": "^[^\\u0000]*$"
                                  },
                                  "shard": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "value": {
                                    "type": "number"
                                  }
                                },
                                "required": [
                                  "name",
                                  "value"
                                ]
                              }
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "gauges"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "entitlement"
                            },
                            "action": {
                              "type": "string",
                              "enum": [
                                "create",
                                "update",
                                "delete"
                              ]
                            },
                            "sku": {
                              "type": "string",
                              "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                            },
                            "entitlementType": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "owner": {
                              "type": "string",
                              "enum": [
                                "user",
                                "guild"
                              ]
                            },
                            "user": {
                              "type": "string",
                              "pattern": "^h1:(\\d{4}-\\d{2}(-\\d{2})?|\\d{4}-W\\d{2}):[0-9a-f]{32}$"
                            },
                            "guild": {
                              "type": "string",
                              "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                            },
                            "startsAt": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "endsAt": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "action",
                            "sku",
                            "entitlementType",
                            "owner",
                            "startsAt",
                            "endsAt"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "subscription"
                            },
                            "action": {
                              "type": "string",
                              "enum": [
                                "create",
                                "update",
                                "delete"
                              ]
                            },
                            "status": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "skus": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                              }
                            },
                            "user": {
                              "type": "string",
                              "pattern": "^h1:(\\d{4}-\\d{2}(-\\d{2})?|\\d{4}-W\\d{2}):[0-9a-f]{32}$"
                            },
                            "periodStart": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "periodEnd": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "action",
                            "status",
                            "skus",
                            "user",
                            "periodStart",
                            "periodEnd"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "custom"
                            },
                            "name": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,63}$"
                            },
                            "props": {
                              "default": {},
                              "type": "object",
                              "propertyNames": {
                                "type": "string",
                                "maxLength": 64,
                                "pattern": "^[^\\u0000]*$"
                              },
                              "additionalProperties": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "maxLength": 256,
                                    "pattern": "^[^\\u0000]*$"
                                  },
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "boolean"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "user": {
                              "type": "string",
                              "pattern": "^h1:(\\d{4}-\\d{2}(-\\d{2})?|\\d{4}-W\\d{2}):[0-9a-f]{32}$"
                            },
                            "guild": {
                              "type": "string",
                              "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "name"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "app_info"
                            },
                            "name": {
                              "type": "string",
                              "maxLength": 100,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "approximateGuildCount": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "approximateUserInstallCount": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "approximateUserAuthorizationCount": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "dashboardUserIds": {
                              "maxItems": 100,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                              }
                            },
                            "eventWebhooksStatus": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "skus": {
                              "maxItems": 200,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                                  },
                                  "name": {
                                    "type": "string",
                                    "maxLength": 100,
                                    "pattern": "^[^\\u0000]*$"
                                  },
                                  "type": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "id",
                                  "name",
                                  "type"
                                ]
                              }
                            },
                            "sessionStartRemaining": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "sessionStartTotal": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "nodeVersion": {
                              "type": "string",
                              "maxLength": 32,
                              "pattern": "^[^\\u0000]*$"
                            },
                            "libVersion": {
                              "type": "string",
                              "maxLength": 32,
                              "pattern": "^[^\\u0000]*$"
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "name",
                            "approximateGuildCount",
                            "approximateUserInstallCount",
                            "approximateUserAuthorizationCount",
                            "dashboardUserIds",
                            "eventWebhooksStatus",
                            "skus",
                            "nodeVersion",
                            "libVersion"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
                            },
                            "ts": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "weight": {
                              "default": 1,
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 10000
                            },
                            "type": {
                              "type": "string",
                              "const": "sdk_health"
                            },
                            "queueDepth": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "dropped": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string",
                                "pattern": "^[^\\u0000]*$"
                              },
                              "additionalProperties": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              }
                            },
                            "failedFlushes": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "internalErrors": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string",
                                "pattern": "^[^\\u0000]*$"
                              },
                              "additionalProperties": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              }
                            }
                          },
                          "required": [
                            "id",
                            "ts",
                            "type",
                            "queueDepth",
                            "dropped",
                            "failedFlushes",
                            "internalErrors"
                          ]
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "v",
                  "mode",
                  "sdk",
                  "app",
                  "source",
                  "sentAt",
                  "events"
                ],
                "$id": "https://github.com/Kkkermit/Shardlens/schema/batch-v1.json",
                "title": "Shardlens batch (wire format v1)",
                "if": {
                  "properties": {
                    "mode": {
                      "const": "privacy"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                "then": {
                  "properties": {
                    "events": {
                      "items": {
                        "not": {
                          "required": [
                            "type",
                            "actor"
                          ],
                          "properties": {
                            "type": {
                              "enum": [
                                "interaction",
                                "message_command"
                              ]
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accepted": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "duplicates": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "rejected": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "accepted",
                    "duplicates"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid batch envelope, or audit data sent to a privacy-mode app",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or wrong credentials",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The batch is for another application",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "413": {
            "description": "Body too large",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; retry after the `Retry-After` header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Busy; retry after the `Retry-After` header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/config": {
      "get": {
        "tags": [
          "SDK"
        ],
        "summary": "Salts, sampling and data mode for the SDK",
        "description": "The salt of the current period first, then the previous one while it is inside its grace week. In the last 5 minutes of a period the next period’s salt comes too, last: SDKs ask again 1 to 4 minutes before a boundary, so they hold it before the period starts.",
        "security": [
          {
            "ingestKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Current configuration",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "v": {
                      "type": "number",
                      "enum": [
                        1
                      ]
                    },
                    "appId": {
                      "type": "string",
                      "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "privacy",
                        "audit"
                      ]
                    },
                    "saltPeriod": {
                      "type": "string",
                      "enum": [
                        "day",
                        "week",
                        "month"
                      ]
                    },
                    "salts": {
                      "maxItems": 2,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "period": {
                            "type": "string",
                            "maxLength": 16
                          },
                          "salt": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{43}$"
                          }
                        },
                        "required": [
                          "period",
                          "salt"
                        ]
                      }
                    },
                    "sampling": {
                      "default": {},
                      "type": "object",
                      "additionalProperties": {
                        "type": "number",
                        "minimum": 0.0001,
                        "maximum": 1
                      }
                    },
                    "serverTime": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "v",
                    "appId",
                    "mode",
                    "saltPeriod",
                    "salts",
                    "serverTime"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or wrong credentials",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/discord/events": {
      "post": {
        "tags": [
          "Discord"
        ],
        "summary": "Discord webhook events",
        "description": "APPLICATION_AUTHORIZED, APPLICATION_DEAUTHORIZED and ENTITLEMENT_* events. Answered with 204 before processing; retried deliveries are stored once.",
        "security": [
          {
            "discordSignature": []
          }
        ],
        "responses": {
          "204": {
            "description": "Acknowledged"
          },
          "401": {
            "description": "Bad or stale signature",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not configured",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/query": {
      "post": {
        "tags": [
          "Data"
        ],
        "summary": "Run a typed query",
        "description": "Every query kind maps to a fixed SQL template with bound parameters. There is no per-user grouping.",
        "security": [
          {
            "readKey": []
          },
          {
            "activityKey": []
          },
          {
            "session": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "series"
                        ]
                      },
                      "metric": {
                        "type": "string",
                        "enum": [
                          "interactions",
                          "interactions.autocomplete",
                          "components",
                          "modals.submitted",
                          "modals.shown",
                          "interactions.errors",
                          "rest.calls",
                          "rest.invalid",
                          "rest.ratelimits",
                          "guild.joins",
                          "guild.leaves",
                          "guild.unavailable",
                          "custom"
                        ]
                      },
                      "name": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_]{0,63}$"
                      },
                      "range": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      },
                      "interval": {
                        "type": "string",
                        "enum": [
                          "minute",
                          "hour",
                          "day",
                          "week",
                          "month"
                        ]
                      },
                      "groupBy": {
                        "type": "string",
                        "enum": [
                          "command",
                          "sub",
                          "kind",
                          "outcome",
                          "context",
                          "install",
                          "guild",
                          "locale",
                          "tier",
                          "custom_id",
                          "source",
                          "option",
                          "error_class",
                          "method",
                          "route",
                          "status",
                          "scope",
                          "detected"
                        ]
                      },
                      "stat": {
                        "default": "count",
                        "type": "string",
                        "enum": [
                          "count",
                          "sum",
                          "avg",
                          "p50",
                          "p95",
                          "p99"
                        ]
                      },
                      "filters": {
                        "default": [],
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "field": {
                              "type": "string",
                              "enum": [
                                "command",
                                "sub",
                                "kind",
                                "outcome",
                                "context",
                                "install",
                                "guild",
                                "locale",
                                "tier",
                                "custom_id",
                                "source",
                                "option",
                                "error_class",
                                "method",
                                "route",
                                "status",
                                "scope",
                                "detected"
                              ]
                            },
                            "op": {
                              "default": "eq",
                              "type": "string",
                              "enum": [
                                "eq",
                                "in"
                              ]
                            },
                            "value": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 200
                                },
                                {
                                  "minItems": 1,
                                  "maxItems": 100,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "maxLength": 200
                                  }
                                }
                              ]
                            }
                          },
                          "required": [
                            "field",
                            "value"
                          ]
                        }
                      },
                      "timezone": {
                        "default": "UTC",
                        "type": "string",
                        "maxLength": 64
                      },
                      "limit": {
                        "default": 10,
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 20
                      }
                    },
                    "required": [
                      "kind",
                      "metric",
                      "range",
                      "interval"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "top"
                        ]
                      },
                      "metric": {
                        "type": "string",
                        "enum": [
                          "interactions",
                          "interactions.autocomplete",
                          "components",
                          "modals.submitted",
                          "modals.shown",
                          "interactions.errors",
                          "rest.calls",
                          "rest.invalid",
                          "rest.ratelimits",
                          "guild.joins",
                          "guild.leaves",
                          "guild.unavailable",
                          "custom"
                        ]
                      },
                      "name": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_]{0,63}$"
                      },
                      "range": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      },
                      "groupBy": {
                        "type": "string",
                        "enum": [
                          "command",
                          "sub",
                          "kind",
                          "outcome",
                          "context",
                          "install",
                          "guild",
                          "locale",
                          "tier",
                          "custom_id",
                          "source",
                          "option",
                          "error_class",
                          "method",
                          "route",
                          "status",
                          "scope",
                          "detected"
                        ]
                      },
                      "stat": {
                        "default": "count",
                        "type": "string",
                        "enum": [
                          "count",
                          "sum",
                          "avg",
                          "p50",
                          "p95",
                          "p99"
                        ]
                      },
                      "filters": {
                        "default": [],
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "field": {
                              "type": "string",
                              "enum": [
                                "command",
                                "sub",
                                "kind",
                                "outcome",
                                "context",
                                "install",
                                "guild",
                                "locale",
                                "tier",
                                "custom_id",
                                "source",
                                "option",
                                "error_class",
                                "method",
                                "route",
                                "status",
                                "scope",
                                "detected"
                              ]
                            },
                            "op": {
                              "default": "eq",
                              "type": "string",
                              "enum": [
                                "eq",
                                "in"
                              ]
                            },
                            "value": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 200
                                },
                                {
                                  "minItems": 1,
                                  "maxItems": 100,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "maxLength": 200
                                  }
                                }
                              ]
                            }
                          },
                          "required": [
                            "field",
                            "value"
                          ]
                        }
                      },
                      "limit": {
                        "default": 20,
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 500
                      }
                    },
                    "required": [
                      "kind",
                      "metric",
                      "range",
                      "groupBy"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "heatmap"
                        ]
                      },
                      "metric": {
                        "default": "interactions",
                        "type": "string",
                        "enum": [
                          "interactions",
                          "interactions.autocomplete",
                          "components",
                          "modals.submitted",
                          "modals.shown",
                          "interactions.errors",
                          "rest.calls",
                          "rest.invalid",
                          "rest.ratelimits",
                          "guild.joins",
                          "guild.leaves",
                          "guild.unavailable",
                          "custom"
                        ]
                      },
                      "range": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      },
                      "filters": {
                        "default": [],
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "field": {
                              "type": "string",
                              "enum": [
                                "command",
                                "sub",
                                "kind",
                                "outcome",
                                "context",
                                "install",
                                "guild",
                                "locale",
                                "tier",
                                "custom_id",
                                "source",
                                "option",
                                "error_class",
                                "method",
                                "route",
                                "status",
                                "scope",
                                "detected"
                              ]
                            },
                            "op": {
                              "default": "eq",
                              "type": "string",
                              "enum": [
                                "eq",
                                "in"
                              ]
                            },
                            "value": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 200
                                },
                                {
                                  "minItems": 1,
                                  "maxItems": 100,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "maxLength": 200
                                  }
                                }
                              ]
                            }
                          },
                          "required": [
                            "field",
                            "value"
                          ]
                        }
                      },
                      "timezone": {
                        "default": "UTC",
                        "type": "string",
                        "maxLength": 64
                      }
                    },
                    "required": [
                      "kind",
                      "range"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "commands"
                        ]
                      },
                      "range": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "range"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "command"
                        ]
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 32
                      },
                      "range": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "name",
                      "range"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "servers"
                        ]
                      },
                      "search": {
                        "type": "string",
                        "maxLength": 100
                      },
                      "status": {
                        "default": "active",
                        "type": "string",
                        "enum": [
                          "active",
                          "left",
                          "all"
                        ]
                      },
                      "feature": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "locale": {
                        "type": "string",
                        "maxLength": 10
                      },
                      "size": {
                        "type": "string",
                        "enum": [
                          "1-10",
                          "11-100",
                          "101-1k",
                          "1k-10k",
                          "10k+"
                        ]
                      },
                      "inactive": {
                        "type": "boolean"
                      },
                      "missingPermissions": {
                        "type": "boolean"
                      },
                      "sort": {
                        "default": "members",
                        "type": "string",
                        "enum": [
                          "members",
                          "joined",
                          "last_active",
                          "runs",
                          "name"
                        ]
                      },
                      "order": {
                        "default": "desc",
                        "type": "string",
                        "enum": [
                          "asc",
                          "desc"
                        ]
                      },
                      "limit": {
                        "default": 50,
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 200
                      },
                      "offset": {
                        "default": 0,
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000000
                      }
                    },
                    "required": [
                      "kind"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "server"
                        ]
                      },
                      "guild": {
                        "type": "string",
                        "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                      }
                    },
                    "required": [
                      "kind",
                      "guild"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "growth"
                        ]
                      },
                      "range": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      },
                      "timezone": {
                        "default": "UTC",
                        "type": "string",
                        "maxLength": 64
                      }
                    },
                    "required": [
                      "kind",
                      "range"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "audience"
                        ]
                      },
                      "range": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "range"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "overview"
                        ]
                      }
                    },
                    "required": [
                      "kind"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "gauge"
                        ]
                      },
                      "name": {
                        "type": "string",
                        "maxLength": 64,
                        "pattern": "^[a-z][a-z0-9_.]{0,63}$"
                      },
                      "range": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      },
                      "interval": {
                        "type": "string",
                        "enum": [
                          "minute",
                          "hour",
                          "day"
                        ]
                      },
                      "perShard": {
                        "default": false,
                        "type": "boolean"
                      },
                      "timezone": {
                        "default": "UTC",
                        "type": "string",
                        "maxLength": 64
                      }
                    },
                    "required": [
                      "kind",
                      "name",
                      "range",
                      "interval"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "bursts"
                        ]
                      },
                      "range": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      },
                      "factor": {
                        "default": 5,
                        "type": "number",
                        "minimum": 2,
                        "maximum": 50
                      }
                    },
                    "required": [
                      "kind",
                      "range"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "reliability"
                        ]
                      },
                      "range": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "range"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "premium"
                        ]
                      },
                      "range": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "range"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "installs"
                        ]
                      },
                      "range": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      },
                      "timezone": {
                        "default": "UTC",
                        "type": "string",
                        "maxLength": 64
                      }
                    },
                    "required": [
                      "kind",
                      "range"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "events"
                        ]
                      },
                      "range": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "range"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "eventProps"
                        ]
                      },
                      "name": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_]{0,63}$"
                      },
                      "range": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      },
                      "prop": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      }
                    },
                    "required": [
                      "kind",
                      "name",
                      "range"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "funnel"
                        ]
                      },
                      "steps": {
                        "minItems": 2,
                        "maxItems": 5,
                        "type": "array",
                        "items": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "event"
                                  ]
                                },
                                "name": {
                                  "type": "string",
                                  "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                }
                              },
                              "required": [
                                "type",
                                "name"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "command"
                                  ]
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 32
                                }
                              },
                              "required": [
                                "type",
                                "name"
                              ]
                            }
                          ]
                        }
                      },
                      "range": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      },
                      "windowHours": {
                        "default": 24,
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 168
                      },
                      "timezone": {
                        "default": "UTC",
                        "type": "string",
                        "maxLength": 64
                      }
                    },
                    "required": [
                      "kind",
                      "steps",
                      "range"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "retention"
                        ]
                      },
                      "start": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "event"
                                ]
                              },
                              "name": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,63}$"
                              }
                            },
                            "required": [
                              "type",
                              "name"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "command"
                                ]
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 32
                              }
                            },
                            "required": [
                              "type",
                              "name"
                            ]
                          }
                        ]
                      },
                      "return": {
                        "default": "any",
                        "anyOf": [
                          {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "event"
                                    ]
                                  },
                                  "name": {
                                    "type": "string",
                                    "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                  }
                                },
                                "required": [
                                  "type",
                                  "name"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "command"
                                    ]
                                  },
                                  "name": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 32
                                  }
                                },
                                "required": [
                                  "type",
                                  "name"
                                ]
                              }
                            ]
                          },
                          {
                            "type": "string",
                            "enum": [
                              "any"
                            ]
                          }
                        ]
                      },
                      "range": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          "to": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "from",
                          "to"
                        ]
                      },
                      "interval": {
                        "default": "week",
                        "type": "string",
                        "enum": [
                          "day",
                          "week"
                        ]
                      },
                      "timezone": {
                        "default": "UTC",
                        "type": "string",
                        "maxLength": 64
                      }
                    },
                    "required": [
                      "kind",
                      "start",
                      "range"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Query result (shape depends on `kind`)"
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or wrong credentials",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/meta": {
      "get": {
        "tags": [
          "Data"
        ],
        "summary": "Application name, mode and time zone",
        "security": [
          {
            "readKey": []
          },
          {
            "activityKey": []
          },
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "Metadata"
          },
          "401": {
            "description": "Missing or wrong credentials",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/live": {
      "get": {
        "tags": [
          "Data"
        ],
        "summary": "Live tiles (Server-Sent Events)",
        "security": [
          {
            "readKey": []
          },
          {
            "activityKey": []
          },
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "`tiles` events every second, and a `: heartbeat` comment every 15 seconds whatever the database does. A reader that has received nothing for 45 seconds can treat the connection as gone.",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Missing or wrong credentials",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/badge/{metric}": {
      "get": {
        "tags": [
          "Data"
        ],
        "summary": "Public SVG badge (opt-in per metric)",
        "parameters": [
          {
            "name": "metric",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "servers.svg",
                "users-monthly.svg",
                "commands-daily.svg"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Badge",
            "content": {
              "image/svg+xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or switched off",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/privacy/erase": {
      "post": {
        "tags": [
          "Privacy"
        ],
        "summary": "Erase everything stored about a user",
        "description": "From an SDK: user hashes (the raw ID only in audit mode). From the dashboard: an exact Discord user ID. Every erasure is logged.",
        "security": [
          {
            "ingestKey": []
          },
          {
            "session": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "userHashes": {
                    "default": [],
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^h1:[0-9A-Za-z-]+:[0-9a-f]{32}$"
                    }
                  },
                  "userId": {
                    "type": "string",
                    "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rows removed"
          },
          "400": {
            "description": "Nothing to erase, or a raw ID in privacy mode",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/settings": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Read settings",
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "Settings"
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Admin"
        ],
        "summary": "Change settings",
        "description": "Audit retention above 90 days is rejected. Audit mode needs `SHARDLENS_AUDIT_KEY` on the collector.",
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "timezone": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "rawRetentionDays": {
                    "type": "integer",
                    "minimum": 7,
                    "maximum": 90
                  },
                  "auditRetentionDays": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 90
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "privacy",
                      "audit"
                    ]
                  },
                  "saltPeriod": {
                    "type": "string",
                    "enum": [
                      "day",
                      "week",
                      "month"
                    ]
                  },
                  "requiredPermissions": {
                    "nullable": true,
                    "type": "string",
                    "pattern": "^\\d{1,19}$"
                  },
                  "skuPrices": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "amount": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        }
                      },
                      "required": [
                        "amount",
                        "currency"
                      ]
                    }
                  },
                  "sampling": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "number",
                      "minimum": 0.0001,
                      "maximum": 1
                    }
                  },
                  "badges": {
                    "maxItems": 3,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "servers",
                        "users-monthly",
                        "commands-daily"
                      ]
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated settings"
          },
          "400": {
            "description": "Invalid settings",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "List API keys",
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "Keys (never the secrets)"
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Create an API key (shown once)",
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "scope": {
                    "type": "string",
                    "enum": [
                      "ingest",
                      "read",
                      "activity"
                    ]
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "required": [
                  "scope",
                  "label"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new key, shown once"
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys/{id}": {
      "delete": {
        "tags": [
          "Admin"
        ],
        "summary": "Revoke an API key",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked"
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/alerts": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Alert rules and history",
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "Rules (webhook URLs masked)"
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Create an alert rule",
        "description": "The webhook must be a Discord webhook URL; it is stored encrypted.",
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "metric": {
                    "type": "string",
                    "enum": [
                      "missed_deadline_rate",
                      "error_rate",
                      "p95_ms",
                      "invalid_requests_pct",
                      "stale_shards",
                      "interactions_per_min",
                      "identify_remaining"
                    ]
                  },
                  "comparator": {
                    "type": "string",
                    "enum": [
                      ">",
                      ">=",
                      "<",
                      "<="
                    ]
                  },
                  "threshold": {
                    "type": "number"
                  },
                  "windowS": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 86400
                  },
                  "webhookUrl": {
                    "type": "string",
                    "maxLength": 300
                  }
                },
                "required": [
                  "name",
                  "metric",
                  "comparator",
                  "threshold",
                  "windowS",
                  "webhookUrl"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created"
          },
          "400": {
            "description": "Invalid rule or webhook URL",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/alerts/{id}": {
      "patch": {
        "tags": [
          "Admin"
        ],
        "summary": "Turn a rule on or off",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,18}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "enabled"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated"
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Admin"
        ],
        "summary": "Delete a rule",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted"
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/alerts/{id}/test": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Send a test message",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sent"
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "502": {
            "description": "Discord refused it",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Scheduled reports",
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "Reports (webhook URLs masked) and the time zone they run in"
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Create a scheduled report",
        "description": "A daily or weekly summary posted to a Discord channel. The webhook must be a Discord webhook URL; it is stored encrypted. Reports contain counts only.",
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "schedule": {
                    "type": "string",
                    "enum": [
                      "daily",
                      "weekly"
                    ]
                  },
                  "hour": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 23
                  },
                  "weekday": {
                    "default": 1,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 7
                  },
                  "webhookUrl": {
                    "type": "string",
                    "maxLength": 300
                  }
                },
                "required": [
                  "name",
                  "schedule",
                  "hour",
                  "webhookUrl"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created"
          },
          "400": {
            "description": "Invalid report or webhook URL",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/{id}": {
      "patch": {
        "tags": [
          "Admin"
        ],
        "summary": "Turn a report on or off",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,18}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "enabled"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated"
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Admin"
        ],
        "summary": "Delete a report",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted"
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/{id}/send": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Send a report now",
        "description": "Posts the report for its last finished day or week.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,18}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sent"
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "502": {
            "description": "Discord refused it",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/audit/log": {
      "get": {
        "tags": [
          "Audit mode"
        ],
        "summary": "Activity log (who ran what)",
        "description": "Filter by time, command, server, outcome (`failed` is every outcome but `ok`) or exact user ID. `nextBefore` in the reply is the `before` of the next page. For a Discord sign-in or an activity key (a read key gets `403 activity_key_required`). Logged in the access log.",
        "security": [
          {
            "session": []
          },
          {
            "activityKey": []
          }
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                {
                  "type": "string",
                  "pattern": "^[\\dT:.+-]{20,35}Z?~[0-9a-f-]{36}$"
                }
              ]
            }
          },
          {
            "name": "command",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 32
            }
          },
          {
            "name": "guild",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
            }
          },
          {
            "name": "user",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
            }
          },
          {
            "name": "outcome",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ok",
                "error",
                "timeout",
                "no_response",
                "failed"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rows, newest first"
          },
          "400": {
            "description": "Unknown or malformed filter",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Audit mode is off",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/audit/top-users": {
      "get": {
        "tags": [
          "Audit mode"
        ],
        "summary": "Most active users in the last 24 hours or 7 days",
        "description": "For a Discord sign-in or an activity key. Logged in the access log.",
        "security": [
          {
            "session": []
          },
          {
            "activityKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Counts"
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Audit mode is off",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/audit/export.csv": {
      "get": {
        "tags": [
          "Audit mode"
        ],
        "summary": "Export the activity log as CSV",
        "description": "Takes the filters of the activity log (up to 10,000 rows; `limit` is ignored). Needs `x-shardlens-confirm: export-audit-log` and the CSRF header. Spreadsheet formulas are neutralised.",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                {
                  "type": "string",
                  "pattern": "^[\\dT:.+-]{20,35}Z?~[0-9a-f-]{36}$"
                }
              ]
            }
          },
          {
            "name": "command",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 32
            }
          },
          {
            "name": "guild",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
            }
          },
          {
            "name": "user",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(?:\\d{17,18}|[1-8]\\d{18}|9[01]\\d{17})$"
            }
          },
          {
            "name": "outcome",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ok",
                "error",
                "timeout",
                "no_response",
                "failed"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "CSV",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "428": {
            "description": "Confirmation missing",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/audit/access-log": {
      "get": {
        "tags": [
          "Audit mode"
        ],
        "summary": "Who viewed, looked up, exported or erased audit data",
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "Entries"
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Needs a Discord sign-in (owner or team) and, for changes, the CSRF header",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/auth/discord": {
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "Start \"Sign in with Discord\"",
        "responses": {
          "302": {
            "description": "Redirect to Discord"
          }
        }
      }
    },
    "/auth/discord/callback": {
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "OAuth2 callback",
        "responses": {
          "302": {
            "description": "Signed in, or back to the login page"
          }
        }
      }
    },
    "/auth/read-key": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Sign in with a read key (view-only session)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string"
                  }
                },
                "required": [
                  "key"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Signed in"
          },
          "401": {
            "description": "Key not accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "CSRF header missing",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "rejected": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "index",
                          "reason"
                        ]
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/auth/logout": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Sign out",
        "responses": {
          "200": {
            "description": "Signed out"
          }
        }
      }
    },
    "/auth/me": {
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "Current session",
        "responses": {
          "200": {
            "description": "Session state"
          }
        }
      }
    },
    "/healthz": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Liveness",
        "responses": {
          "200": {
            "description": "Running"
          }
        }
      }
    },
    "/readyz": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Readiness (database reachable)",
        "responses": {
          "200": {
            "description": "Ready"
          },
          "503": {
            "description": "Not ready"
          }
        }
      }
    }
  }
}
