{
  "openapi": "3.1.1",
  "info": {
    "title": "FlowPrime analytics",
    "description": "Product and web analytics for a FlowPrime organization: event ingest, campaigns, funnels, retention and query. Tenant is resolved from the {org} subdomain or the X-Org-Slug header.",
    "version": "3.1.2-2cc9a96"
  },
  "servers": [
    {
      "url": "https://{org}.analytics.fastflow.tech",
      "description": "Tenant host. The org slug is also accepted as the X-Org-Slug header.",
      "variables": {
        "org": {
          "default": "your-org",
          "description": "Your FlowPrime organization slug"
        }
      }
    }
  ],
  "paths": {
    "/api/events": {
      "post": {
        "tags": [
          "Analytics"
        ],
        "summary": "Event ingest",
        "description": "Accepts a JSON event payload (or a beacon body from the web snippet) and records it against the resolved org. Limits (docs: /llms.txt): 1 MB body (413 body_too_large), 1,000 events per request (422 batch_too_large), 50 events a second per organization with a burst of 2,000 (429 rate_limited with Retry-After). The body is read directly rather than bound, so the shapes accepted are the ones the ingest service documents; the collect paths exist as short aliases for the browser snippet.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/usage/limits": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/usage": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "period",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customer_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "product_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/query/summary": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filters",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/query/events/top": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "filters",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/query/events/list": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "eventName",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "filters",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "match",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeTotal",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/query/events/timeseries": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "eventName",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filters",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/query/properties": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "eventName",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "property",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filters",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/query/users/active": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "filters",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/query/admin/overview": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/admin/databases": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/query/admin/tenant/{orgSlug}/summary": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "orgSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/query/admin/tenant/{orgSlug}/events/top": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "orgSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/query/admin/tenant/{orgSlug}/events/list": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "orgSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "eventName",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "filters",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "match",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeTotal",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/export/links": {
      "post": {
        "tags": [
          "Analytics"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/ExportLinkRequest"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/export/download/{token}": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/export/events": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "tenantId",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "orgSlug",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "range",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/export/timeseries": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "tenantId",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "orgSlug",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "range",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/i": {
      "post": {
        "tags": [
          "CollectEndpoints"
        ],
        "summary": "Event ingest",
        "description": "Accepts a JSON event payload (or a beacon body from the web snippet) and records it against the resolved org. Limits (docs: /llms.txt): 1 MB body (413 body_too_large), 1,000 events per request (422 batch_too_large), 50 events a second per organization with a burst of 2,000 (429 rate_limited with Retry-After). The body is read directly rather than bound, so the shapes accepted are the ones the ingest service documents; the collect paths exist as short aliases for the browser snippet.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/collect": {
      "post": {
        "tags": [
          "CollectEndpoints"
        ],
        "summary": "Event ingest",
        "description": "Accepts a JSON event payload (or a beacon body from the web snippet) and records it against the resolved org. Limits (docs: /llms.txt): 1 MB body (413 body_too_large), 1,000 events per request (422 batch_too_large), 50 events a second per organization with a burst of 2,000 (429 rate_limited with Retry-After). The body is read directly rather than bound, so the shapes accepted are the ones the ingest service documents; the collect paths exist as short aliases for the browser snippet.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/e": {
      "post": {
        "tags": [
          "CollectEventEndpoints"
        ],
        "summary": "Browser event ingest (site token, no key)",
        "description": "For a page or game that cannot keep a secret. No X-Api-Key: the body carries the public site token as siteId and the request must come from the site's registered origin. Content-Type is not checked, so navigator.sendBeacon with a text/plain JSON string works. One event: {siteId, eventName, properties?, userId?, sessionId?, timestamp?, eventId?}. A batch: {siteId, userId?, sessionId?, events:[{eventName, properties?, userId?, sessionId?, timestamp?, eventId?}]} with at most 1,000 events and 1 MB; userId and sessionId at the top are the defaults for each event. The shape of an event is kept as sent (ids, timestamp, properties); only the name is required. A userId sent here is stored with the prefix anon_ (send player-1, read back anon_player-1), so it can never write into a signed-in user's id; with no userId the event gets a per-day visitor hash. A repeated eventId is stored once. Every event is stored with the property ff_site set to its site's domain (a value the client sends there is replaced), so one site per platform can be told apart with a property filter. Answers 204; 400 for a bad body or a nameless event, 403 for another origin, 404 for an unknown site, 413 past 1 MB, 422 batch_too_large past 1,000 events, and 429 with Retry-After past 600 events a minute for one caller on one site, past the organization's rate (50 events a second, burst 2,000), or when the event queue is full. Refusals carry a hint pointing logs, errors and metrics to Observability.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/collect/events": {
      "post": {
        "tags": [
          "CollectEventEndpoints"
        ],
        "summary": "Browser event ingest (site token, no key)",
        "description": "For a page or game that cannot keep a secret. No X-Api-Key: the body carries the public site token as siteId and the request must come from the site's registered origin. Content-Type is not checked, so navigator.sendBeacon with a text/plain JSON string works. One event: {siteId, eventName, properties?, userId?, sessionId?, timestamp?, eventId?}. A batch: {siteId, userId?, sessionId?, events:[{eventName, properties?, userId?, sessionId?, timestamp?, eventId?}]} with at most 1,000 events and 1 MB; userId and sessionId at the top are the defaults for each event. The shape of an event is kept as sent (ids, timestamp, properties); only the name is required. A userId sent here is stored with the prefix anon_ (send player-1, read back anon_player-1), so it can never write into a signed-in user's id; with no userId the event gets a per-day visitor hash. A repeated eventId is stored once. Every event is stored with the property ff_site set to its site's domain (a value the client sends there is replaced), so one site per platform can be told apart with a property filter. Answers 204; 400 for a bad body or a nameless event, 403 for another origin, 404 for an unknown site, 413 past 1 MB, 422 batch_too_large past 1,000 events, and 429 with Retry-After past 600 events a minute for one caller on one site, past the organization's rate (50 events a second, burst 2,000), or when the event queue is full. Refusals carry a hint pointing logs, errors and metrics to Observability.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/web/sites": {
      "post": {
        "tags": [
          "Analytics"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebSiteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "Analytics"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/web/sites/{siteToken}": {
      "put": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "siteToken",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWebSiteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "siteToken",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/web/sites/{siteToken}/snippet": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "siteToken",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/web/summary": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "site",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/web/pages": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "site",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/web/referrers": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "site",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/web/timeseries": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "site",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/web/utm": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "site",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/web/devices": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "site",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/funnels": {
      "post": {
        "tags": [
          "Analytics"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateFunnelRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "Analytics"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/funnels/{id}": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "filters",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/campaigns": {
      "post": {
        "tags": [
          "Analytics"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCampaignRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "Analytics"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/campaigns/{id}": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "range",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/query/retention": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "cohortEvent",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "returnEvent",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/query/users/{userId}/journey": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "format": "date-time"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/auth/login": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "returnUrl",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "login_hint",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "prompt",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/auth/callback": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/my-accounts": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/switch-account": {
      "post": {
        "tags": [
          "Analytics"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/auth/logout": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/health": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/tenants/{orgSlug}/keys": {
      "post": {
        "tags": [
          "Analytics"
        ],
        "summary": "Mint a named API key for a tenant",
        "description": "Adds a key to the tenant without touching the ones it already has, so a client can move to it before the old key is revoked. The key is returned in this answer only and cannot be read back. Requires the platform provision key in X-Api-Key.",
        "parameters": [
          {
            "name": "orgSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MintKeyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MintedKey"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request"
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Not Found"
          },
          "409": {
            "description": "Conflict"
          }
        }
      },
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "List a tenant's API keys",
        "description": "Every key of the tenant by name, with its first characters, creation and revocation times. The key the tenant was created with is named \"default\". Never returns a secret. Requires the platform provision key in X-Api-Key.",
        "parameters": [
          {
            "name": "orgSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/KeyView"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Not Found"
          }
        }
      }
    },
    "/v1/tenants/{orgSlug}/keys/{name}": {
      "delete": {
        "tags": [
          "Analytics"
        ],
        "summary": "Revoke one of a tenant's API keys",
        "description": "A revoked key answers 401 from then on. \"default\" is the key the tenant was created with. Revoking the tenant's last active key is refused with 409: mint a new one first. Revoking a key that is already revoked answers 200 again. Requires the platform provision key in X-Api-Key.",
        "parameters": [
          {
            "name": "orgSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevokedKey"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Not Found"
          },
          "409": {
            "description": "Conflict"
          }
        }
      }
    },
    "/v1/tenants/provision": {
      "post": {
        "tags": [
          "Analytics"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewProvisionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/tenants/activate": {
      "post": {
        "tags": [
          "Analytics"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActivateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/tenants/deactivate": {
      "post": {
        "tags": [
          "Analytics"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActivateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/tenants/{orgSlug}": {
      "delete": {
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "name": "orgSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ActivateRequest": {
        "required": [
          "orgSlug"
        ],
        "type": "object",
        "properties": {
          "orgSlug": {
            "type": "string"
          }
        }
      },
      "CreateCampaignRequest": {
        "required": [
          "name",
          "source",
          "medium",
          "campaignTag",
          "targetUrl"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "medium": {
            "type": "string"
          },
          "campaignTag": {
            "type": "string"
          },
          "targetUrl": {
            "type": "string"
          }
        }
      },
      "CreateFunnelRequest": {
        "required": [
          "name",
          "steps"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "windowHours": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32",
            "default": 168
          }
        }
      },
      "CreateWebSiteRequest": {
        "required": [
          "domain",
          "allowedOrigins"
        ],
        "type": "object",
        "properties": {
          "domain": {
            "type": "string"
          },
          "allowedOrigins": { }
        }
      },
      "ExportLinkRequest": {
        "required": [
          "afterId",
          "limit",
          "filters",
          "from",
          "to"
        ],
        "type": "object",
        "properties": {
          "afterId": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "limit": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "filters": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/JsonElement"
              }
            ]
          },
          "from": {
            "format": "date-time"
          },
          "to": {
            "format": "date-time"
          }
        }
      },
      "JsonElement": { },
      "KeyView": {
        "required": [
          "name",
          "prefix",
          "createdAt",
          "revokedAt"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "createdAt": {
            "format": "date-time"
          },
          "revokedAt": {
            "format": "date-time"
          }
        }
      },
      "MintedKey": {
        "required": [
          "name",
          "key",
          "createdAt"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "createdAt": {
            "format": "date-time"
          }
        }
      },
      "MintKeyRequest": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "NewProvisionRequest": {
        "required": [
          "orgSlug",
          "stripeCustomerId",
          "plan",
          "email",
          "alkeyonOrgId",
          "productCallbacks"
        ],
        "type": "object",
        "properties": {
          "orgSlug": {
            "type": "string"
          },
          "stripeCustomerId": {
            "type": [
              "null",
              "string"
            ]
          },
          "plan": {
            "type": [
              "null",
              "string"
            ]
          },
          "email": {
            "type": [
              "null",
              "string"
            ]
          },
          "alkeyonOrgId": {
            "type": [
              "null",
              "string"
            ]
          },
          "productCallbacks": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/ProductCallback"
            }
          }
        }
      },
      "ProductCallback": {
        "required": [
          "product",
          "url",
          "apiKey"
        ],
        "type": "object",
        "properties": {
          "product": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "apiKey": {
            "type": "string"
          }
        }
      },
      "RevokedKey": {
        "required": [
          "name",
          "revokedAt"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "revokedAt": {
            "format": "date-time"
          }
        }
      },
      "UpdateWebSiteRequest": {
        "required": [
          "domain",
          "allowedOrigins"
        ],
        "type": "object",
        "properties": {
          "domain": {
            "type": [
              "null",
              "string"
            ]
          },
          "allowedOrigins": { }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Analytics"
    },
    {
      "name": "CollectEndpoints"
    },
    {
      "name": "CollectEventEndpoints"
    }
  ]
}