{"openapi":"3.0.0","paths":{"/health":{"get":{"operationId":"getHealth","parameters":[],"responses":{"200":{"description":"The Health Check is successful","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok","degraded"],"example":"ok"},"info":{"type":"object","example":{"database":{"status":"up","responseTime":12}},"additionalProperties":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["up","degraded","down"]},"responseTime":{"type":"number","description":"Time the health indicator took to respond, in ms"}},"additionalProperties":true},"nullable":true},"error":{"type":"object","example":{},"additionalProperties":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["up","degraded","down"]},"responseTime":{"type":"number","description":"Time the health indicator took to respond, in ms"}},"additionalProperties":true},"nullable":true},"details":{"type":"object","example":{"database":{"status":"up","responseTime":12}},"additionalProperties":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["up","degraded","down"]},"responseTime":{"type":"number","description":"Time the health indicator took to respond, in ms"}},"additionalProperties":true}}}}}}},"503":{"description":"The Health Check is not successful","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error","shutting_down"],"example":"error"},"info":{"type":"object","example":{"database":{"status":"up","responseTime":12}},"additionalProperties":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["up","degraded","down"]},"responseTime":{"type":"number","description":"Time the health indicator took to respond, in ms"}},"additionalProperties":true},"nullable":true},"error":{"type":"object","example":{"redis":{"status":"down","message":"Could not connect","responseTime":3005}},"additionalProperties":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["up","degraded","down"]},"responseTime":{"type":"number","description":"Time the health indicator took to respond, in ms"}},"additionalProperties":true},"nullable":true},"details":{"type":"object","example":{"database":{"status":"up","responseTime":12},"redis":{"status":"down","message":"Could not connect","responseTime":3005}},"additionalProperties":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["up","degraded","down"]},"responseTime":{"type":"number","description":"Time the health indicator took to respond, in ms"}},"additionalProperties":true}}}}}}}},"summary":"Liveness probe","tags":["meta"]}},"/v1/orgs":{"post":{"operationId":"createOrg","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrgDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgResponse"}}}}},"summary":"Create an organization","tags":["management"]}},"/v1/orgs/{orgId}/members":{"post":{"operationId":"addMember","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddMemberDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberResponse"}}}}},"summary":"Add a user to an organization with a role","tags":["management"]}},"/v1/orgs/{orgId}":{"delete":{"operationId":"deleteOrg","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedOrgResponse"}}}}},"summary":"Soft-delete an organization (logical only, data retained, idempotent)","tags":["management"]}},"/v1/orgs/{orgId}/projects":{"post":{"operationId":"createProject","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProjectDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectResponse"}}}}},"summary":"Create a project in an organization","tags":["management"]}},"/v1/orgs/{orgId}/projects/{projectId}/envs":{"post":{"operationId":"createEnvironment","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}},{"name":"projectId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEnvDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnvResponse"}}}}},"summary":"Create an environment in a project","tags":["management"]}},"/v1/orgs/{orgId}/envs/{envId}/apps":{"post":{"operationId":"createApplication","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}},{"name":"envId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAppDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppResponse"}}}}},"summary":"Register an application in an environment","tags":["management"]}},"/v1/orgs/{orgId}/apps/{appId}":{"get":{"operationId":"getApplication","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}},{"name":"appId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppDetailResponse"}}}}},"summary":"Read an application (settings view with breadcrumb names)","tags":["management"]},"patch":{"operationId":"updateApplicationCapabilities","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}},{"name":"appId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAppCapabilitiesDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppDetailResponse"}}}}},"summary":"Set an application's capabilities (owner/admin)","tags":["management"]}},"/v1/orgs/{orgId}/apps/{appId}/keys":{"post":{"operationId":"issueKey","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}},{"name":"appId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssueKeyDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssuedKeyResponse"}}}}},"summary":"Issue a scoped API key (full key shown once)","tags":["management"]},"get":{"operationId":"listKeys","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}},{"name":"appId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeyListResponse"}}}}},"summary":"List API keys (hashes never exposed)","tags":["management"]}},"/v1/orgs/{orgId}/keys/{keyId}/rotate":{"post":{"operationId":"rotateKey","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}},{"name":"keyId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssuedKeyResponse"}}}}},"summary":"Rotate a key (old material dies immediately, new shown once)","tags":["management"]}},"/v1/orgs/{orgId}/keys/{keyId}/revoke":{"post":{"operationId":"revokeKey","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}},{"name":"keyId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyResponse"}}}}},"summary":"Revoke a key (immediate, irreversible)","tags":["management"]}},"/v1/orgs/{orgId}/apps/{appId}/endpoints":{"post":{"operationId":"createEndpoint","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}},{"name":"appId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEndpointDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EndpointResponse"}}}}},"summary":"Register an outbound delivery endpoint for an app","tags":["management"]},"get":{"operationId":"listEndpoints","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}},{"name":"appId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EndpointListResponse"}}}}},"summary":"List an app's delivery endpoints","tags":["management"]}},"/v1/orgs/{orgId}/endpoints/{endpointId}/deactivate":{"post":{"operationId":"deactivateEndpoint","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}},{"name":"endpointId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EndpointResponse"}}}}},"summary":"Deactivate an endpoint (stops new fan-out, keeps history)","tags":["management"]}},"/v1/orgs/{orgId}/endpoints/{endpointId}/activate":{"post":{"operationId":"activateEndpoint","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}},{"name":"endpointId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EndpointResponse"}}}}},"summary":"Reactivate an endpoint","tags":["management"]}},"/v1/orgs/{orgId}/endpoints/{endpointId}":{"delete":{"operationId":"deleteEndpoint","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}},{"name":"endpointId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedEndpointResponse"}}}}},"summary":"Delete an endpoint (blocked with 409 while deliveries reference it)","tags":["management"]}},"/v1/deliveries":{"get":{"operationId":"listDeliveries","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryListResponse"}}}}},"summary":"List own organization's deliveries with filters","tags":["events"]}},"/v1/deliveries/{deliveryId}":{"get":{"operationId":"getDelivery","parameters":[{"name":"deliveryId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryDetailResponse"}}}}},"summary":"Inspect one delivery with every attempt","tags":["events"]}},"/v1/deliveries/{deliveryId}/retry":{"post":{"operationId":"retryDelivery","parameters":[{"name":"deliveryId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryResponse"}}}}},"summary":"Re-queue a failed delivery for another attempt (halt states need resolve)","tags":["events"]}},"/v1/deliveries/{deliveryId}/resolve":{"post":{"operationId":"resolveDelivery","parameters":[{"name":"deliveryId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolveDeliveryDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryResponse"}}}}},"summary":"Resolve a halted delivery by operator attestation","tags":["events"]}},"/v1/events":{"post":{"operationId":"publishEvent","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishEventDto"}}}},"responses":{"202":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishEventResponse"}}}}},"summary":"Durably ingest an event (202 means committed)","tags":["events"]},"get":{"operationId":"listEvents","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventListResponse"}}}}},"summary":"List own organization's events, newest first","tags":["events"]}},"/v1/events/{eventId}":{"get":{"operationId":"getEvent","parameters":[{"name":"eventId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventViewResponse"}}}}},"summary":"Inspect one event with status history (cross-org reads 404 like missing)","tags":["events"]}},"/v1/events/{eventId}/replay":{"post":{"operationId":"replayEvent","parameters":[{"name":"eventId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplayEventDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryResponse"}}}}},"summary":"Replay an event to one endpoint as a new delivery","tags":["events"]}},"/v1/deliveries/{deliveryId}/replay":{"post":{"operationId":"replayDelivery","parameters":[{"name":"deliveryId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryResponse"}}}}},"summary":"Replay a delivery as a new causation-linked delivery","tags":["events"]}},"/v1/webhooks/{appId}/{endpoint}":{"post":{"operationId":"receiveWebhook","parameters":[{"name":"appId","required":true,"in":"path","schema":{"type":"string"}},{"name":"endpoint","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishEventResponse"}}}}},"summary":"Provider webhook intake (signature over exact raw bytes)","tags":["webhooks"]}},"/v1/orgs/{orgId}/apps/{appId}/storage-config":{"post":{"operationId":"createStorageConfig","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}},{"name":"appId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateStorageConfigDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorageConfigResponse"}}}}},"summary":"Configure app storage (validated live before activation)","tags":["management"]},"get":{"operationId":"getStorageConfig","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}},{"name":"appId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorageConfigResponse"}}}}},"summary":"Fetch an app's storage config","tags":["management"]}},"/v1/orgs/{orgId}/apps/{appId}/storage-config/rotate":{"post":{"operationId":"rotateStorageConfig","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}},{"name":"appId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RotateStorageConfigDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorageConfigResponse"}}}}},"summary":"Rotate BYO credentials (revalidated before swap)","tags":["management"]}},"/v1/orgs/{orgId}/apps/{appId}/storage-config/deactivate":{"post":{"operationId":"deactivateStorageConfig","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}},{"name":"appId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorageConfigResponse"}}}}},"summary":"Disconnect storage (in-flight completes, new uploads refuse)","tags":["management"]}},"/v1/orgs/{orgId}/apps/{appId}/storage-config/activate":{"post":{"operationId":"activateStorageConfig","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"type":"string"}},{"name":"appId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorageConfigResponse"}}}}},"summary":"Reconnect storage (backend revalidated)","tags":["management"]}},"/v1/uploads":{"post":{"operationId":"requestUpload","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestUploadDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestUploadResponse"}}}}},"summary":"Mint a presigned upload URL (direct client PUT)","tags":["uploads"]},"get":{"operationId":"listUploads","parameters":[{"name":"limit","required":false,"in":"query","schema":{"example":25}},{"name":"cursor","required":false,"in":"query","schema":{"example":"upl_01J..."}},{"name":"status","required":false,"in":"query","schema":{"example":"completed"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadListResponse"}}}}},"summary":"List uploads with status filter","tags":["uploads"]}},"/v1/uploads/{id}":{"get":{"operationId":"getUpload","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadResponse"}}}}},"summary":"Fetch one upload","tags":["uploads"]}},"/v1/uploads/{id}/complete":{"post":{"operationId":"completeUpload","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadResponse"}}}}},"summary":"Verify completion by HEAD (idempotent)","tags":["uploads"]}},"/v1/uploads/{id}/download":{"get":{"operationId":"downloadUpload","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DownloadResponse"}}}}},"summary":"Mint a presigned download URL (completed only)","tags":["uploads"]}},"/v1/storage/usage":{"get":{"operationId":"getStorageUsage","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageResponse"}}}}},"summary":"Org storage usage per day","tags":["uploads"]}},"/v1/rooms":{"post":{"operationId":"createRoom","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRoomDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoomResponse"}}}}},"summary":"Create a room in the key's application","tags":["rooms"]},"get":{"operationId":"listRooms","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoomListResponse"}}}}},"summary":"List rooms in the key's application","tags":["rooms"]}},"/v1/rooms/{roomId}":{"get":{"operationId":"getRoom","parameters":[{"name":"roomId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoomResponse"}}}}},"summary":"Fetch one room by id","tags":["rooms"]}},"/v1/client-tokens":{"post":{"operationId":"mintClientToken","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MintClientTokenDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientTokenResponse"}}}}},"summary":"Mint a short-lived browser token for one room","tags":["rooms"]}},"/v1/requests":{"post":{"operationId":"submitRequest","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmitRequestDto"}}}},"responses":{"202":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestResponse"}}}}},"summary":"Submit a long-running request (durable accept)","tags":["requests"]},"get":{"operationId":"listRequests","parameters":[{"name":"limit","required":false,"in":"query","schema":{"example":25}},{"name":"cursor","required":false,"in":"query","schema":{"example":"req_01J..."}},{"name":"state","required":false,"in":"query","schema":{"example":"running"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestListResponse"}}}}},"summary":"List requests with state filter","tags":["requests"]}},"/v1/requests/{id}":{"get":{"operationId":"getRequest","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestResponse"}}}}},"summary":"Fetch one request with history","tags":["requests"]}},"/v1/requests/{id}/start":{"post":{"operationId":"startRequest","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaseDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestResponse"}}}}},"summary":"Start a request (sets a lease)","tags":["requests"]}},"/v1/requests/{id}/defer":{"post":{"operationId":"deferRequest","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestResponse"}}}}},"summary":"Park an accepted request as queued","tags":["requests"]}},"/v1/requests/{id}/heartbeat":{"post":{"operationId":"heartbeatRequest","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HeartbeatDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestResponse"}}}}},"summary":"Extend the lease and record progress","tags":["requests"]}},"/v1/requests/{id}/request_review":{"post":{"operationId":"requestReview","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReasonDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestResponse"}}}}},"summary":"Park a running request for human review","tags":["requests"]}},"/v1/requests/{id}/resolve":{"post":{"operationId":"resolveRequest","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolveDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestResponse"}}}}},"summary":"Approve or reject a request awaiting review","tags":["requests"]}},"/v1/requests/{id}/resume":{"post":{"operationId":"resumeRequest","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaseDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestResponse"}}}}},"summary":"Send a reviewed request back to running","tags":["requests"]}},"/v1/requests/{id}/cancel":{"post":{"operationId":"cancelRequest","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReasonDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestResponse"}}}}},"summary":"Cancel a request from any non-terminal state","tags":["requests"]}}},"info":{"title":"ZedBridge API","description":"ZedBridge API service.","version":"1.0.0","contact":{}},"tags":[],"servers":[],"components":{"schemas":{"CreateOrgDto":{"type":"object","properties":{"name":{"type":"string","example":"Acme"},"slug":{"type":"string","example":"acme"}},"required":["name"]},"OrgResponse":{"type":"object","properties":{"id":{"type":"string","example":"org_01J..."},"name":{"type":"string","example":"Acme"},"slug":{"type":"string","example":"acme"}},"required":["id","name","slug"]},"AddMemberDto":{"type":"object","properties":{"userId":{"type":"string","example":"user_01J..."},"role":{"type":"string","example":"admin","enum":["owner","admin","member"]}},"required":["userId","role"]},"MemberResponse":{"type":"object","properties":{"id":{"type":"string","example":"mbr_org_01J..._user_01J..."},"role":{"type":"string","example":"admin"}},"required":["id","role"]},"DeletedOrgResponse":{"type":"object","properties":{"id":{"type":"string","example":"org_01J..."},"name":{"type":"string","example":"Acme"},"slug":{"type":"string","example":"acme"},"deletedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","name","slug","deletedAt"]},"CreateProjectDto":{"type":"object","properties":{"name":{"type":"string","example":"main"}},"required":["name"]},"ProjectResponse":{"type":"object","properties":{"id":{"type":"string","example":"prj_01J..."},"organizationId":{"type":"string","example":"org_01J..."},"name":{"type":"string","example":"main"}},"required":["id","organizationId","name"]},"CreateEnvDto":{"type":"object","properties":{"name":{"type":"string","example":"prod"},"slug":{"type":"string","example":"prod"}},"required":["name"]},"EnvResponse":{"type":"object","properties":{"id":{"type":"string","example":"env_01J..."},"projectId":{"type":"string","example":"prj_01J..."},"name":{"type":"string","example":"prod"},"slug":{"type":"string","example":"prod"}},"required":["id","projectId","name","slug"]},"CreateAppDto":{"type":"object","properties":{"name":{"type":"string","example":"web"}},"required":["name"]},"AppResponse":{"type":"object","properties":{"id":{"type":"string","example":"app_01J..."},"name":{"type":"string","example":"web"},"organizationId":{"type":"string","example":"org_01J..."},"projectId":{"type":"string","example":"prj_01J..."},"environmentId":{"type":"string","example":"env_01J..."},"applicationId":{"type":"string","example":"app_01J..."},"capabilities":{"example":["events","rooms","storage","async"],"type":"array","items":{"type":"string"}}},"required":["id","name","organizationId","projectId","environmentId","applicationId","capabilities"]},"AppDetailResponse":{"type":"object","properties":{"id":{"type":"string","example":"app_01J..."},"name":{"type":"string","example":"web"},"organizationId":{"type":"string","example":"org_01J..."},"projectId":{"type":"string","example":"prj_01J..."},"environmentId":{"type":"string","example":"env_01J..."},"applicationId":{"type":"string","example":"app_01J..."},"capabilities":{"example":["events","rooms","storage","async"],"type":"array","items":{"type":"string"}},"projectName":{"type":"string","example":"main"},"environmentName":{"type":"string","example":"prod"}},"required":["id","name","organizationId","projectId","environmentId","applicationId","capabilities","projectName","environmentName"]},"UpdateAppCapabilitiesDto":{"type":"object","properties":{"capabilities":{"example":["events","rooms"],"type":"array","items":{"type":"string"}}},"required":["capabilities"]},"IssueKeyDto":{"type":"object","properties":{"name":{"type":"string","example":"default"},"scopes":{"example":["events:write","events:read"],"type":"array","items":{"type":"string"}},"expiresAt":{"type":"string","example":"2027-01-01T00:00:00.000Z"},"rateLimitPerMinute":{"type":"number","example":600}},"required":["name","scopes"]},"ApiKeyResponse":{"type":"object","properties":{"id":{"type":"string","example":"key_01J..."},"organizationId":{"type":"string","example":"org_01J..."},"projectId":{"type":"string","example":"prj_01J..."},"environmentId":{"type":"string","example":"env_01J..."},"applicationId":{"type":"string","example":"app_01J..."},"name":{"type":"string","example":"default"},"keyPrefix":{"type":"string","example":"zbk_ab12cd34"},"scopes":{"example":["events:write"],"type":"array","items":{"type":"string"}},"expiresAt":{"type":"string","format":"date-time","nullable":true},"revokedAt":{"type":"string","format":"date-time","nullable":true},"lastUsedAt":{"type":"string","format":"date-time","nullable":true},"requestCount":{"type":"number","example":0},"rateLimitPerMinute":{"type":"object","nullable":true,"example":600},"createdAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","projectId","environmentId","applicationId","name","keyPrefix","scopes","expiresAt","revokedAt","lastUsedAt","requestCount","rateLimitPerMinute","createdAt"]},"IssuedKeyResponse":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/ApiKeyResponse"},"key":{"type":"string","example":"zbk_..."}},"required":["record","key"]},"KeyListResponse":{"type":"object","properties":{"keys":{"type":"array","items":{"$ref":"#/components/schemas/ApiKeyResponse"}}},"required":["keys"]},"CreateEndpointDto":{"type":"object","properties":{"name":{"type":"string","example":"billing"},"url":{"type":"string","example":"https://example.com/hooks/zb"},"idempotent":{"type":"boolean","example":true},"timeoutMs":{"type":"number","example":10000},"maxAttempts":{"type":"number","example":25}},"required":["name","url"]},"EndpointResponse":{"type":"object","properties":{"id":{"type":"string","example":"endpoint_01J..."},"applicationId":{"type":"string","example":"app_01J..."},"name":{"type":"string","example":"billing"},"url":{"type":"string","example":"https://example.com/hooks/zb"},"active":{"type":"boolean","example":true},"idempotent":{"type":"boolean","example":true},"timeoutMs":{"type":"number","example":10000},"maxAttempts":{"type":"number","example":25},"signingVersion":{"type":"number","example":1}},"required":["id","applicationId","name","url","active","idempotent","timeoutMs","maxAttempts","signingVersion"]},"EndpointListResponse":{"type":"object","properties":{"endpoints":{"type":"array","items":{"$ref":"#/components/schemas/EndpointResponse"}}},"required":["endpoints"]},"DeletedEndpointResponse":{"type":"object","properties":{"deleted":{"type":"boolean","example":true}},"required":["deleted"]},"DeliveryResponse":{"type":"object","properties":{"id":{"type":"string","example":"dlv_01J..."},"eventId":{"type":"string","example":"evt_01J..."},"endpointId":{"type":"string","example":"endpoint_01J..."},"replayOf":{"type":"object","nullable":true,"example":"dlv_01J..."},"status":{"type":"string","example":"delivered"},"attemptCount":{"type":"number","example":1},"nextRetryAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"actions":{"example":["replay"],"type":"array","items":{"type":"string"}}},"required":["id","eventId","endpointId","replayOf","status","attemptCount","nextRetryAt","createdAt","updatedAt","actions"]},"DeliveryListResponse":{"type":"object","properties":{"deliveries":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryResponse"}},"nextCursor":{"type":"object","nullable":true,"example":"dlv_01J..."}},"required":["deliveries","nextCursor"]},"AttemptResponse":{"type":"object","properties":{"id":{"type":"number","example":1},"deliveryId":{"type":"string","example":"dlv_01J..."},"attemptNo":{"type":"number","example":1},"startedAt":{"type":"string","format":"date-time"},"finishedAt":{"type":"string","format":"date-time","nullable":true},"outcome":{"type":"object","nullable":true,"example":"delivered"},"httpStatus":{"type":"object","nullable":true,"example":200},"errorCode":{"type":"object","nullable":true,"example":"timeout"},"errorMessage":{"type":"object","nullable":true,"example":"exceeded 10000ms"},"durationMs":{"type":"object","nullable":true,"example":12}},"required":["id","deliveryId","attemptNo","startedAt","finishedAt","outcome","httpStatus","errorCode","errorMessage","durationMs"]},"DeliveryDetailResponse":{"type":"object","properties":{"delivery":{"$ref":"#/components/schemas/DeliveryResponse"},"attempts":{"type":"array","items":{"$ref":"#/components/schemas/AttemptResponse"}}},"required":["delivery","attempts"]},"ResolveDeliveryDto":{"type":"object","properties":{"decision":{"type":"string","example":"safe_to_retry"},"reason":{"type":"string","example":"checked Stripe: payment pi_1 never executed"}},"required":["decision","reason"]},"PublishEventDto":{"type":"object","properties":{"type":{"type":"string","example":"chat.sent"},"schema_version":{"type":"number","example":1},"data":{"type":"object","example":{"text":"hello"}},"idempotency_key":{"type":"string","example":"order-123"},"correlation_id":{"type":"string","example":"corr_01J..."},"causation_id":{"type":"string","example":"evt_01J..."}},"required":["type"]},"PublishEventResponse":{"type":"object","properties":{"event_id":{"type":"string","example":"evt_01J..."},"deduplicated":{"type":"boolean","example":false},"status":{"type":"string","example":"normalized"}},"required":["event_id","deduplicated","status"]},"EventSourceDto":{"type":"object","properties":{"kind":{"type":"string","example":"api_publish"},"provider":{"type":"string","example":"stripe"},"endpoint":{"type":"string","example":"payments"}},"required":["kind"]},"EventPayloadDto":{"type":"object","properties":{"storage":{"type":"string","example":"inline"},"content_type":{"type":"string","example":"application/json"},"byte_len":{"type":"number","example":42},"sha256_hex":{"type":"string","example":"9f86..."},"ref":{"type":"string","example":"s3://..."}},"required":["storage","content_type","byte_len","sha256_hex"]},"EventErrorDto":{"type":"object","properties":{"code":{"type":"string","example":"not_json"},"message":{"type":"string","example":"body is not valid JSON"}},"required":["code","message"]},"EventStatusTransitionDto":{"type":"object","properties":{"event_id":{"type":"string","example":"evt_01J..."},"from_status":{"type":"object","nullable":true,"example":"accepted"},"to_status":{"type":"string","example":"normalized"},"reason":{"type":"object","example":"publish normalized"},"at":{"type":"string","example":"2026-01-01T00:00:00.000Z"}},"required":["event_id","from_status","to_status","reason","at"]},"EventViewResponse":{"type":"object","properties":{"event_id":{"type":"string","example":"evt_01J..."},"org_id":{"type":"string","example":"org_01J..."},"project_id":{"type":"string","example":"prj_01J..."},"env_id":{"type":"string","example":"env_01J..."},"app_id":{"type":"object","nullable":true,"example":"app_01J..."},"source":{"$ref":"#/components/schemas/EventSourceDto"},"type":{"type":"string","example":"chat.sent"},"schema_version":{"type":"number","example":1},"received_at":{"type":"string","example":"2026-01-01T00:00:00.000Z"},"correlation_id":{"type":"string","example":"corr_01J..."},"causation_id":{"type":"object","nullable":true,"example":"evt_01J..."},"idempotency_key":{"type":"object","nullable":true,"example":"order-123"},"payload":{"$ref":"#/components/schemas/EventPayloadDto"},"status":{"type":"string","example":"normalized"},"normalized":{"type":"object","nullable":true},"error":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/EventErrorDto"}]},"created_by_key_id":{"type":"object","nullable":true,"example":"key_01J..."},"raw":{"type":"string","example":"{\"type\":\"chat.sent\"}"},"history":{"type":"array","items":{"$ref":"#/components/schemas/EventStatusTransitionDto"}}},"required":["event_id","org_id","project_id","env_id","app_id","source","type","schema_version","received_at","correlation_id","causation_id","idempotency_key","payload","status","error","created_by_key_id","history"]},"EventListResponse":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/EventViewResponse"}},"nextCursor":{"type":"object","nullable":true,"example":"evt_01J..."}},"required":["events","nextCursor"]},"ReplayEventDto":{"type":"object","properties":{"endpoint_id":{"type":"string","example":"endpoint_01J..."}},"required":["endpoint_id"]},"CreateStorageConfigDto":{"type":"object","properties":{"provider":{"type":"string","enum":["byo","managed"],"example":"byo"},"endpoint":{"type":"string","example":"https://s3.fr-par.scw.cloud"},"region":{"type":"string","example":"fr-par"},"bucket":{"type":"string","example":"customer-uploads"},"path_style":{"type":"boolean","example":false},"access_key_id":{"type":"string","example":"SCW..."},"secret_access_key":{"type":"string","example":"..."}},"required":["provider"]},"StorageConfigResponse":{"type":"object","properties":{"id":{"type":"string","example":"scfg_01J..."},"org_id":{"type":"string","example":"org_01J..."},"project_id":{"type":"string","example":"prj_01J..."},"env_id":{"type":"string","example":"env_01J..."},"app_id":{"type":"object","nullable":true,"example":"app_01J..."},"provider":{"type":"string","enum":["byo","managed"],"example":"byo"},"endpoint":{"type":"object","nullable":true,"example":"https://s3.fr-par.scw.cloud"},"region":{"type":"string","example":"fr-par"},"bucket":{"type":"string","example":"customer-uploads"},"path_style":{"type":"boolean","example":false},"access_key_id":{"type":"object","nullable":true,"example":"SCW..."},"status":{"type":"string","enum":["active","inactive"],"example":"active"},"last_validated_at":{"type":"string","nullable":true,"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","org_id","project_id","env_id","app_id","provider","endpoint","region","bucket","path_style","access_key_id","status","last_validated_at","created_at","updated_at"]},"RotateStorageConfigDto":{"type":"object","properties":{"access_key_id":{"type":"string","example":"SCW..."},"secret_access_key":{"type":"string","example":"..."}},"required":["access_key_id","secret_access_key"]},"RequestUploadDto":{"type":"object","properties":{"purpose":{"type":"string","enum":["media","raw"],"example":"media"},"content_type":{"type":"string","example":"image/png"},"size_bytes":{"type":"number","example":1024},"sha256_hex":{"type":"string","example":"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"}},"required":["purpose","content_type","size_bytes"]},"UploadErrorResponse":{"type":"object","properties":{"code":{"type":"string","example":"missing_object"},"message":{"type":"string","example":"no object at the upload key"}},"required":["code","message"]},"UploadResponse":{"type":"object","properties":{"id":{"type":"string","example":"upl_01J..."},"org_id":{"type":"string","example":"org_01J..."},"app_id":{"type":"object","nullable":true,"example":"app_01J..."},"purpose":{"type":"string","enum":["media","raw"],"example":"media"},"key":{"type":"string","example":"org_01J.../app_01J.../media/upl_01J..."},"content_type":{"type":"string","example":"image/png"},"size_bytes":{"type":"number","example":1024},"sha256_hex":{"type":"object","nullable":true},"status":{"type":"string","enum":["pending","completed","failed","expired"]},"error":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/UploadErrorResponse"}]},"expires_at":{"type":"string","format":"date-time"},"completed_at":{"type":"string","nullable":true,"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","org_id","app_id","purpose","key","content_type","size_bytes","sha256_hex","status","error","expires_at","completed_at","created_at","updated_at"]},"RequestUploadResponse":{"type":"object","properties":{"upload":{"$ref":"#/components/schemas/UploadResponse"},"upload_url":{"type":"string","example":"https://bucket.s3.fr-par.scw.cloud/org/app/media/id?..."}},"required":["upload","upload_url"]},"UploadListResponse":{"type":"object","properties":{"uploads":{"type":"array","items":{"$ref":"#/components/schemas/UploadResponse"}},"next_cursor":{"type":"object","nullable":true,"example":"upl_01J..."}},"required":["uploads","next_cursor"]},"DownloadResponse":{"type":"object","properties":{"url":{"type":"string","example":"https://bucket.s3.fr-par.scw.cloud/org/app/media/id?..."},"expires_at":{"type":"string","format":"date-time"}},"required":["url","expires_at"]},"UsageDayResponse":{"type":"object","properties":{"day":{"type":"string","example":"2026-10-25"},"bytes":{"type":"number","example":1048576},"objects":{"type":"number","example":12}},"required":["day","bytes","objects"]},"UsageResponse":{"type":"object","properties":{"usage":{"type":"array","items":{"$ref":"#/components/schemas/UsageDayResponse"}}},"required":["usage"]},"CreateRoomDto":{"type":"object","properties":{"name":{"type":"string","example":"support"}},"required":["name"]},"RoomResponse":{"type":"object","properties":{"id":{"type":"string","example":"room_01J..."},"name":{"type":"string","example":"support"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","name","createdAt"]},"RoomListResponse":{"type":"object","properties":{"rooms":{"type":"array","items":{"$ref":"#/components/schemas/RoomResponse"}}},"required":["rooms"]},"MintClientTokenDto":{"type":"object","properties":{"room_id":{"type":"string","example":"room_01J..."},"capabilities":{"example":["subscribe","publish"],"type":"array","items":{"type":"string"}},"ttl_seconds":{"type":"number","example":600},"user_id":{"type":"string","example":"user-42"}},"required":["room_id","capabilities"]},"ClientTokenResponse":{"type":"object","properties":{"token":{"type":"string","example":"eyJ..."},"expires_at":{"type":"string","example":"2026-01-01T00:10:00.000Z"}},"required":["token","expires_at"]},"SubmitRequestDto":{"type":"object","properties":{"input":{"type":"object","example":{"prompt":"moderate this post","post_id":"p1"}},"idempotency_key":{"type":"string","example":"job-123"}},"required":["input"]},"RequestReviewResponse":{"type":"object","properties":{"requested_at":{"type":"string","format":"date-time"},"requested_by":{"type":"string","example":"key_01J..."},"resolved_at":{"type":"string","nullable":true,"format":"date-time"},"resolved_by":{"type":"object","nullable":true,"example":"key_01J..."},"decision":{"type":"string","nullable":true,"enum":["approve","reject"]},"note":{"type":"object","nullable":true,"example":"looks good"}},"required":["requested_at","requested_by","resolved_at","resolved_by","decision","note"]},"RequestHistoryResponse":{"type":"object","properties":{"request_id":{"type":"string","example":"req_01J..."},"from_status":{"type":"object","nullable":true,"example":null},"to_status":{"type":"string","example":"accepted"},"reason":{"type":"object","nullable":true,"example":"submitted"},"actor":{"type":"object","nullable":true,"example":"key_01J..."},"at":{"type":"string","format":"date-time"}},"required":["request_id","from_status","to_status","reason","actor","at"]},"RequestResponse":{"type":"object","properties":{"id":{"type":"string","example":"req_01J..."},"org_id":{"type":"string","example":"org_01J..."},"project_id":{"type":"string","example":"prj_01J..."},"env_id":{"type":"string","example":"env_01J..."},"app_id":{"type":"object","nullable":true,"example":"app_01J..."},"idempotency_key":{"type":"object","nullable":true,"example":"job-123"},"status":{"type":"string","example":"running"},"input":{"type":"object","example":{"prompt":"moderate this post"}},"result":{"type":"object","nullable":true,"example":{"verdict":"clean"}},"error":{"type":"object","nullable":true,"example":{"code":"timeout","message":"lease expired"}},"progress":{"type":"object","nullable":true,"example":{"step":2,"of":5}},"lease_expires_at":{"type":"string","nullable":true,"format":"date-time"},"review":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/RequestReviewResponse"}]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"history":{"type":"array","items":{"$ref":"#/components/schemas/RequestHistoryResponse"}}},"required":["id","org_id","project_id","env_id","app_id","idempotency_key","status","input","result","error","progress","lease_expires_at","review","created_at","updated_at","history"]},"RequestListResponse":{"type":"object","properties":{"requests":{"type":"array","items":{"$ref":"#/components/schemas/RequestResponse"}},"next_cursor":{"type":"object","nullable":true,"example":"req_01J..."}},"required":["requests","next_cursor"]},"LeaseDto":{"type":"object","properties":{"lease_seconds":{"type":"number","example":300}}},"HeartbeatDto":{"type":"object","properties":{"lease_seconds":{"type":"number","example":300},"progress":{"type":"object","example":{"step":2,"of":5}}}},"ReasonDto":{"type":"object","properties":{"reason":{"type":"string","example":"needs a human decision"}}},"ResolveDto":{"type":"object","properties":{"decision":{"type":"string","enum":["approve","reject"],"example":"approve"},"note":{"type":"string","example":"looks good"},"result":{"type":"object","example":{"verdict":"clean"}}},"required":["decision"]}}}}