{"openapi":"3.1.0","info":{"title":"swarmvia Control API","version":"1.0.0","description":"Give agents access to your data sources so they work from real tables and columns for more accurate results, without sharing the database password. Manage sources, access keys, Capacity budgets, webhooks, and metrics. AI assistants normally use the MCP server at https:\/\/swarmvia.com\/mcp instead."},"servers":[{"url":"https:\/\/swarmvia.com"}],"tags":[{"name":"identity","description":"Token identity and granted abilities"},{"name":"budgets","description":"Capacity budgets shared across sources"},{"name":"sources","description":"Sources and their access keys"},{"name":"metrics","description":"Source admit, queue, and reject series"},{"name":"webhooks","description":"Team webhook destinations for async job callbacks"},{"name":"sessions","description":"Agent sessions that group the keys a token mints by task"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Organization Control API token from Settings \u2192 API tokens."}},"schemas":{"User":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"email":{"type":"string","format":"email"}},"required":["id","name","email"]},"Team":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]},"Budget":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"source_ids":{"type":"array","items":{"type":"integer"}},"origin_max_concurrent":{"type":"integer","nullable":true},"unallocated":{"type":"integer"}},"required":["id","name","source_ids","origin_max_concurrent","unallocated"]},"SourceBudget":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"reserved_concurrent":{"type":"integer"}},"required":["id","name","reserved_concurrent"]},"Source":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"subdomain":{"type":"string","description":"Source label used in the endpoint (*.swarmvia.cloud) and in API paths."},"backend":{"type":"string","enum":["http","postgres","mysql"]},"max_concurrent":{"type":"integer"},"require_key":{"type":"boolean"},"has_credential":{"type":"boolean"},"budget":{"oneOf":[{"$ref":"#\/components\/schemas\/SourceBudget"},{"type":"null"}]}},"required":["id","name","subdomain","backend","max_concurrent","require_key","has_credential"]},"EnsureDatabaseSourceRequest":{"type":"object","additionalProperties":false,"properties":{"db_host":{"type":"string","description":"Public hostname. Not localhost."},"db_port":{"type":"integer","nullable":true},"db_name":{"type":"string"},"db_sslmode":{"type":"string","enum":["verify-full","require"],"nullable":true},"name":{"type":"string","nullable":true}},"required":["db_host","db_name"]},"AuthHandoffRequest":{"type":"object","additionalProperties":false,"properties":{"auth_method":{"type":"string","enum":["bearer_static","api_key","basic","postgres_role"]},"credential_id":{"type":"integer","nullable":true},"credential_name":{"type":"string","nullable":true}}},"AuthHandoff":{"type":"object","properties":{"source":{"type":"object"},"source_created":{"type":"boolean"},"custody_flipped":{"type":"boolean"},"already_attached":{"type":"boolean"},"auth_method":{"type":"string"},"intake_url":{"type":"string","nullable":true},"intake_token":{"type":"string","nullable":true},"dashboard_url":{"type":"string"},"expires_at":{"type":"string","format":"date-time","nullable":true},"required_fields":{"type":"array","items":{"type":"string"}},"auth_posture":{"type":"string"},"next":{"type":"string"}},"required":["source","already_attached","auth_method","dashboard_url"]},"EnsureHttpSourceRequest":{"type":"object","additionalProperties":false,"properties":{"origin":{"type":"string","description":"The https origin your client already calls."},"name":{"type":"string","nullable":true,"description":"Source name. Omit to derive it from the host."}},"required":["origin"]},"AccessKey":{"type":"object","properties":{"id":{"type":"integer"},"label":{"type":"string"},"last_four":{"type":"string"},"access":{"type":"string","enum":["read","write"]},"allowed_methods":{"type":"array","items":{"type":"string"},"nullable":true,"description":"Methods a read key admits. Null on a write key, which admits every method."},"read_paths":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"description":"Path prefixes per extra read method, for example { \"POST\": [\"\/services\/rest\/query\/\"] }. Present only when the source scopes a read method to paths."},"allow":{"type":"array","items":{"type":"string"},"nullable":true,"description":"The calls the key is narrowed to within the source's policy, one per entry: the methods, then a path, where * is one path segment and a trailing ** is everything below (for example \"GET HEAD OPTIONS \/**\"). The edge admits a call only when this list and the source's policy both allow it. Null when the key has whatever the policy allows."},"can_call":{"type":"array","items":{"type":"string"},"nullable":true,"description":"Every call the key can make on its source right now, one rule per entry (the methods, then a path): the source's policy plus the rules of the key's owner and their groups, limited by the API token's own rules. Null on a database or MCP source."},"expires_at":{"type":"string","format":"date-time","nullable":true,"description":"When the key stops working. Always set on access tokens; null only on an old nb_live_ key, which stopped working on November 7, 2026."},"revoked_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time","nullable":true},"session_id":{"type":"string","nullable":true,"description":"The agent session the key belongs to (ses_\u2026), or null."},"key":{"type":"string","description":"The access token (sv_at_ followed by a signed JWT), returned once at creation. Send it in X-Swarmvia-Key.","examples":["sv_at_eyJhbGciOiJFZERTQSIs\u2026"]}},"required":["id","label","last_four","access","allowed_methods"]},"AccessKeyCreateRequest":{"type":"object","properties":{"label":{"type":"string","maxLength":60},"expires_preset":{"type":"string","enum":["1h","24h","7d"],"default":"24h","description":"How long the key lasts. Every key expires; 7d is the longest. \"none\" is refused with 422."},"access":{"type":"string","enum":["read","write"],"description":"Omit for full write access (default)."},"for_me":{"type":"boolean","default":false,"description":"Sign the key for the user who owns the Control API token, so it acts for them. Required on a source whose credential is per member. Omit for a machine key."},"session_id":{"type":"string","maxLength":40,"description":"One of this token's open agent sessions (ses_\u2026). Every call the key makes is logged against it. A session that has ended or was revoked is refused with 409."}}},"Session":{"type":"object","properties":{"id":{"type":"string","description":"ses_ followed by 24 characters. Every key minted in the session carries it."},"purpose":{"type":"string","nullable":true},"implicit":{"type":"boolean","description":"Started for an agent that named no session; it has no purpose."},"status":{"type":"string","enum":["open","ended","revoked"]},"end_reason":{"type":"string","enum":["ended","idle","capped","revoked"],"nullable":true},"issue":{"type":"string","nullable":true,"description":"The work-tracking issue the session is for, for example API-12."},"started_at":{"type":"string","format":"date-time"},"last_activity_at":{"type":"string","format":"date-time"},"ended_at":{"type":"string","format":"date-time","nullable":true}},"required":["id","purpose","implicit","status","started_at","last_activity_at"]},"ReportedActivity":{"type":"object","properties":{"system":{"type":"string","description":"Where the work happened, such as GitHub."},"action":{"type":"string","description":"What was done, in one line."},"outcome":{"type":"string","enum":["done","failed","skipped"]},"url":{"type":["string","null"],"format":"uri"},"occurred_at":{"type":"string","format":"date-time"}},"required":["system","action","outcome","url","occurred_at"]},"ReportedActivityCreateRequest":{"type":"object","properties":{"system":{"type":"string","maxLength":60,"description":"Where the work happened, such as \"GitHub\"."},"action":{"type":"string","maxLength":300,"description":"What was done, in one line a teammate would understand."},"outcome":{"type":"string","enum":["done","failed","skipped"],"default":"done"},"url":{"type":"string","format":"uri","maxLength":500,"description":"An http(s) link to what was done."},"occurred_at":{"type":"string","format":"date-time","description":"When it happened. Defaults to now; kept within the session."}},"required":["system","action"]},"SessionCreateRequest":{"type":"object","properties":{"purpose":{"type":"string","maxLength":500,"description":"What the run is for, in one sentence a teammate would understand."},"issue":{"type":"string","maxLength":24,"description":"A work-tracking issue of this organization, for example API-12."}},"required":["purpose"]},"MetricsRange":{"type":"object","properties":{"from":{"type":"string","format":"date-time","nullable":true},"to":{"type":"string","format":"date-time","nullable":true},"retention_days":{"type":"integer"},"clamped":{"type":"boolean"}},"required":["from","to","retention_days","clamped"]},"SourceMetricsSummary":{"type":"object","properties":{"source_id":{"type":"integer"},"requests":{"type":"integer"},"admitted":{"type":"integer"},"admit_rate":{"type":"number"},"queued_count":{"type":"integer"},"queued_pct":{"type":"number"},"range":{"$ref":"#\/components\/schemas\/MetricsRange"}},"required":["source_id","requests","admitted","admit_rate","queued_count","queued_pct","range"]},"WebhookEndpoint":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"url":{"type":"string"},"disabled":{"type":"boolean"},"source_ids":{"type":"array","items":{"type":"integer"}},"previous_secret_expires_at":{"type":"string","format":"date-time","nullable":true,"description":"Until then the key a rotation replaced still signs deliveries, alongside the current one. Null when no old key is valid."},"signing_secret":{"type":"string","description":"Plaintext signing secret returned once at creation."},"async_enabled_on_source_ids":{"type":"array","items":{"type":"integer"},"description":"Sources that were switched to async on this create."}},"required":["id","name","url","disabled","source_ids"]},"StoreWebhookEndpointRequest":{"type":"object","additionalProperties":false,"properties":{"name":{"type":"string","maxLength":60},"url":{"type":"string","maxLength":500,"description":"https callback URL. No loopback or private hosts."},"description":{"type":"string","maxLength":200,"nullable":true},"source_ids":{"type":"array","items":{"type":"integer"}}},"required":["name","url"]},"SyncSourceWebhooksRequest":{"type":"object","additionalProperties":false,"properties":{"webhook_endpoint_ids":{"type":"array","items":{"type":"integer"},"description":"Destination ids to attach. Replaces the current set. Empty detaches all."}},"required":["webhook_endpoint_ids"]},"SourceWebhooks":{"type":"object","properties":{"source_id":{"type":"integer"},"subdomain":{"type":"string"},"webhook_endpoint_ids":{"type":"array","items":{"type":"integer"}},"async_enabled":{"type":"boolean"},"async_on_queue":{"type":"boolean"}},"required":["source_id","subdomain","webhook_endpoint_ids","async_enabled","async_on_queue"]},"SourcePolicy":{"type":"object","description":"An API source's policy. Every rule is text: methods, then a path, where * is one path segment and a trailing ** is everything below.","properties":{"source_id":{"type":"integer"},"subdomain":{"type":"string"},"has_policy":{"type":"boolean","description":"False on a source that predates policies and accepts every call."},"rules":{"type":"array","items":{"type":"string"},"description":"The default source policy: the calls every caller gets."},"can_call":{"type":"array","items":{"type":"string"},"description":"What a key minted with this API token can call."},"grants":{"type":"array","items":{"$ref":"#\/components\/schemas\/SourcePolicyRuleSet"},"description":"Extra calls for a group's members. Only with sources:write."},"limits":{"type":"array","items":{"$ref":"#\/components\/schemas\/SourcePolicyRuleSet"},"description":"API tokens and connectors held to fewer calls. Read-only here. Only with sources:write."},"principals":{"type":"object","description":"Groups that can be given rules. Only with sources:write.","properties":{"groups":{"type":"array","items":{"$ref":"#\/components\/schemas\/SourcePolicyPrincipal"}}}}},"required":["source_id","subdomain","has_policy","rules","can_call"]},"SourcePolicyRuleSet":{"type":"object","properties":{"principal":{"type":"string","example":"group:12"},"name":{"type":"string"},"rules":{"type":"array","items":{"type":"string"}}},"required":["principal","name","rules"]},"SourcePolicyPrincipal":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}},"required":["id","name"]},"SourcePolicyUpdateRequest":{"type":"object","properties":{"mode":{"type":"string","enum":["enforce"],"deprecated":true,"description":"A source policy is always enforced. Accepted for older clients; leave it out."},"rules":{"type":"array","maxItems":64,"items":{"type":"string","example":"GET HEAD OPTIONS \/**"},"description":"The whole default source policy. Replaces the current one."}},"required":["rules"]},"SourcePolicyGrantRequest":{"type":"object","properties":{"rules":{"type":"array","minItems":1,"maxItems":64,"items":{"type":"string","example":"POST \/orders\/*\/refund"},"description":"The principal's whole list of extra calls."}},"required":["rules"]},"Error":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}},"security":[{"bearerAuth":[]}],"paths":{"\/api\/v1\/me":{"get":{"operationId":"getCurrentIdentity","summary":"Current user, team, and token abilities","description":"Returns the authenticated user, their organization, and Sanctum token abilities.","tags":["identity"],"responses":{"200":{"description":"Identity payload","content":{"application\/json":{"schema":{"type":"object","properties":{"user":{"$ref":"#\/components\/schemas\/User"},"team":{"$ref":"#\/components\/schemas\/Team"},"abilities":{"type":"array","items":{"type":"string"}}},"required":["user","team","abilities"]}}}},"401":{"description":"Missing or invalid token","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/api\/v1\/budgets":{"get":{"operationId":"listBudgets","summary":"List Capacity budgets","tags":["budgets"],"security":[{"bearerAuth":["budgets:read"]}],"responses":{"200":{"description":"Budget collection","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Budget"}}},"required":["data"]}}}}}}},"\/api\/v1\/budgets\/{budget}":{"get":{"operationId":"getBudget","summary":"Show a Capacity budget","tags":["budgets"],"parameters":[{"name":"budget","in":"path","required":true,"schema":{"type":"integer"}}],"security":[{"bearerAuth":["budgets:read"]}],"responses":{"200":{"description":"Budget","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/Budget"}},"required":["data"]}}}},"404":{"description":"Budget not found"}}}},"\/api\/v1\/budgets\/{budget}\/sources":{"get":{"operationId":"listBudgetSources","summary":"List sources on a budget","tags":["budgets","sources"],"parameters":[{"name":"budget","in":"path","required":true,"schema":{"type":"integer"}}],"security":[{"bearerAuth":["sources:read"]}],"responses":{"200":{"description":"Source collection","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Source"}}},"required":["data"]}}}}}}},"\/api\/v1\/sources":{"get":{"operationId":"listSources","summary":"List sources granted to this token","tags":["sources"],"security":[{"bearerAuth":["sources:read"]}],"responses":{"200":{"description":"Source collection","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Source"}}},"required":["data"]}}}}}},"post":{"operationId":"createSource","summary":"Create an API source for an https origin","tags":["sources"],"security":[{"bearerAuth":["sources:write"]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/EnsureHttpSourceRequest"}}}},"responses":{"201":{"description":"Created source","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/Source"}},"required":["data"]}}}},"200":{"description":"Existing source reused","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/Source"}},"required":["data"]}}}},"403":{"description":"Token or actor cannot create sources"},"422":{"description":"Invalid origin or name taken"}}}},"\/api\/v1\/sources\/database":{"post":{"operationId":"createDatabaseSource","summary":"Create a database source for a public Postgres host","tags":["sources"],"security":[{"bearerAuth":["sources:write"]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/EnsureDatabaseSourceRequest"}}}},"responses":{"201":{"description":"Created database source"},"200":{"description":"Existing database source reused"},"422":{"description":"Host refused or invalid"}}}},"\/api\/v1\/sources\/{source}\/auth-handoff":{"post":{"operationId":"createSourceAuthHandoff","summary":"Flip a source to managed auth and mint a one-shot intake","tags":["sources"],"parameters":[{"name":"source","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":["sources:write"]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/AuthHandoffRequest"}}}},"responses":{"200":{"description":"Auth handoff","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/AuthHandoff"}}}}}}},"\/api\/v1\/sources\/{source}\/credential":{"put":{"operationId":"putSourceCredential","summary":"Attach a vault credential from an existing row or inline secret","tags":["sources"],"parameters":[{"name":"source","in":"path","required":true,"schema":{"type":"string"}}],"security":[{"bearerAuth":["sources:write"]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Credential attached"},"422":{"description":"No secret fields or method mismatch"}}}},"\/api\/v1\/sources\/{source}":{"get":{"operationId":"getSource","summary":"Show a source by subdomain","tags":["sources"],"parameters":[{"name":"source","in":"path","required":true,"schema":{"type":"string"},"description":"Source subdomain label."}],"security":[{"bearerAuth":["sources:read"]}],"responses":{"200":{"description":"Source","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/Source"}},"required":["data"]}}}},"404":{"description":"Source not found"}}}},"\/api\/v1\/sources\/{source}\/keys":{"post":{"operationId":"createAccessKey","summary":"Mint an access key","description":"Mints a short-lived access token (sv_at_\u2026) for the source. It expires after expires_preset (default 24h, at most 7d). Cache it and mint a new one once about 80% of its lifetime has passed.","tags":["sources"],"parameters":[{"name":"source","in":"path","required":true,"schema":{"type":"string"},"description":"Source subdomain label."}],"security":[{"bearerAuth":["keys:write"]}],"requestBody":{"required":false,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/AccessKeyCreateRequest"}}}},"responses":{"201":{"description":"Created access key","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/AccessKey"}},"required":["data"]}}}},"409":{"description":"The session_id names a session that has ended or was revoked, or is not this token's","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"Validation error, for example an expires_preset outside 1h, 24h, and 7d"}}}},"\/api\/v1\/sources\/{source}\/keys\/{apiKey}":{"delete":{"operationId":"revokeAccessKey","summary":"Revoke an access key","description":"Stops the key at once. Keys expire on their own, so revoke one only if it leaked.","tags":["sources"],"parameters":[{"name":"source","in":"path","required":true,"schema":{"type":"string"},"description":"Source subdomain label."},{"name":"apiKey","in":"path","required":true,"schema":{"type":"integer"}}],"security":[{"bearerAuth":["keys:write"]}],"responses":{"200":{"description":"Revoked access key","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/AccessKey"}},"required":["data"]}}}},"404":{"description":"Key not found"}}}},"\/api\/v1\/sessions":{"get":{"operationId":"listSessions","summary":"List this token's sessions","description":"Newest first, 50 a page.","tags":["sessions"],"security":[{"bearerAuth":["sessions:read"]}],"responses":{"200":{"description":"A page of sessions","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Session"}}},"required":["data"]}}}}}},"post":{"operationId":"startSession","summary":"Start a session","description":"For a script or CI run: pass the returned id as session_id when minting keys, and every call those keys make is logged against this purpose. End it when the run is done.","tags":["sessions"],"security":[{"bearerAuth":["sessions:write"]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SessionCreateRequest"}}}},"responses":{"201":{"description":"Started session","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/Session"}},"required":["data"]}}}},"422":{"description":"Validation error, for example an issue that is not in this organization"}}}},"\/api\/v1\/sessions\/{session}":{"get":{"operationId":"getSession","summary":"Get a session","tags":["sessions"],"parameters":[{"name":"session","in":"path","required":true,"schema":{"type":"string"},"description":"Session id (ses_\u2026). Another token's session is a 404."}],"security":[{"bearerAuth":["sessions:read"]}],"responses":{"200":{"description":"The session","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/Session"}},"required":["data"]}}}},"404":{"description":"Session not found"}}},"delete":{"operationId":"revokeSession","summary":"Revoke a session","description":"Ends the session and revokes every live key minted in it, on every source.","tags":["sessions"],"parameters":[{"name":"session","in":"path","required":true,"schema":{"type":"string"},"description":"Session id (ses_\u2026). Another token's session is a 404."}],"security":[{"bearerAuth":["sessions:write"]}],"responses":{"200":{"description":"Revoked session","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/Session"}},"required":["data"]}}}},"404":{"description":"Session not found"}}}},"\/api\/v1\/sessions\/{session}\/end":{"post":{"operationId":"endSession","summary":"End a session","description":"No more keys can be minted into it. Keys it already holds keep working until they expire. Safe to call twice.","tags":["sessions"],"parameters":[{"name":"session","in":"path","required":true,"schema":{"type":"string"},"description":"Session id (ses_\u2026). Another token's session is a 404."}],"security":[{"bearerAuth":["sessions:write"]}],"responses":{"200":{"description":"Ended session","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/Session"}},"required":["data"]}}}},"404":{"description":"Session not found"}}}},"\/api\/v1\/sessions\/{session}\/activity":{"get":{"operationId":"listSessionActivity","summary":"List a session's reported activity","description":"What the token's script reported doing outside swarmvia in the session, newest first. Kept as long as the plan keeps access logs.","tags":["sessions"],"parameters":[{"name":"session","in":"path","required":true,"schema":{"type":"string"},"description":"Session id (ses_\u2026). Another token's session is a 404."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1}}],"security":[{"bearerAuth":["sessions:read"]}],"responses":{"200":{"description":"Reported activity, 50 per page","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/ReportedActivity"}},"meta":{"type":"object","properties":{"current_page":{"type":"integer"},"last_page":{"type":"integer"},"total":{"type":"integer"}}}},"required":["data","meta"]}}}},"404":{"description":"Session not found"}}},"post":{"operationId":"recordSessionActivity","summary":"Record work done outside swarmvia","description":"Add one line to the session's timeline for work done on a system that is not a source (GitHub, S3, a shell). The dashboard shows it marked as reported, since swarmvia did not see it happen. One line of what was done, never its output, a payload or a secret. A session holds at most 5,000.","tags":["sessions"],"parameters":[{"name":"session","in":"path","required":true,"schema":{"type":"string"},"description":"Session id (ses_\u2026). Another token's session is a 404."}],"security":[{"bearerAuth":["sessions:write"]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ReportedActivityCreateRequest"}}}},"responses":{"201":{"description":"Recorded","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/ReportedActivity"}},"required":["data"]}}}},"404":{"description":"Session not found"},"409":{"description":"The session has ended or was revoked (`session_ended`, `session_revoked`), or already holds 5,000 entries (`activity_limit`)","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"Validation failed"}}}},"\/api\/v1\/sources\/{source}\/metrics":{"get":{"operationId":"getSourceMetrics","summary":"Source admit, queue, and reject metrics","tags":["metrics"],"parameters":[{"name":"source","in":"path","required":true,"schema":{"type":"string"},"description":"Source subdomain label."},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time"}}],"security":[{"bearerAuth":["metrics:read"]}],"responses":{"200":{"description":"Metrics summary","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SourceMetricsSummary"}}}},"404":{"description":"Source not found"}}}},"\/api\/v1\/webhooks":{"get":{"operationId":"listWebhooks","summary":"List webhook destinations","tags":["webhooks"],"security":[{"bearerAuth":["sources:read"]}],"responses":{"200":{"description":"Webhook collection","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/WebhookEndpoint"}}},"required":["data"]}}}}}},"post":{"operationId":"createWebhook","summary":"Create a webhook destination","tags":["webhooks"],"security":[{"bearerAuth":["sources:write"]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/StoreWebhookEndpointRequest"}}}},"responses":{"201":{"description":"Created webhook. signing_secret is returned once.","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/WebhookEndpoint"}},"required":["data"]}}}},"403":{"description":"Token or actor cannot manage webhooks"},"422":{"description":"Invalid URL, name taken, plan gate, or cap"}}}},"\/api\/v1\/webhooks\/{webhookEndpoint}\/rotate":{"post":{"operationId":"rotateWebhook","summary":"Rotate a webhook signing key","description":"Mints a new key. With expire_previous_in, the replaced key keeps signing deliveries alongside the new one until then (X-Swarmvia-Signatures carries both; X-Swarmvia-Signature uses the old key), so the receiver can switch without missing a delivery.","tags":["webhooks"],"parameters":[{"name":"webhookEndpoint","in":"path","required":true,"schema":{"type":"integer"},"description":"Webhook destination id."}],"requestBody":{"required":false,"content":{"application\/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"expire_previous_in":{"type":"integer","minimum":0,"maximum":604800,"default":0,"description":"Seconds the replaced key stays valid. 0 (default) ends it now; at most 7 days."}}}}}},"security":[{"bearerAuth":["sources:write"]}],"responses":{"200":{"description":"Rotated webhook. signing_secret is returned once.","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/WebhookEndpoint"}},"required":["data"]}}}},"403":{"description":"Token or actor cannot manage webhooks"},"404":{"description":"Webhook not found in this organization"},"503":{"description":"Edge projection failed; signing key unchanged"}}}},"\/api\/v1\/webhooks\/{webhookEndpoint}\/previous-secret":{"delete":{"operationId":"expirePreviousWebhookSecret","summary":"Stop honoring a rotated-out webhook key now","tags":["webhooks"],"parameters":[{"name":"webhookEndpoint","in":"path","required":true,"schema":{"type":"integer"},"description":"Webhook destination id."}],"security":[{"bearerAuth":["sources:write"]}],"responses":{"200":{"description":"Only the current key signs deliveries now.","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/WebhookEndpoint"}},"required":["data"]}}}},"403":{"description":"Token or actor cannot manage webhooks"},"404":{"description":"Webhook not found, or no rotated-out key is still valid"},"503":{"description":"Edge projection failed; nothing changed"}}}},"\/api\/v1\/sources\/{source}\/policy":{"get":{"operationId":"getSourcePolicy","summary":"Read an API source's policy","tags":["policies","sources"],"parameters":[{"name":"source","in":"path","required":true,"schema":{"type":"string"},"description":"Source subdomain label."}],"security":[{"bearerAuth":["sources:read"]}],"responses":{"200":{"description":"The policy","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/SourcePolicy"}},"required":["data"]}}}},"404":{"description":"Source not found, or not an API source"}}},"put":{"operationId":"setSourcePolicy","summary":"Replace the default source policy","description":"Applies to keys already issued, within about a minute. Refused for an API token limited to chosen sources.","tags":["policies","sources"],"parameters":[{"name":"source","in":"path","required":true,"schema":{"type":"string"},"description":"Source subdomain label."}],"security":[{"bearerAuth":["sources:write"]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SourcePolicyUpdateRequest"}}}},"responses":{"200":{"description":"The policy after the change","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/SourcePolicy"}},"required":["data"]}}}},"403":{"description":"Token or its owner cannot change policies"},"404":{"description":"Source not found, or not an API source"},"422":{"description":"A rule is not valid"}}}},"\/api\/v1\/sources\/{source}\/policy\/grants\/{principal}":{"put":{"operationId":"setSourcePolicyGrant","summary":"Replace the extra calls a group gets","tags":["policies","sources"],"parameters":[{"name":"source","in":"path","required":true,"schema":{"type":"string"},"description":"Source subdomain label."},{"name":"principal","in":"path","required":true,"schema":{"type":"string","pattern":"^(group|user):[0-9]+$"},"description":"group:<id>."}],"security":[{"bearerAuth":["sources:write"]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SourcePolicyGrantRequest"}}}},"responses":{"200":{"description":"The policy after the change","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/SourcePolicy"}},"required":["data"]}}}},"403":{"description":"Token or its owner cannot change policies"},"404":{"description":"Source not found, or not an API source"},"422":{"description":"Unknown principal, or a rule is not valid"}}},"delete":{"operationId":"removeSourcePolicyGrant","summary":"Remove the extra calls a group gets","tags":["policies","sources"],"parameters":[{"name":"source","in":"path","required":true,"schema":{"type":"string"},"description":"Source subdomain label."},{"name":"principal","in":"path","required":true,"schema":{"type":"string","pattern":"^(group|user):[0-9]+$"},"description":"group:<id>."}],"security":[{"bearerAuth":["sources:write"]}],"responses":{"200":{"description":"The policy after the change","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/SourcePolicy"}},"required":["data"]}}}},"403":{"description":"Token or its owner cannot change policies"},"404":{"description":"Source not found, or it holds no rules for the principal"}}}},"\/api\/v1\/sources\/{source}\/webhooks":{"put":{"operationId":"setSourceWebhooks","summary":"Replace webhook destinations on a source","tags":["webhooks","sources"],"parameters":[{"name":"source","in":"path","required":true,"schema":{"type":"string"},"description":"Source subdomain label."}],"security":[{"bearerAuth":["sources:write"]}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SyncSourceWebhooksRequest"}}}},"responses":{"200":{"description":"Updated attachments","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#\/components\/schemas\/SourceWebhooks"}},"required":["data"]}}}},"403":{"description":"Token or actor cannot manage webhooks"},"404":{"description":"Source not found"},"422":{"description":"Unknown destination, plan gate, or cap"}}}}}}