{
  "openapi": "3.1.1",
  "info": {
    "title": "FlowPrime observability",
    "description": "Errors grouped into issues, logs, metrics, traces and a live stream per organization. Query routes take a dashboard JWT (Authorization: Bearer) or the platform key (X-Api-Key) with X-Org-Slug. Ingest (/v1/ingest, /v1/otlp/v1/*) authenticates with a source key.",
    "version": "0.2.4-a520d0c"
  },
  "servers": [
    {
      "url": "https://{org}.observability.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"
        }
      }
    },
    {
      "url": "https://api.fastflow.tech/observability",
      "description": "API gateway; send X-Org-Slug."
    }
  ],
  "paths": {
    "/v1/ingest": {
      "post": {
        "tags": [
          "Ingest"
        ],
        "summary": "Send errors, logs, metrics and spans",
        "description": "Body (application/json or text/plain for sendBeacon, gzip accepted): {key, release?, environment?, session_id?, user_id?, items:[...]}. The key is a source key (obs_pub_ from a browser source's registered origins, obs_app_ from an app, obs_sec_ from a server, also accepted in X-Obs-Key). Items: {type:'error', kind, message, stack?, tags?}, {type:'log', level, message, attrs?, trace_id?, span_id?}, {type:'metric', name, value, unit?, tags?}, {type:'span', trace_id, span_id, parent_span_id?, name, service?, start, duration_ms, status, attrs?}; every item may carry ts (ISO 8601 or epoch ms). Top-level release, environment, session_id and user_id are defaults for every item. Up to 256 KB and 500 items per request. Answers 202 {accepted, rejected:[{index, error}], dropped:{logs, spans, errorSamples, errors, metrics}}; 401 for an unknown key, 403 for a browser key from another origin, 413 past the size, 429 with Retry-After past the org's rate. Past the rate, errors still count on their issue and metrics still roll up only up to a second per-org overflow allowance; past that allowance errors no longer count on their issue and metrics are dropped, reported in this response only (dropped.errors, dropped.metrics), never in usage. An org over its storage budget answers 202 with error over_budget and keeps only what that allowance takes, even within its rate.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/otlp/v1/logs": {
      "post": {
        "tags": [
          "Ingest"
        ],
        "summary": "OpenTelemetry logs (OTLP/HTTP)",
        "description": "Standard OTLP/HTTP export of log records, as any OpenTelemetry SDK sends it: application/json or application/x-protobuf, gzip accepted; the source key in X-Obs-Key or Authorization: Bearer. Point an exporter's endpoint at /v1/otlp. Answers 200 {} or {partialSuccess}, 401 for an unknown key, 415 for any other content type, 429 with Retry-After past the org's rate. Exception events and error spans also become issues.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/otlp/v1/traces": {
      "post": {
        "tags": [
          "Ingest"
        ],
        "summary": "OpenTelemetry traces (OTLP/HTTP)",
        "description": "Standard OTLP/HTTP export of spans, as any OpenTelemetry SDK sends it: application/json or application/x-protobuf, gzip accepted; the source key in X-Obs-Key or Authorization: Bearer. Point an exporter's endpoint at /v1/otlp. Answers 200 {} or {partialSuccess}, 401 for an unknown key, 415 for any other content type, 429 with Retry-After past the org's rate. Exception events and error spans also become issues.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/otlp/v1/metrics": {
      "post": {
        "tags": [
          "Ingest"
        ],
        "summary": "OpenTelemetry metrics (OTLP/HTTP)",
        "description": "Standard OTLP/HTTP export of metric points, as any OpenTelemetry SDK sends it: application/json or application/x-protobuf, gzip accepted; the source key in X-Obs-Key or Authorization: Bearer. Point an exporter's endpoint at /v1/otlp. Answers 200 {} or {partialSuccess}, 401 for an unknown key, 415 for any other content type, 429 with Retry-After past the org's rate. Exception events and error spans also become issues.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/admin/databases": {
      "get": {
        "tags": [
          "Observability"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/health": {
      "get": {
        "tags": [
          "Observability"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/health/live": {
      "get": {
        "tags": [
          "Observability"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/health/ready": {
      "get": {
        "tags": [
          "Observability"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/auth/login": {
      "get": {
        "tags": [
          "Observability"
        ],
        "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": [
          "Observability"
        ],
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/my-accounts": {
      "get": {
        "tags": [
          "Observability"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/switch-account": {
      "post": {
        "tags": [
          "Observability"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/auth/logout": {
      "get": {
        "tags": [
          "Observability"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/overview": {
      "get": {
        "tags": [
          "Observability"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/issues": {
      "get": {
        "tags": [
          "Observability"
        ],
        "description": "Issues seen in the range, newest first. user_id lists only the issues that user hit.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "user_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/issues/{id}": {
      "get": {
        "tags": [
          "Observability"
        ],
        "description": "One issue: series, tag breakdown, usersBreakdown (the top users who hit it in the range, from stored samples: user_id, events, lastSeen), latest (with the user_id and session_id it was sent with), latestStack and history.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/issues/{id}/actions": {
      "post": {
        "tags": [
          "Observability"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueAction"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/logs": {
      "get": {
        "tags": [
          "Observability"
        ],
        "description": "Log lines in the range: total, histogram and lines (each with trace_id, span_id, user_id, session_id and attrs). q takes free text plus level:x, source:x and key:value on attrs; user_id and session_id match the ids the line was sent with.",
        "parameters": [
          {
            "name": "levels",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "trace_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "user_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "session_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/traces/{traceId}": {
      "get": {
        "tags": [
          "Observability"
        ],
        "parameters": [
          {
            "name": "traceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/metrics": {
      "get": {
        "tags": [
          "Observability"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/metrics/prefs": {
      "get": {
        "tags": [
          "Observability"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "put": {
        "tags": [
          "Observability"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/metrics/{name}/split": {
      "get": {
        "tags": [
          "Observability"
        ],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/live": {
      "get": {
        "tags": [
          "QueryEndpoints"
        ],
        "parameters": [
          {
            "name": "types",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/usage": {
      "get": {
        "tags": [
          "Observability"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/sources": {
      "get": {
        "tags": [
          "Observability"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "tags": [
          "Observability"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewSource"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/sources/{id}": {
      "delete": {
        "tags": [
          "Observability"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/sources/{id}/rotate": {
      "post": {
        "tags": [
          "Observability"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/tenants/provision": {
      "post": {
        "tags": [
          "Observability"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/tenants/activate": {
      "post": {
        "tags": [
          "Observability"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/tenants/deactivate": {
      "post": {
        "tags": [
          "Observability"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/tenants/{orgSlug}": {
      "delete": {
        "tags": [
          "Observability"
        ],
        "parameters": [
          {
            "name": "orgSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "IssueAction": {
        "required": [
          "action",
          "mode"
        ],
        "type": "object",
        "properties": {
          "action": {
            "type": [
              "null",
              "string"
            ]
          },
          "mode": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "NewSource": {
        "required": [
          "name",
          "kind",
          "platform",
          "origins"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "null",
              "string"
            ]
          },
          "kind": {
            "type": [
              "null",
              "string"
            ]
          },
          "platform": {
            "type": [
              "null",
              "string"
            ]
          },
          "origins": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string"
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Ingest"
    },
    {
      "name": "Observability"
    },
    {
      "name": "QueryEndpoints"
    }
  ]
}