{
    "components": {
        "schemas": {
            "AcceptDocumentsRequest": {
                "properties": {
                    "accepted_documents": {
                        "description": "AcceptedDocuments names current documents and their current\nversions; any subset of GET /legal/documents.",
                        "items": {
                            "$ref": "#/components/schemas/DocumentRef"
                        },
                        "maxItems": 10,
                        "minItems": 1,
                        "type": "array",
                        "uniqueItems": false
                    }
                },
                "required": [
                    "accepted_documents"
                ],
                "type": "object"
            },
            "AddOperatorRequest": {
                "properties": {
                    "role": {
                        "$ref": "#/components/schemas/Role",
                        "maxLength": 32
                    },
                    "user_id": {
                        "type": "string"
                    }
                },
                "required": [
                    "role",
                    "user_id"
                ],
                "type": "object"
            },
            "AtlassianAdoptRequest": {
                "properties": {
                    "agent_key": {
                        "type": "string"
                    },
                    "expires_at": {
                        "type": "string"
                    },
                    "token": {
                        "type": "string"
                    }
                },
                "required": [
                    "agent_key",
                    "token"
                ],
                "type": "object"
            },
            "AtlassianConnectRequest": {
                "properties": {
                    "api_key": {
                        "type": "string"
                    },
                    "cloud_id": {
                        "type": "string"
                    },
                    "org_id": {
                        "type": "string"
                    },
                    "site_url": {
                        "type": "string"
                    }
                },
                "required": [
                    "api_key",
                    "org_id"
                ],
                "type": "object"
            },
            "AtlassianProjectAccess": {
                "properties": {
                    "container": {
                        "type": "string"
                    },
                    "error": {
                        "type": "string"
                    },
                    "excess": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "missing": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "pending": {
                        "description": "Pending means the agent's seat has not taken effect yet, so the\ncheck could not run rather than having failed.",
                        "type": "boolean"
                    },
                    "product": {
                        "description": "Product distinguishes an ENG project from an ENG space.",
                        "type": "string"
                    },
                    "settings_style": {
                        "type": "string"
                    },
                    "settings_url": {
                        "description": "SettingsURL is where a person changes this container's access, and\nSettingsStyle what kind of screen that is.",
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "AtlassianServiceAccountStatus": {
                "properties": {
                    "agent_key": {
                        "type": "string"
                    },
                    "display_name": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string"
                    },
                    "has_token": {
                        "type": "boolean"
                    },
                    "last_error": {
                        "type": "string"
                    },
                    "projects": {
                        "description": "Projects is what the agent may actually do in each project and\nspace it works in, as the product reported it at the last sync.\nEach entry names its product, because a Jira project and a\nConfluence space can share a key. An entry carrying excess names\naccess the tenant's own permission scheme granted on top of what\nCrewlet asks for; only they can revoke it.",
                        "items": {
                            "$ref": "#/components/schemas/AtlassianProjectAccess"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "status": {
                        "type": "string"
                    },
                    "token_expires_at": {
                        "type": "string"
                    },
                    "updated_at": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "AtlassianStatusResponse": {
                "properties": {
                    "available": {
                        "type": "boolean"
                    },
                    "awaiting_app": {
                        "description": "AwaitingApp means the credential works but nothing is provisioned\nyet, because the Crewlet app is not on the site. It is the\nconsole's cue to keep showing the install step and to keep\nchecking.",
                        "type": "boolean"
                    },
                    "cloud_id": {
                        "type": "string"
                    },
                    "connected": {
                        "type": "boolean"
                    },
                    "connected_at": {
                        "type": "string"
                    },
                    "forge_install_url": {
                        "description": "ForgeInstallURL is where an administrator installs the app, empty\nwhen the deployment has none configured.",
                        "type": "string"
                    },
                    "forge_installed": {
                        "description": "ForgeInstalled reports whether the Crewlet app is installed on the\nsite, confirmed with Atlassian rather than assumed.",
                        "type": "boolean"
                    },
                    "org_id": {
                        "type": "string"
                    },
                    "reconcile": {
                        "$ref": "#/components/schemas/ReconcileStatus",
                        "description": "Reconcile is what the loop last made of this integration, so\nthe console states whether a provider is still applying\nsomething or a person is being waited on."
                    },
                    "service_accounts": {
                        "items": {
                            "$ref": "#/components/schemas/AtlassianServiceAccountStatus"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "site_url": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "AuditActorKind": {
                "enum": [
                    "human",
                    "machine",
                    "pat",
                    "system",
                    "anonymous"
                ],
                "type": "string"
            },
            "AuditDailySummary": {
                "properties": {
                    "company_id": {
                        "type": "string"
                    },
                    "count": {
                        "type": "integer"
                    },
                    "day": {
                        "type": "string"
                    },
                    "event_type": {
                        "$ref": "#/components/schemas/AuditEventType"
                    },
                    "outcome": {
                        "$ref": "#/components/schemas/AuditOutcome"
                    }
                },
                "type": "object"
            },
            "AuditEvent": {
                "properties": {
                    "actor_kind": {
                        "$ref": "#/components/schemas/AuditActorKind"
                    },
                    "actor_label": {
                        "type": "string"
                    },
                    "actor_user_id": {
                        "type": "string"
                    },
                    "changes": {
                        "description": "The field-level diff of a state-changing event, as\n`{ \"field\": { \"from\": ..., \"to\": ... } }`, with sensitive keys\nremoved. Absent when there is no diff (creation, deletion, sign-in).",
                        "items": {
                            "type": "integer"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "client_ip": {
                        "items": {
                            "type": "integer"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "company_id": {
                        "type": "string"
                    },
                    "correlation_id": {
                        "type": "string"
                    },
                    "credential_id": {
                        "type": "string"
                    },
                    "credential_kind": {
                        "type": "string"
                    },
                    "credential_prefix": {
                        "type": "string"
                    },
                    "event_type": {
                        "$ref": "#/components/schemas/AuditEventType"
                    },
                    "http_method": {
                        "type": "string"
                    },
                    "http_path": {
                        "type": "string"
                    },
                    "http_status": {
                        "type": "integer"
                    },
                    "id": {
                        "type": "string"
                    },
                    "metadata": {
                        "items": {
                            "type": "integer"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "occurred_at": {
                        "type": "string"
                    },
                    "outcome": {
                        "$ref": "#/components/schemas/AuditOutcome"
                    },
                    "recorded_at": {
                        "type": "string"
                    },
                    "request_body": {
                        "description": "The JSON body of the request a `system.http_request` event records,\nwith secret-shaped keys removed. Never captured for sign-in, sign-up,\ntoken refresh or OAuth exchange.",
                        "items": {
                            "type": "integer"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "request_id": {
                        "type": "string"
                    },
                    "schema_version": {
                        "type": "integer"
                    },
                    "subjects": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "target_id": {
                        "type": "string"
                    },
                    "target_kind": {
                        "$ref": "#/components/schemas/AuditTargetKind"
                    },
                    "target_label": {
                        "type": "string"
                    },
                    "user_agent": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "AuditEventType": {
                "enum": [
                    "auth.login_succeeded",
                    "auth.login_failed",
                    "auth.logout",
                    "auth.refresh_reused",
                    "auth.email_verified",
                    "auth.password_reset",
                    "auth.mfa_enabled",
                    "auth.mfa_disabled",
                    "auth.mfa_failed",
                    "organization.created",
                    "legal.documents_accepted",
                    "company.created",
                    "company.updated",
                    "company.config_changed",
                    "company.deleted",
                    "company.restored",
                    "company.ownership_transferred",
                    "operator.added",
                    "operator.role_changed",
                    "operator.removed",
                    "operator.disabled",
                    "operator.enabled",
                    "machine_user.created",
                    "machine_user.deleted",
                    "machine_key.issued",
                    "machine_key.revoked",
                    "pat.issued",
                    "pat.revoked",
                    "integration.slack_connected",
                    "integration.slack_disconnected",
                    "integration.atlassian_connected",
                    "integration.atlassian_disconnected",
                    "integration.atlassian_credential_adopted",
                    "integration.github_connected",
                    "integration.github_disconnected",
                    "integration.gitlab_connected",
                    "integration.gitlab_disconnected",
                    "integration.datadog_connected",
                    "integration.datadog_disconnected",
                    "integration.datadog_role_ready",
                    "system.http_request"
                ],
                "type": "string"
            },
            "AuditListResponse": {
                "properties": {
                    "events": {
                        "items": {
                            "$ref": "#/components/schemas/AuditEvent"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "next_cursor": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "AuditOutcome": {
                "enum": [
                    "success",
                    "failure",
                    "denied"
                ],
                "type": "string"
            },
            "AuditSummaryResponse": {
                "properties": {
                    "buckets": {
                        "items": {
                            "$ref": "#/components/schemas/AuditDailySummary"
                        },
                        "type": "array",
                        "uniqueItems": false
                    }
                },
                "type": "object"
            },
            "AuditTargetKind": {
                "enum": [
                    "user",
                    "company",
                    "operator",
                    "machine_user",
                    "machine_key",
                    "pat",
                    "plan",
                    "subscription",
                    "integration",
                    "agent",
                    "quota_override",
                    "system",
                    "organization"
                ],
                "type": "string"
            },
            "AuthProvider": {
                "enum": [
                    "local",
                    "google",
                    "github",
                    "machine"
                ],
                "type": "string"
            },
            "AuthResponse": {
                "properties": {
                    "access_token": {
                        "type": "string"
                    },
                    "csrf_token": {
                        "type": "string"
                    },
                    "user": {
                        "$ref": "#/components/schemas/User"
                    }
                },
                "type": "object"
            },
            "BalanceResponse": {
                "properties": {
                    "balance": {
                        "$ref": "#/components/schemas/EventBalance"
                    },
                    "ledger": {
                        "items": {
                            "$ref": "#/components/schemas/EventLedgerEntry"
                        },
                        "type": "array",
                        "uniqueItems": false
                    }
                },
                "type": "object"
            },
            "BillingActorKind": {
                "enum": [
                    "user",
                    "machine",
                    "system",
                    "stripe",
                    "support"
                ],
                "type": "string"
            },
            "BillingAuditEvent": {
                "properties": {
                    "account_id": {
                        "description": "The account a wallet, billing profile or payment method event\nbelongs to. Invoice, transaction and refund events carry both\naccount_id and company_id.",
                        "type": "string"
                    },
                    "actor_id": {
                        "type": "string"
                    },
                    "actor_kind": {
                        "$ref": "#/components/schemas/BillingActorKind"
                    },
                    "company_id": {
                        "type": "string"
                    },
                    "corrects_event_id": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "event_type": {
                        "$ref": "#/components/schemas/BillingAuditEventType"
                    },
                    "event_version": {
                        "type": "integer"
                    },
                    "id": {
                        "type": "string"
                    },
                    "idempotency_key": {
                        "type": "string"
                    },
                    "ip_address": {
                        "items": {
                            "type": "integer"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "payload": {
                        "items": {
                            "type": "integer"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "reason_code": {
                        "type": "string"
                    },
                    "reason_text": {
                        "type": "string"
                    },
                    "request_id": {
                        "type": "string"
                    },
                    "sequence": {
                        "type": "integer"
                    },
                    "user_agent": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "BillingAuditEventType": {
                "enum": [
                    "subscription.created",
                    "subscription.upgraded",
                    "subscription.downgraded",
                    "subscription.canceled",
                    "subscription.reactivated",
                    "subscription.renewed",
                    "subscription.trial_started",
                    "subscription.trial_ended",
                    "subscription.billing_period_changed",
                    "event_units.granted",
                    "event_units.debited",
                    "event_units.refunded",
                    "event_units.expired",
                    "event_units.adjusted",
                    "event.recorded",
                    "event.rejected",
                    "llm.recorded",
                    "llm_cost.debited",
                    "llm_cost.refunded",
                    "byot.enabled",
                    "byot.disabled",
                    "llm_mode.changed"
                ],
                "type": "string"
            },
            "BillingPeriod": {
                "enum": [
                    "monthly",
                    "annual"
                ],
                "type": "string"
            },
            "CancelRequest": {
                "properties": {
                    "reason": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "ChangePlanRequest": {
                "properties": {
                    "plan_code": {
                        "type": "string"
                    }
                },
                "required": [
                    "plan_code"
                ],
                "type": "object"
            },
            "Company": {
                "properties": {
                    "config": {
                        "items": {
                            "type": "integer"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "deleted_at": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "logo_url": {
                        "description": "URL of the company logo. Absent until a logo is uploaded.",
                        "type": "string"
                    },
                    "name": {
                        "maxLength": 100,
                        "type": "string"
                    },
                    "organization_id": {
                        "description": "OrganizationID is the organization that owns the company.",
                        "type": "string"
                    },
                    "owner_user_id": {
                        "type": "string"
                    },
                    "plan": {
                        "$ref": "#/components/schemas/Plan"
                    },
                    "plan_id": {
                        "type": "string"
                    },
                    "record": {
                        "$ref": "#/components/schemas/RecordStatus",
                        "description": "How far the company's workspace has applied its latest configuration.\nReturned when reading one company, and only when its workspace reports it."
                    },
                    "updated_at": {
                        "type": "string"
                    }
                },
                "required": [
                    "config",
                    "name"
                ],
                "type": "object"
            },
            "CompanyOperator": {
                "properties": {
                    "company_id": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "role": {
                        "$ref": "#/components/schemas/Role"
                    },
                    "updated_at": {
                        "type": "string"
                    },
                    "user": {
                        "$ref": "#/components/schemas/User"
                    },
                    "user_id": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "CreateKeyRequest": {
                "properties": {
                    "expires_at": {
                        "type": "string"
                    },
                    "name": {
                        "maxLength": 100,
                        "type": "string"
                    }
                },
                "required": [
                    "name"
                ],
                "type": "object"
            },
            "CreateMachineOperatorRequest": {
                "properties": {
                    "description": {
                        "maxLength": 500,
                        "type": "string"
                    },
                    "expires_at": {
                        "type": "string"
                    },
                    "name": {
                        "maxLength": 100,
                        "type": "string"
                    }
                },
                "required": [
                    "name"
                ],
                "type": "object"
            },
            "CreateOrganizationRequest": {
                "properties": {
                    "name": {
                        "maxLength": 100,
                        "type": "string"
                    }
                },
                "required": [
                    "name"
                ],
                "type": "object"
            },
            "CreatePATRequest": {
                "properties": {
                    "allowed_company_ids": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "allowed_permissions": {
                        "items": {
                            "$ref": "#/components/schemas/Permission"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "expires_at": {
                        "type": "string"
                    },
                    "name": {
                        "maxLength": 100,
                        "type": "string"
                    }
                },
                "required": [
                    "name"
                ],
                "type": "object"
            },
            "CreateWorkspaceRequest": {
                "properties": {
                    "discount_code": {
                        "type": "string"
                    },
                    "display_name": {
                        "maxLength": 100,
                        "type": "string"
                    },
                    "plan_id": {
                        "type": "string"
                    },
                    "starter": {
                        "$ref": "#/components/schemas/Starter"
                    }
                },
                "required": [
                    "display_name",
                    "plan_id",
                    "starter"
                ],
                "type": "object"
            },
            "CreatedKeyResponse": {
                "properties": {
                    "company_id": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "expires_at": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "last_used_at": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "prefix": {
                        "type": "string"
                    },
                    "revoked_at": {
                        "type": "string"
                    },
                    "token": {
                        "type": "string"
                    },
                    "updated_at": {
                        "type": "string"
                    },
                    "user": {
                        "$ref": "#/components/schemas/User"
                    },
                    "user_id": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "CreatedMachineOperatorResponse": {
                "properties": {
                    "key": {
                        "$ref": "#/components/schemas/MachineOperatorKey"
                    },
                    "token": {
                        "type": "string"
                    },
                    "user": {
                        "$ref": "#/components/schemas/User"
                    }
                },
                "type": "object"
            },
            "CreatedPATResponse": {
                "properties": {
                    "allowed_company_ids": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "allowed_permissions": {
                        "items": {
                            "$ref": "#/components/schemas/Permission"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "expires_at": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "last_used_at": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "prefix": {
                        "type": "string"
                    },
                    "revoked_at": {
                        "type": "string"
                    },
                    "token": {
                        "type": "string"
                    },
                    "updated_at": {
                        "type": "string"
                    },
                    "user": {
                        "$ref": "#/components/schemas/User"
                    },
                    "user_id": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "DatadogAccess": {
                "properties": {
                    "error": {
                        "type": "string"
                    },
                    "excess": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "missing": {
                        "description": "Missing means the agent holds none of its tier's permissions,\nwhich is what a role removed by hand looks like.",
                        "type": "boolean"
                    },
                    "pending": {
                        "description": "Pending means the role was granted moments ago and has not taken\neffect yet.",
                        "type": "boolean"
                    },
                    "settings_url": {
                        "description": "Where a person changes the role, so a problem names its own fix.",
                        "type": "string"
                    },
                    "tier": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "DatadogConnectRequest": {
                "properties": {
                    "api_key": {
                        "type": "string"
                    },
                    "app_key": {
                        "type": "string"
                    },
                    "site": {
                        "type": "string"
                    }
                },
                "required": [
                    "api_key",
                    "app_key",
                    "site"
                ],
                "type": "object"
            },
            "DatadogRoleSummary": {
                "properties": {
                    "label": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "tier": {
                        "type": "string"
                    },
                    "url": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "DatadogServiceAccountStatus": {
                "properties": {
                    "access": {
                        "$ref": "#/components/schemas/DatadogAccess",
                        "description": "What the agent may actually do, as Datadog reported it at the last\nsync."
                    },
                    "agent_key": {
                        "type": "string"
                    },
                    "display_name": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string"
                    },
                    "has_key": {
                        "type": "boolean"
                    },
                    "key_last4": {
                        "type": "string"
                    },
                    "last_error": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "tier": {
                        "description": "TierLabel is the same tier in the words the console shows.",
                        "type": "string"
                    },
                    "tier_label": {
                        "type": "string"
                    },
                    "updated_at": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "DatadogStatusResponse": {
                "properties": {
                    "available": {
                        "type": "boolean"
                    },
                    "connected": {
                        "type": "boolean"
                    },
                    "connected_at": {
                        "type": "string"
                    },
                    "org_name": {
                        "type": "string"
                    },
                    "org_public_id": {
                        "type": "string"
                    },
                    "reconcile": {
                        "$ref": "#/components/schemas/ReconcileStatus",
                        "description": "Reconcile is what the loop last made of this integration, so\nthe console states whether a provider is still applying\nsomething or a person is being waited on."
                    },
                    "roles": {
                        "description": "Roles lets the console link to what agents may do rather than\ndescribing it second-hand.",
                        "items": {
                            "$ref": "#/components/schemas/DatadogRoleSummary"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "service_accounts": {
                        "items": {
                            "$ref": "#/components/schemas/DatadogServiceAccountStatus"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "site": {
                        "type": "string"
                    },
                    "sites": {
                        "description": "Offered so nobody has to type a region hostname correctly.",
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "status": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "DiscountAppliesTo": {
                "enum": [
                    "subscription_recurring",
                    "subscription_overage",
                    "top_up",
                    "all"
                ],
                "type": "string"
            },
            "DiscountKind": {
                "enum": [
                    "percent",
                    "fixed_amount",
                    "free_trial_extend",
                    "price_override"
                ],
                "type": "string"
            },
            "Document": {
                "properties": {
                    "kind": {
                        "$ref": "#/components/schemas/DocumentKind"
                    },
                    "url": {
                        "type": "string"
                    },
                    "version": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "DocumentAcceptance": {
                "properties": {
                    "accepted_at": {
                        "type": "string"
                    },
                    "kind": {
                        "$ref": "#/components/schemas/DocumentKind"
                    },
                    "source": {
                        "$ref": "#/components/schemas/DocumentSource"
                    },
                    "version": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "DocumentAcceptancesResponse": {
                "properties": {
                    "acceptances": {
                        "items": {
                            "$ref": "#/components/schemas/DocumentAcceptance"
                        },
                        "type": "array",
                        "uniqueItems": false
                    }
                },
                "type": "object"
            },
            "DocumentKind": {
                "enum": [
                    "terms",
                    "privacy",
                    "aup"
                ],
                "type": "string"
            },
            "DocumentRef": {
                "properties": {
                    "kind": {
                        "$ref": "#/components/schemas/DocumentKind"
                    },
                    "version": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "DocumentSource": {
                "enum": [
                    "signup",
                    "first_acceptance",
                    "new_version"
                ],
                "type": "string"
            },
            "EffectiveQuota": {
                "properties": {
                    "key": {
                        "$ref": "#/components/schemas/QuotaKey"
                    },
                    "limit": {
                        "type": "integer"
                    },
                    "overage": {
                        "$ref": "#/components/schemas/QuotaOverage"
                    },
                    "override_expires_at": {
                        "type": "string"
                    },
                    "override_reason": {
                        "description": "OverrideReason and OverrideExpiresAt are set when an override\nis the active source. Surfaced so an operator looking at \"X\nof Y used\" can see why the limit isn't the plan default.",
                        "type": "string"
                    },
                    "plan_code": {
                        "description": "PlanCode is set when Source == QuotaSourcePlan, or when the\nscope is a company and a plan was resolvable (regardless of\nsource). Empty for account-scoped quotas.",
                        "type": "string"
                    },
                    "remaining": {
                        "type": "integer"
                    },
                    "resource": {
                        "type": "string"
                    },
                    "scope": {
                        "$ref": "#/components/schemas/QuotaScope"
                    },
                    "source": {
                        "$ref": "#/components/schemas/QuotaSource"
                    },
                    "used": {
                        "type": "integer"
                    }
                },
                "type": "object"
            },
            "EmailTokenRequest": {
                "properties": {
                    "token": {
                        "maxLength": 128,
                        "type": "string"
                    }
                },
                "required": [
                    "token"
                ],
                "type": "object"
            },
            "ErrorResponse": {
                "properties": {
                    "code": {
                        "type": "string"
                    },
                    "details": {
                        "type": "string"
                    },
                    "documents": {
                        "description": "Documents, with code documents_not_accepted, are the current legal\ndocuments to accept.",
                        "items": {
                            "$ref": "#/components/schemas/Document"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "error": {
                        "type": "string"
                    },
                    "pending": {
                        "description": "Pending, with code documents_pending, are the current legal\ndocuments the account has not accepted (POST\n/user/me/legal-acceptances).",
                        "items": {
                            "$ref": "#/components/schemas/Document"
                        },
                        "type": "array",
                        "uniqueItems": false
                    }
                },
                "type": "object"
            },
            "EventBalance": {
                "properties": {
                    "balance": {
                        "type": "integer"
                    },
                    "company_id": {
                        "type": "string"
                    },
                    "last_ledger_sequence": {
                        "type": "integer"
                    },
                    "updated_at": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "EventLedgerEntry": {
                "properties": {
                    "balance_after": {
                        "type": "integer"
                    },
                    "company_id": {
                        "type": "string"
                    },
                    "corrects_entry_id": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "delta_units": {
                        "type": "integer"
                    },
                    "effective_at": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "reason": {
                        "$ref": "#/components/schemas/EventLedgerReason"
                    },
                    "sequence": {
                        "type": "integer"
                    },
                    "source_kind": {
                        "$ref": "#/components/schemas/EventLedgerSourceKind"
                    },
                    "source_ref": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "EventLedgerReason": {
                "enum": [
                    "subscription_grant",
                    "usage_debit",
                    "refund_grant",
                    "expiry_debit",
                    "support_grant",
                    "support_clawback",
                    "correction"
                ],
                "type": "string"
            },
            "EventLedgerSourceKind": {
                "enum": [
                    "subscription",
                    "usage_event",
                    "support_ticket",
                    "correction"
                ],
                "type": "string"
            },
            "ForgotPasswordRequest": {
                "properties": {
                    "email": {
                        "maxLength": 255,
                        "type": "string"
                    }
                },
                "required": [
                    "email"
                ],
                "type": "object"
            },
            "GiftCardRedeemRequest": {
                "properties": {
                    "code": {
                        "type": "string"
                    }
                },
                "required": [
                    "code"
                ],
                "type": "object"
            },
            "GitHubAccess": {
                "properties": {
                    "account": {
                        "description": "Account is where the app is installed.\n\nA repository is named in a config that a person wrote and reads\nback later, so \"not found\" is only actionable beside the account\nit was looked for in.",
                        "type": "string"
                    },
                    "error": {
                        "type": "string"
                    },
                    "excess": {
                        "description": "Excess is anything on the deny list the installation granted. The\napp should never hold these, so their presence means the\ninstallation was given more than Crewlet asks for.",
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "granted": {
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Granted is the permission set on the minted token. GitHub narrows\na request silently, so this is what the agent has rather than what\nwas asked for.",
                        "type": "object"
                    },
                    "repos": {
                        "description": "Repos the token actually reached, which can be fewer than the\nagent names if the installation does not cover them.",
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "settings_url": {
                        "description": "SettingsURL is where a person changes what the installation\ngrants, so a problem names its own fix.",
                        "type": "string"
                    },
                    "short": {
                        "description": "Short names tier permissions the installation cannot provide, so\nan agent limited by the installation rather than by its tier is\nvisible.",
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "tier": {
                        "type": "string"
                    },
                    "unreachable": {
                        "description": "Unreachable names repositories the agent's configuration asks for\nthat the installation does not cover. Crewlet cannot widen an\ninstallation, so these are reported for the tenant to fix.",
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    }
                },
                "type": "object"
            },
            "GitHubAgentStatus": {
                "properties": {
                    "access": {
                        "$ref": "#/components/schemas/GitHubAccess",
                        "description": "What the agent can actually do, proven by minting a token."
                    },
                    "agent_key": {
                        "type": "string"
                    },
                    "dedicated_app_name": {
                        "type": "string"
                    },
                    "dedicated_app_slug": {
                        "type": "string"
                    },
                    "dedicated_install_url": {
                        "type": "string"
                    },
                    "dedicated_installed": {
                        "type": "boolean"
                    },
                    "dedicated_settings_url": {
                        "description": "DedicatedSettingsURL is where an owner deletes the app. GitHub\npublishes no API for that, so an app outlives every disconnect\nuntil somebody removes it by hand, and the console says so.",
                        "type": "string"
                    },
                    "identity_mode": {
                        "type": "string"
                    },
                    "last_error": {
                        "type": "string"
                    },
                    "repos": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "status": {
                        "type": "string"
                    },
                    "tier": {
                        "type": "string"
                    },
                    "tier_label": {
                        "type": "string"
                    },
                    "updated_at": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "GitHubConnectRequest": {
                "properties": {
                    "installation_id": {
                        "type": "integer"
                    }
                },
                "required": [
                    "installation_id"
                ],
                "type": "object"
            },
            "GitHubDedicatedInstallRequest": {
                "properties": {
                    "agent_key": {
                        "type": "string"
                    },
                    "installation_id": {
                        "type": "integer"
                    }
                },
                "required": [
                    "agent_key",
                    "installation_id"
                ],
                "type": "object"
            },
            "GitHubEventsStatus": {
                "properties": {
                    "delivering": {
                        "description": "Delivering is true once the engine holds the secret its apps\nsign with. Without it every delivery is rejected as unsigned.",
                        "type": "boolean"
                    },
                    "last_error": {
                        "description": "LastError names what stopped the last attempt, in the terms of\nwhat somebody has to do about it.",
                        "type": "string"
                    },
                    "url": {
                        "description": "URL is the address the apps post to, so a person comparing it\nagainst GitHub's own delivery log has the same string.",
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "GitHubManifestRequest": {
                "properties": {
                    "agent_key": {
                        "type": "string"
                    },
                    "agent_name": {
                        "type": "string"
                    }
                },
                "required": [
                    "agent_key",
                    "agent_name"
                ],
                "type": "object"
            },
            "GitHubStatusResponse": {
                "properties": {
                    "account": {
                        "type": "string"
                    },
                    "agents": {
                        "items": {
                            "$ref": "#/components/schemas/GitHubAgentStatus"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "available": {
                        "type": "boolean"
                    },
                    "connected": {
                        "type": "boolean"
                    },
                    "connected_at": {
                        "type": "string"
                    },
                    "dedicated_available": {
                        "type": "boolean"
                    },
                    "events": {
                        "$ref": "#/components/schemas/GitHubEventsStatus",
                        "description": "Events is how GitHub reaches the company's agents. Reported\nbeside the seats because a perfectly provisioned agent that\nnothing delivers to still does no work."
                    },
                    "install_url": {
                        "description": "InstallURL is where an administrator installs or reconfigures the\napp, empty when the deployment has no app configured.",
                        "type": "string"
                    },
                    "permissions": {
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Permissions is what the installation holds, so the console can\nshow the ceiling every agent is bounded by.",
                        "type": "object"
                    },
                    "reconcile": {
                        "$ref": "#/components/schemas/ReconcileStatus",
                        "description": "Reconcile is what the loop last made of this integration, so\nthe console states whether a provider is still applying\nsomething or a person is being waited on."
                    },
                    "repository_selection": {
                        "description": "RepositorySelection is \"all\" or \"selected\", so the console can say\nwhether agents are limited by the installation itself.",
                        "type": "string"
                    },
                    "settings_url": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "suspended": {
                        "type": "boolean"
                    },
                    "tiers": {
                        "items": {
                            "$ref": "#/components/schemas/GitHubTierSummary"
                        },
                        "type": "array",
                        "uniqueItems": false
                    }
                },
                "type": "object"
            },
            "GitHubTierSummary": {
                "properties": {
                    "label": {
                        "type": "string"
                    },
                    "permissions": {
                        "additionalProperties": {
                            "type": "string"
                        },
                        "type": "object"
                    },
                    "tier": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "GitLabAccess": {
                "properties": {
                    "error": {
                        "type": "string"
                    },
                    "granted": {
                        "description": "Granted is what the account's token carries, read back from\nGitLab: a token is narrowed silently, so this is what it has\nrather than what was asked for.",
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "group": {
                        "description": "Group is where the accounts live, so a project that is not found\nis reported beside the place it was looked for.",
                        "type": "string"
                    },
                    "role": {
                        "description": "Role is the tier's own name for what this agent should hold.",
                        "type": "string"
                    },
                    "settings_url": {
                        "description": "SettingsURL is where a person changes what the group grants.",
                        "type": "string"
                    },
                    "short": {
                        "description": "Short names scopes the tier needs that the token did not get.",
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "unreachable": {
                        "description": "Unreachable names projects the agent is configured for that the\ngroup does not contain.",
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    }
                },
                "type": "object"
            },
            "GitLabConnectRequest": {
                "properties": {
                    "base_url": {
                        "description": "BaseURL is the instance the group lives on, so a self-managed\ntenant is not a different integration. Defaulted by the console\nto gitlab.com.",
                        "type": "string"
                    },
                    "group": {
                        "description": "Group is the top-level group's path or numeric id.",
                        "type": "string"
                    },
                    "token": {
                        "type": "string"
                    }
                },
                "required": [
                    "base_url",
                    "group",
                    "token"
                ],
                "type": "object"
            },
            "GitLabEventsStatus": {
                "properties": {
                    "delivering": {
                        "description": "Delivering is true once GitLab is registered and the engine\nholds the secret it signs with. Both halves, because either one\nalone delivers nothing.",
                        "type": "boolean"
                    },
                    "last_error": {
                        "description": "LastError names what stopped the last attempt, in the terms of\nwhat somebody has to do about it.",
                        "type": "string"
                    },
                    "settings_url": {
                        "description": "SettingsURL is where a person inspects the hook and its recent\ndeliveries.",
                        "type": "string"
                    },
                    "url": {
                        "description": "URL is the address the group posts to, so a person comparing it\nagainst GitLab's own delivery log has the same string.",
                        "type": "string"
                    },
                    "verified_at": {
                        "description": "VerifiedAt is when the hook was last seen in the group.",
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "GitLabProjectSeat": {
                "properties": {
                    "error": {
                        "type": "string"
                    },
                    "excess": {
                        "type": "string"
                    },
                    "granted": {
                        "type": "string"
                    },
                    "pending": {
                        "type": "boolean"
                    },
                    "project": {
                        "type": "string"
                    },
                    "role": {
                        "type": "string"
                    },
                    "settings_url": {
                        "type": "string"
                    },
                    "short": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "GitLabServiceAccountStatus": {
                "properties": {
                    "access": {
                        "$ref": "#/components/schemas/GitLabAccess",
                        "description": "Access is what the agent may actually do, as GitLab reported it\nat the last pass."
                    },
                    "agent_key": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string"
                    },
                    "has_token": {
                        "description": "HasToken says the agent holds a usable credential without\nrevealing anything about it.",
                        "type": "boolean"
                    },
                    "last_error": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "projects": {
                        "items": {
                            "$ref": "#/components/schemas/GitLabProjectSeat"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "status": {
                        "type": "string"
                    },
                    "tier": {
                        "description": "Tier is the stored value and TierLabel the same tier in the words\nthe console shows.",
                        "type": "string"
                    },
                    "tier_label": {
                        "type": "string"
                    },
                    "token_expires_at": {
                        "type": "string"
                    },
                    "updated_at": {
                        "type": "string"
                    },
                    "username": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "GitLabStatusResponse": {
                "properties": {
                    "available": {
                        "type": "boolean"
                    },
                    "base_url": {
                        "type": "string"
                    },
                    "connected": {
                        "type": "boolean"
                    },
                    "connected_at": {
                        "type": "string"
                    },
                    "events": {
                        "$ref": "#/components/schemas/GitLabEventsStatus",
                        "description": "Events is how the group reaches the company's agents. Reported\nbeside the seats because a perfectly provisioned agent that\nnothing delivers to still does no work."
                    },
                    "group_name": {
                        "type": "string"
                    },
                    "group_path": {
                        "type": "string"
                    },
                    "plan": {
                        "description": "Plan is the namespace's subscription, carried for context. Free\ncaps a top-level group at 100 service accounts; paid tiers do not.",
                        "type": "string"
                    },
                    "reconcile": {
                        "$ref": "#/components/schemas/ReconcileStatus",
                        "description": "Reconcile is what the loop last made of this integration, so the\nconsole states whether a provider is still applying something or\na person is being waited on."
                    },
                    "service_accounts": {
                        "items": {
                            "$ref": "#/components/schemas/GitLabServiceAccountStatus"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "settings_url": {
                        "description": "SettingsURL is where a person manages the group's members.",
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "tiers": {
                        "description": "Tiers is the contract each role carries.",
                        "items": {
                            "$ref": "#/components/schemas/GitLabTierSummary"
                        },
                        "type": "array",
                        "uniqueItems": false
                    }
                },
                "type": "object"
            },
            "GitLabTierSummary": {
                "properties": {
                    "label": {
                        "type": "string"
                    },
                    "role": {
                        "type": "string"
                    },
                    "scopes": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "tier": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "InsufficientWalletResponse": {
                "properties": {
                    "available_cents": {
                        "type": "integer"
                    },
                    "code": {
                        "type": "string"
                    },
                    "currency": {
                        "type": "string"
                    },
                    "error": {
                        "type": "string"
                    },
                    "required_cents": {
                        "type": "integer"
                    }
                },
                "type": "object"
            },
            "LLMMode": {
                "enum": [
                    "byot",
                    "managed"
                ],
                "type": "string"
            },
            "LoginRequest": {
                "properties": {
                    "email": {
                        "type": "string"
                    },
                    "password": {
                        "type": "string"
                    }
                },
                "required": [
                    "email",
                    "password"
                ],
                "type": "object"
            },
            "MFAChallengeResponse": {
                "properties": {
                    "mfa_required": {
                        "type": "boolean"
                    },
                    "mfa_ticket": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "MFACodeRequest": {
                "properties": {
                    "code": {
                        "maxLength": 32,
                        "type": "string"
                    }
                },
                "required": [
                    "code"
                ],
                "type": "object"
            },
            "MFAVerifyRequest": {
                "properties": {
                    "code": {
                        "description": "Code is a six-digit one-time code or a recovery code.",
                        "maxLength": 32,
                        "type": "string"
                    },
                    "ticket": {
                        "maxLength": 256,
                        "type": "string"
                    }
                },
                "required": [
                    "code",
                    "ticket"
                ],
                "type": "object"
            },
            "MachineListItem": {
                "properties": {
                    "name": {
                        "description": "Name is the machine's name.",
                        "type": "string"
                    },
                    "role": {
                        "$ref": "#/components/schemas/Role",
                        "description": "Role is omitted until the machine is added as an operator."
                    },
                    "user": {
                        "$ref": "#/components/schemas/User"
                    }
                },
                "required": [
                    "name"
                ],
                "type": "object"
            },
            "MachineOperatorKey": {
                "properties": {
                    "company_id": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "expires_at": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "last_used_at": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "prefix": {
                        "type": "string"
                    },
                    "revoked_at": {
                        "type": "string"
                    },
                    "updated_at": {
                        "type": "string"
                    },
                    "user": {
                        "$ref": "#/components/schemas/User"
                    },
                    "user_id": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "ManifestStart": {
                "properties": {
                    "action_url": {
                        "type": "string"
                    },
                    "manifest": {
                        "type": "string"
                    },
                    "state": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "MeResponse": {
                "properties": {
                    "avatar_url": {
                        "type": "string"
                    },
                    "company": {
                        "$ref": "#/components/schemas/Company",
                        "description": "Company that owns a machine user, loaded with the row so a user\nlisting can name it without a second query. Always nil on human\nrows."
                    },
                    "company_id": {
                        "description": "Machine users only: the company the machine belongs to and the\nadmin who created it. Unset for humans; never changes.",
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "created_by": {
                        "$ref": "#/components/schemas/User",
                        "description": "The admin who created a machine user, included in machine user\nlistings. Unset for humans."
                    },
                    "created_by_user_id": {
                        "type": "string"
                    },
                    "deleted_at": {
                        "description": "When the account was deleted. A deleted account no longer exists;\ndisabled_at instead freezes one that still does.",
                        "type": "string"
                    },
                    "description": {
                        "description": "Description is the optional free-form blurb shown next to a\nmachine user's name on the management page (e.g. \"deploy\nbot\", \"CI runner\"). Empty for humans.",
                        "maxLength": 500,
                        "type": "string"
                    },
                    "disabled_at": {
                        "description": "When the account was disabled; unset while enabled. Every credential\nit holds (sessions, personal API tokens, machine keys) is refused\nuntil it is enabled again, and none is revoked.",
                        "type": "string"
                    },
                    "email": {
                        "maxLength": 255,
                        "type": "string"
                    },
                    "first_name": {
                        "maxLength": 100,
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "is_verified": {
                        "type": "boolean"
                    },
                    "key": {
                        "$ref": "#/components/schemas/MachineOperatorKey",
                        "description": "The machine user's most recent key, revoked or expired ones included,\nin machine user listings. Unset for humans."
                    },
                    "kind": {
                        "$ref": "#/components/schemas/UserKind"
                    },
                    "last_name": {
                        "maxLength": 50,
                        "type": "string"
                    },
                    "mfa_enabled_at": {
                        "type": "string"
                    },
                    "mfa_prompt": {
                        "description": "MFAPrompt: the console should ask the account to turn TOTP on.",
                        "type": "boolean"
                    },
                    "mfa_required": {
                        "description": "MFARequired: the account owns or administers an organization with\na paid plan or a connected integration, so sensitive actions answer\n403 mfa_required until TOTP is on (503 mfa_unavailable while TOTP\ncannot be turned on).",
                        "type": "boolean"
                    },
                    "pending_documents": {
                        "description": "PendingDocuments are the current legal documents the account has\nnot accepted. Until it is empty, a signed-in session gets 403\ndocuments_pending everywhere except reading and accepting the\ndocuments, this profile, sign-out and session refresh.",
                        "items": {
                            "$ref": "#/components/schemas/Document"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "provider": {
                        "$ref": "#/components/schemas/AuthProvider"
                    },
                    "updated_at": {
                        "type": "string"
                    }
                },
                "required": [
                    "first_name"
                ],
                "type": "object"
            },
            "MemberOrganization": {
                "properties": {
                    "created_at": {
                        "type": "string"
                    },
                    "deleted_at": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "role": {
                        "$ref": "#/components/schemas/OrgRole"
                    },
                    "updated_at": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "MessageResponse": {
                "properties": {
                    "message": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "MeterKind": {
                "enum": [
                    "event_ingested",
                    "tokens_input",
                    "tokens_output",
                    "tool_call",
                    "compute_ms"
                ],
                "type": "string"
            },
            "OAuthExchangeRequest": {
                "properties": {
                    "code": {
                        "type": "string"
                    }
                },
                "required": [
                    "code"
                ],
                "type": "object"
            },
            "OperatorListItem": {
                "properties": {
                    "company_id": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "email": {
                        "description": "Email is omitted for a machine operator, which has none.",
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "name": {
                        "description": "Name is the operator's first and last name, or a machine's name.",
                        "type": "string"
                    },
                    "role": {
                        "$ref": "#/components/schemas/Role"
                    },
                    "updated_at": {
                        "type": "string"
                    },
                    "user": {
                        "$ref": "#/components/schemas/User"
                    },
                    "user_id": {
                        "type": "string"
                    }
                },
                "required": [
                    "name",
                    "role"
                ],
                "type": "object"
            },
            "OrgRole": {
                "enum": [
                    "owner",
                    "admin",
                    "billing",
                    "member"
                ],
                "type": "string"
            },
            "OrganizationMember": {
                "properties": {
                    "created_at": {
                        "type": "string"
                    },
                    "organization_id": {
                        "type": "string"
                    },
                    "role": {
                        "$ref": "#/components/schemas/OrgRole"
                    },
                    "updated_at": {
                        "type": "string"
                    },
                    "user_id": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "Permission": {
                "enum": [
                    "company:read",
                    "company:update",
                    "company:delete",
                    "integrations:read",
                    "integrations:write",
                    "operators:read",
                    "operators:write",
                    "operators:transfer_ownership",
                    "billing:read",
                    "billing:write",
                    "billing:audit_read",
                    "invoice:read",
                    "invoice:refund_request",
                    "transaction:read",
                    "audit:read",
                    "audit:export",
                    "audit:stream"
                ],
                "type": "string"
            },
            "PersonalAPIToken": {
                "properties": {
                    "allowed_company_ids": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "allowed_permissions": {
                        "items": {
                            "$ref": "#/components/schemas/Permission"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "expires_at": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "last_used_at": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "prefix": {
                        "type": "string"
                    },
                    "revoked_at": {
                        "type": "string"
                    },
                    "updated_at": {
                        "type": "string"
                    },
                    "user": {
                        "$ref": "#/components/schemas/User"
                    },
                    "user_id": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "Plan": {
                "properties": {
                    "base_price_annual_cents": {
                        "type": "integer"
                    },
                    "base_price_monthly_cents": {
                        "type": "integer"
                    },
                    "code": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "currency": {
                        "type": "string"
                    },
                    "display_name": {
                        "type": "string"
                    },
                    "event_overage_rate_per_1k_cents": {
                        "type": "integer"
                    },
                    "feature_flags": {
                        "items": {
                            "type": "integer"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "hard_cap": {
                        "type": "boolean"
                    },
                    "id": {
                        "type": "string"
                    },
                    "included_event_units_annual": {
                        "type": "integer"
                    },
                    "included_event_units_monthly": {
                        "type": "integer"
                    },
                    "is_active": {
                        "type": "boolean"
                    },
                    "max_agents": {
                        "type": "integer"
                    },
                    "max_integrations_active": {
                        "type": "integer"
                    },
                    "max_machine_keys": {
                        "type": "integer"
                    },
                    "max_operators": {
                        "type": "integer"
                    },
                    "sla_tier": {
                        "$ref": "#/components/schemas/PlanSLATier"
                    },
                    "sla_uptime_percent_e2": {
                        "type": "integer"
                    },
                    "support_tier": {
                        "$ref": "#/components/schemas/PlanSupportTier"
                    },
                    "tier": {
                        "$ref": "#/components/schemas/PlanTier"
                    },
                    "updated_at": {
                        "type": "string"
                    },
                    "visibility": {
                        "$ref": "#/components/schemas/PlanVisibility"
                    }
                },
                "type": "object"
            },
            "PlanSLATier": {
                "enum": [
                    "none",
                    "standard",
                    "high",
                    "premium",
                    "custom"
                ],
                "type": "string"
            },
            "PlanSupportTier": {
                "enum": [
                    "community",
                    "standard",
                    "priority",
                    "dedicated",
                    "named_tam"
                ],
                "type": "string"
            },
            "PlanTier": {
                "enum": [
                    "free",
                    "starter",
                    "pro",
                    "max",
                    "enterprise"
                ],
                "type": "string"
            },
            "PlanVisibility": {
                "enum": [
                    "public",
                    "private",
                    "internal"
                ],
                "type": "string"
            },
            "PreviewRequest": {
                "properties": {
                    "billing_period": {
                        "type": "string"
                    },
                    "code": {
                        "type": "string"
                    },
                    "plan_code": {
                        "type": "string"
                    }
                },
                "required": [
                    "billing_period",
                    "code",
                    "plan_code"
                ],
                "type": "object"
            },
            "PreviewResponse": {
                "properties": {
                    "applies_to": {
                        "$ref": "#/components/schemas/DiscountAppliesTo"
                    },
                    "billing_period_allowlist": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "code": {
                        "type": "string"
                    },
                    "currency": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    },
                    "discount_amount_cents": {
                        "type": "integer"
                    },
                    "fixed_amount_cents": {
                        "type": "integer"
                    },
                    "kind": {
                        "$ref": "#/components/schemas/DiscountKind"
                    },
                    "net_cents": {
                        "type": "integer"
                    },
                    "percent_bps": {
                        "type": "integer"
                    },
                    "plan_code_allowlist": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "subtotal_cents": {
                        "type": "integer"
                    },
                    "trial_extend_days": {
                        "type": "integer"
                    }
                },
                "type": "object"
            },
            "ProvisioningFailure": {
                "properties": {
                    "code": {
                        "type": "string"
                    },
                    "retryable": {
                        "type": "boolean"
                    }
                },
                "type": "object"
            },
            "ProvisioningStatus": {
                "properties": {
                    "failure": {
                        "$ref": "#/components/schemas/ProvisioningFailure"
                    },
                    "slow": {
                        "description": "Slow turns true when provisioning has taken longer than expected.",
                        "type": "boolean"
                    },
                    "started_at": {
                        "type": "string"
                    },
                    "state": {
                        "$ref": "#/components/schemas/WorkspaceState"
                    },
                    "steps": {
                        "items": {
                            "$ref": "#/components/schemas/ProvisioningStep"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "updated_at": {
                        "type": "string"
                    },
                    "workspace_id": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "ProvisioningStep": {
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/ProvisioningStepID"
                    },
                    "status": {
                        "$ref": "#/components/schemas/StepStatus"
                    }
                },
                "type": "object"
            },
            "ProvisioningStepID": {
                "enum": [
                    "reserve",
                    "starter",
                    "start",
                    "ready"
                ],
                "type": "string"
            },
            "QuotaKey": {
                "enum": [
                    "company:agents",
                    "company:event_units_monthly",
                    "company:operators",
                    "company:machine_keys",
                    "company:integrations_active",
                    "account:companies_owned",
                    "account:free_companies_owned",
                    "account:pat_active"
                ],
                "type": "string"
            },
            "QuotaOverage": {
                "enum": [
                    "block",
                    "soft",
                    "warn"
                ],
                "type": "string"
            },
            "QuotaScope": {
                "enum": [
                    "account",
                    "company"
                ],
                "type": "string"
            },
            "QuotaSource": {
                "enum": [
                    "override",
                    "plan",
                    "builtin"
                ],
                "type": "string"
            },
            "ReconcileStatus": {
                "properties": {
                    "action_url": {
                        "type": "string"
                    },
                    "actor": {
                        "type": "string"
                    },
                    "detail": {
                        "type": "string"
                    },
                    "disconnecting": {
                        "description": "Disconnecting is true from the moment somebody asks for the\nintegration to be taken away, which is before the loop has run and\nset a phase. Without it the console shows a connected integration\nfor as long as it takes the first pass to start.",
                        "type": "boolean"
                    },
                    "last_attempt_at": {
                        "type": "string"
                    },
                    "last_error": {
                        "description": "LastError is why the last pass failed, empty when it did not.",
                        "type": "string"
                    },
                    "next_attempt_at": {
                        "description": "NextAttemptAt lets the console count down to a real event rather\nthan to a timer of its own.",
                        "type": "string"
                    },
                    "outcome": {
                        "description": "Outcome is settled, waiting, or blocked.",
                        "type": "string"
                    },
                    "phase": {
                        "description": "Phase is where the integration got to, and Actor is who has to\nact for it to move on. Detail and ActionURL are filled only when\nthat actor is a person, and are what the console shows instead of\na generic warning.",
                        "type": "string"
                    },
                    "settled_at": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "RecordState": {
                "enum": [
                    "pending",
                    "synced"
                ],
                "type": "string"
            },
            "RecordStatus": {
                "properties": {
                    "generation": {
                        "description": "Version of the company's configuration; it increases with every change.",
                        "type": "integer"
                    },
                    "observed_generation": {
                        "description": "Latest configuration version the workspace has applied.",
                        "type": "integer"
                    },
                    "state": {
                        "$ref": "#/components/schemas/RecordState",
                        "description": "pending until the workspace applies the latest version, then synced."
                    }
                },
                "type": "object"
            },
            "RecoveryCodesResponse": {
                "properties": {
                    "recovery_codes": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    }
                },
                "type": "object"
            },
            "Referral": {
                "properties": {
                    "created_at": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "qualified_at": {
                        "type": "string"
                    },
                    "qualifier": {
                        "type": "string"
                    },
                    "referee_company_id": {
                        "type": "string"
                    },
                    "referee_reward_ledger_id": {
                        "type": "string"
                    },
                    "referee_user_id": {
                        "type": "string"
                    },
                    "referral_code_id": {
                        "type": "string"
                    },
                    "referrer_reward_ledger_id": {
                        "type": "string"
                    },
                    "referrer_user_id": {
                        "type": "string"
                    },
                    "rejected_reason": {
                        "type": "string"
                    },
                    "status": {
                        "$ref": "#/components/schemas/ReferralStatus"
                    },
                    "updated_at": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "ReferralCode": {
                "properties": {
                    "code": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "owner_user_id": {
                        "type": "string"
                    },
                    "referee_reward_cents": {
                        "type": "integer"
                    },
                    "referrer_reward_cents": {
                        "type": "integer"
                    },
                    "reward_currency": {
                        "type": "string"
                    },
                    "updated_at": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "ReferralStatus": {
                "enum": [
                    "pending",
                    "qualified",
                    "rejected",
                    "expired"
                ],
                "type": "string"
            },
            "ResetPasswordRequest": {
                "properties": {
                    "password": {
                        "maxLength": 72,
                        "minLength": 8,
                        "type": "string"
                    },
                    "token": {
                        "maxLength": 128,
                        "type": "string"
                    }
                },
                "required": [
                    "password",
                    "token"
                ],
                "type": "object"
            },
            "Role": {
                "enum": [
                    "owner",
                    "admin",
                    "member",
                    "viewer"
                ],
                "type": "string"
            },
            "SetDisabledRequest": {
                "properties": {
                    "disabled": {
                        "type": "boolean"
                    }
                },
                "type": "object"
            },
            "SignUpRequest": {
                "properties": {
                    "accepted_documents": {
                        "description": "AcceptedDocuments names each current legal document (GET\n/legal/documents) and the version the person accepted. Omit it, or\nsend an empty list, while no document is published.",
                        "items": {
                            "$ref": "#/components/schemas/DocumentRef"
                        },
                        "maxItems": 10,
                        "type": "array",
                        "uniqueItems": false
                    },
                    "captcha_token": {
                        "description": "CaptchaToken is the console's Turnstile token.",
                        "maxLength": 4096,
                        "type": "string"
                    },
                    "email": {
                        "maxLength": 255,
                        "type": "string"
                    },
                    "first_name": {
                        "maxLength": 50,
                        "type": "string"
                    },
                    "last_name": {
                        "maxLength": 50,
                        "type": "string"
                    },
                    "password": {
                        "description": "Bcrypt silently truncates passwords over 72 bytes, so we cap at 72.",
                        "maxLength": 72,
                        "minLength": 8,
                        "type": "string"
                    }
                },
                "required": [
                    "email",
                    "first_name",
                    "last_name",
                    "password"
                ],
                "type": "object"
            },
            "SlackConnectResponse": {
                "properties": {
                    "authorize_url": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "SlackManagedAppStatus": {
                "properties": {
                    "agent_key": {
                        "type": "string"
                    },
                    "last_error": {
                        "type": "string"
                    },
                    "slack_app_id": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "updated_at": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "SlackStatusResponse": {
                "properties": {
                    "available": {
                        "type": "boolean"
                    },
                    "connected": {
                        "type": "boolean"
                    },
                    "connected_at": {
                        "type": "string"
                    },
                    "enterprise_id": {
                        "type": "string"
                    },
                    "has_user_token": {
                        "type": "boolean"
                    },
                    "managed_apps": {
                        "items": {
                            "$ref": "#/components/schemas/SlackManagedAppStatus"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "reconcile": {
                        "$ref": "#/components/schemas/ReconcileStatus",
                        "description": "Reconcile is what the loop last made of this integration, so\nthe console states whether a provider is still applying\nsomething or a person is being waited on."
                    },
                    "scopes": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "status": {
                        "type": "string"
                    },
                    "team_id": {
                        "type": "string"
                    },
                    "team_name": {
                        "type": "string"
                    },
                    "token_expires_at": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "Starter": {
                "enum": [
                    "software",
                    "content",
                    "operations",
                    "empty"
                ],
                "type": "string"
            },
            "StepStatus": {
                "enum": [
                    "pending",
                    "active",
                    "done",
                    "failed"
                ],
                "type": "string"
            },
            "SubscribeRequest": {
                "properties": {
                    "billing_period": {
                        "type": "string"
                    },
                    "discount_code": {
                        "type": "string"
                    },
                    "llm_mode": {
                        "type": "string"
                    },
                    "plan_code": {
                        "type": "string"
                    }
                },
                "required": [
                    "billing_period",
                    "plan_code"
                ],
                "type": "object"
            },
            "Subscription": {
                "properties": {
                    "billing_period": {
                        "$ref": "#/components/schemas/BillingPeriod"
                    },
                    "cancel_at_period_end": {
                        "type": "boolean"
                    },
                    "company_id": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "current_period_end": {
                        "type": "string"
                    },
                    "current_period_start": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "llm_mode": {
                        "$ref": "#/components/schemas/LLMMode"
                    },
                    "pending_plan": {
                        "$ref": "#/components/schemas/Plan"
                    },
                    "pending_plan_effective_at": {
                        "type": "string"
                    },
                    "pending_plan_id": {
                        "description": "The plan a mid-cycle downgrade switches to at\npending_plan_effective_at; unset when no change is queued. Upgrades\napply at once and never set it.",
                        "type": "string"
                    },
                    "plan": {
                        "$ref": "#/components/schemas/Plan"
                    },
                    "plan_id": {
                        "type": "string"
                    },
                    "status": {
                        "$ref": "#/components/schemas/SubscriptionStatus"
                    },
                    "stripe_customer_id": {
                        "type": "string"
                    },
                    "stripe_metered_event_price_id": {
                        "type": "string"
                    },
                    "stripe_metered_llm_price_id": {
                        "type": "string"
                    },
                    "stripe_price_id": {
                        "type": "string"
                    },
                    "stripe_subscription_id": {
                        "type": "string"
                    },
                    "trial_ends_at": {
                        "type": "string"
                    },
                    "updated_at": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "SubscriptionResponse": {
                "properties": {
                    "balance": {
                        "$ref": "#/components/schemas/EventBalance"
                    },
                    "plan": {
                        "$ref": "#/components/schemas/Plan"
                    },
                    "subscription": {
                        "$ref": "#/components/schemas/Subscription"
                    }
                },
                "type": "object"
            },
            "SubscriptionStatus": {
                "enum": [
                    "free",
                    "trialing",
                    "active",
                    "past_due",
                    "canceled",
                    "paused"
                ],
                "type": "string"
            },
            "SupportStatus": {
                "enum": [
                    "supported",
                    "deprecated",
                    "end_of_support",
                    "withdrawn",
                    "unknown"
                ],
                "type": "string"
            },
            "TOTPEnrollmentResponse": {
                "properties": {
                    "otpauth_uri": {
                        "type": "string"
                    },
                    "secret": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "UpdateCompanyRequest": {
                "properties": {
                    "config": {
                        "items": {
                            "type": "integer"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "name": {
                        "maxLength": 100,
                        "minLength": 1,
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "UpdateMeRequest": {
                "properties": {
                    "avatar_url": {
                        "type": "string"
                    },
                    "first_name": {
                        "maxLength": 50,
                        "minLength": 1,
                        "type": "string"
                    },
                    "last_name": {
                        "maxLength": 50,
                        "minLength": 1,
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "UpdateOperatorRoleRequest": {
                "properties": {
                    "role": {
                        "$ref": "#/components/schemas/Role",
                        "maxLength": 32
                    }
                },
                "required": [
                    "role"
                ],
                "type": "object"
            },
            "UsageEvent": {
                "properties": {
                    "byot_flag": {
                        "type": "boolean"
                    },
                    "company_id": {
                        "type": "string"
                    },
                    "conversion_rate_id": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "idempotency_key": {
                        "type": "string"
                    },
                    "ingested_at": {
                        "type": "string"
                    },
                    "ledger_entry_id": {
                        "type": "string"
                    },
                    "meter_kind": {
                        "$ref": "#/components/schemas/MeterKind"
                    },
                    "model_or_tool": {
                        "type": "string"
                    },
                    "raw_quantity": {
                        "type": "integer"
                    },
                    "recorded_at": {
                        "type": "string"
                    },
                    "run_id": {
                        "type": "string"
                    },
                    "units_charged": {
                        "type": "integer"
                    }
                },
                "type": "object"
            },
            "UsageSummary": {
                "properties": {
                    "event_count": {
                        "type": "integer"
                    },
                    "meter_kind": {
                        "$ref": "#/components/schemas/MeterKind"
                    },
                    "model_or_tool": {
                        "type": "string"
                    },
                    "raw_quantity_sum": {
                        "type": "integer"
                    },
                    "units_charged": {
                        "type": "integer"
                    }
                },
                "type": "object"
            },
            "User": {
                "properties": {
                    "avatar_url": {
                        "type": "string"
                    },
                    "company": {
                        "$ref": "#/components/schemas/Company",
                        "description": "Company that owns a machine user, loaded with the row so a user\nlisting can name it without a second query. Always nil on human\nrows."
                    },
                    "company_id": {
                        "description": "Machine users only: the company the machine belongs to and the\nadmin who created it. Unset for humans; never changes.",
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "created_by": {
                        "$ref": "#/components/schemas/User",
                        "description": "The admin who created a machine user, included in machine user\nlistings. Unset for humans."
                    },
                    "created_by_user_id": {
                        "type": "string"
                    },
                    "deleted_at": {
                        "description": "When the account was deleted. A deleted account no longer exists;\ndisabled_at instead freezes one that still does.",
                        "type": "string"
                    },
                    "description": {
                        "description": "Description is the optional free-form blurb shown next to a\nmachine user's name on the management page (e.g. \"deploy\nbot\", \"CI runner\"). Empty for humans.",
                        "maxLength": 500,
                        "type": "string"
                    },
                    "disabled_at": {
                        "description": "When the account was disabled; unset while enabled. Every credential\nit holds (sessions, personal API tokens, machine keys) is refused\nuntil it is enabled again, and none is revoked.",
                        "type": "string"
                    },
                    "email": {
                        "maxLength": 255,
                        "type": "string"
                    },
                    "first_name": {
                        "maxLength": 100,
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "is_verified": {
                        "type": "boolean"
                    },
                    "key": {
                        "$ref": "#/components/schemas/MachineOperatorKey",
                        "description": "The machine user's most recent key, revoked or expired ones included,\nin machine user listings. Unset for humans."
                    },
                    "kind": {
                        "$ref": "#/components/schemas/UserKind"
                    },
                    "last_name": {
                        "maxLength": 50,
                        "type": "string"
                    },
                    "mfa_enabled_at": {
                        "type": "string"
                    },
                    "provider": {
                        "$ref": "#/components/schemas/AuthProvider"
                    },
                    "updated_at": {
                        "type": "string"
                    }
                },
                "required": [
                    "first_name"
                ],
                "type": "object"
            },
            "UserKind": {
                "enum": [
                    "human",
                    "machine"
                ],
                "type": "string"
            },
            "Wallet": {
                "properties": {
                    "account_id": {
                        "type": "string"
                    },
                    "balance_cents": {
                        "type": "integer"
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "currency": {
                        "type": "string"
                    },
                    "frozen_reason": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "is_frozen": {
                        "type": "boolean"
                    },
                    "last_ledger_sequence": {
                        "type": "integer"
                    },
                    "updated_at": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "WalletLedgerEntry": {
                "properties": {
                    "account_id": {
                        "type": "string"
                    },
                    "balance_after": {
                        "type": "integer"
                    },
                    "company_id": {
                        "type": "string"
                    },
                    "corrects_entry_id": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "currency": {
                        "type": "string"
                    },
                    "delta_cents": {
                        "type": "integer"
                    },
                    "effective_at": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "reason": {
                        "$ref": "#/components/schemas/WalletLedgerReason"
                    },
                    "sequence": {
                        "type": "integer"
                    },
                    "source_external": {
                        "type": "string"
                    },
                    "source_kind": {
                        "$ref": "#/components/schemas/WalletLedgerSourceKind"
                    },
                    "source_ref": {
                        "type": "string"
                    },
                    "wallet_id": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "WalletLedgerReason": {
                "enum": [
                    "top_up_credit",
                    "top_up_refund",
                    "gift_card_credit",
                    "referral_credit",
                    "support_credit",
                    "support_debit",
                    "invoice_debit",
                    "invoice_refund",
                    "correction",
                    "expiry_debit",
                    "currency_writeoff"
                ],
                "type": "string"
            },
            "WalletLedgerResponse": {
                "properties": {
                    "entries": {
                        "items": {
                            "$ref": "#/components/schemas/WalletLedgerEntry"
                        },
                        "type": "array",
                        "uniqueItems": false
                    },
                    "next_before_seq": {
                        "type": "integer"
                    }
                },
                "type": "object"
            },
            "WalletLedgerSourceKind": {
                "enum": [
                    "stripe_payment_intent",
                    "stripe_charge",
                    "gift_card_redemption",
                    "referral_reward",
                    "support_action",
                    "invoice",
                    "correction"
                ],
                "type": "string"
            },
            "WorkspaceState": {
                "enum": [
                    "pending",
                    "provisioning",
                    "ready",
                    "suspended",
                    "quarantined",
                    "deleting",
                    "deleted",
                    "purged"
                ],
                "type": "string"
            },
            "WorkspaceSummary": {
                "properties": {
                    "company_id": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "display_name": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "organization_id": {
                        "type": "string"
                    },
                    "region": {
                        "description": "Region is the jurisdiction the workspace runs in, for example us.",
                        "type": "string"
                    },
                    "role": {
                        "$ref": "#/components/schemas/Role",
                        "description": "Role is the account's operator role in the company."
                    },
                    "slug": {
                        "description": "Slug is the immutable DNS form of the id.",
                        "type": "string"
                    },
                    "starter": {
                        "$ref": "#/components/schemas/Starter"
                    },
                    "state": {
                        "$ref": "#/components/schemas/WorkspaceState"
                    },
                    "trial_ends_at": {
                        "type": "string"
                    },
                    "updated_at": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "WorkspaceVersionResponse": {
                "properties": {
                    "changed_at": {
                        "type": "string"
                    },
                    "engine_version": {
                        "description": "EngineVersion is the canonical release version (major.minor.patch)\nthe engine last reported, or the engine's own string when it is not\none; empty for an image pinned by digest alone.",
                        "type": "string"
                    },
                    "observed_at": {
                        "type": "string"
                    },
                    "support_status": {
                        "$ref": "#/components/schemas/SupportStatus"
                    }
                },
                "type": "object"
            }
        },
        "securitySchemes": {
            "BearerAuth": {
                "description": "JWT access token. Format: \"Bearer {token}\".",
                "in": "header",
                "name": "Authorization",
                "type": "apiKey"
            }
        }
    },
    "info": {
        "description": "The Crewlet API gives you programmatic access to your workspaces.\n\n## Authentication\n\nAll requests require an `Authorization: Bearer \u003ctoken\u003e` header. Three\ncredential types are accepted, distinguished by the token's first\nsegment:\n\n| Token                | Format   |\n|----------------------|----------|\n| JWT                  | `eyJ…`   |\n| Personal API Token   | `clu_…`  |\n| Machine Operator Key | `clm_…`  |\n\n### JWT\n\nIssued by `POST /auth/login`, `POST /auth/signup`, and the OAuth\nexchange. Access tokens are short-lived; exchange the refresh token\nvia `POST /auth/refresh` for a new one. `POST /auth/logout` revokes\nthe refresh token immediately.\n\n### Personal API Tokens (PATs)\n\nLong-lived credentials bound to your user account, created via\n`POST /user/me/api-tokens` and optionally scoped to specific\ncompanies or permissions. The cleartext is returned only once.\n\n### Machine Operator Keys\n\nLong-lived credentials bound to a machine operator (a non-human\nteammate that lives in one company). Removing the machine, or\nchanging its role, applies to every key it holds immediately.\n\n## Errors\n\nErrors return JSON in the form\n`{ \"error\": \"\u003cmessage\u003e\", \"code\": \"\u003ccode\u003e\", \"details\": \"\u003cdetail\u003e\" }`.\n`code` is a stable identifier, present on errors a client may branch on\n(for example `discount_invalid`); `details` is optional.\n\n| Status | Meaning                                          |\n|--------|--------------------------------------------------|\n| `400`  | Malformed request body                           |\n| `401`  | Missing or invalid credentials                   |\n| `403`  | Authenticated, but not permitted                 |\n| `404`  | Resource doesn't exist or isn't visible to you   |\n| `409`  | Conflict (e.g. an account with that email exists)|\n| `422`  | Validation failed; see `details`                 |\n| `5xx`  | Server error                                     |\n\nTwo codes carry legal documents as `{kind, version, url}`:\n`documents_not_accepted` (`400`) lists the current ones in `documents`,\nand `documents_pending` (`403`) lists the ones to accept in `pending`.\n\n## Legal documents\n\n`GET /legal/documents` lists the terms, privacy policy and acceptable\nuse policy every account accepts, at their current versions; it is an\nempty list until they are published. Sign-up names each in\n`accepted_documents`. When a new version is published, a signed-in\naccount that has not accepted it gets `403` with code\n`documents_pending` on every request except `GET /user/me` (which lists\nthem in `pending_documents`) and `/user/me/legal-acceptances`, where it\naccepts them. Personal API Tokens and Machine Operator Keys are not\nrefused.\n\n## Conventions\n\n- JSON keys use `snake_case`.\n- Timestamps are RFC 3339 in UTC.\n- Resource IDs are UUIDs.\n- Every response includes an `X-Request-ID` header. Include it when\n  contacting support.\n",
        "title": "Crewlet API",
        "version": "0.1.0"
    },
    "openapi": "3.1.0",
    "paths": {
        "/accounts/{account_id}/wallet": {
            "get": {
                "parameters": [
                    {
                        "description": "Account ID (the caller's user ID)",
                        "in": "path",
                        "name": "account_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Wallet"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Get the account's wallet",
                "tags": [
                    "wallet"
                ]
            }
        },
        "/accounts/{account_id}/wallet/ledger": {
            "get": {
                "parameters": [
                    {
                        "description": "Account ID (the caller's user ID)",
                        "in": "path",
                        "name": "account_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Return entries before this sequence (next_before_seq of the previous page)",
                        "in": "query",
                        "name": "before_seq",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "description": "Entries to return (default 100)",
                        "in": "query",
                        "name": "limit",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WalletLedgerResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "List the account's wallet ledger, newest first",
                "tags": [
                    "wallet"
                ]
            }
        },
        "/accounts/{account_id}/wallet/redemptions/gift_card": {
            "post": {
                "parameters": [
                    {
                        "description": "Account ID (the caller's user ID)",
                        "in": "path",
                        "name": "account_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/GiftCardRedeemRequest",
                                "description": "Gift card code",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Gift card code",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "additionalProperties": {},
                                    "type": "object"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Redeem a gift card into the account's wallet",
                "tags": [
                    "wallet"
                ]
            }
        },
        "/auth/email/resend": {
            "post": {
                "description": "422 with code email_undeliverable when the address bounced or reported mail as spam before, so no mail is sent to it. 503 with code mail_unavailable when mail cannot be sent right now.",
                "responses": {
                    "202": {
                        "description": "Accepted"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "422": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unprocessable Entity"
                    },
                    "429": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Too Many Requests"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Mail a new verification link to the signed-in account",
                "tags": [
                    "auth"
                ]
            }
        },
        "/auth/email/verify": {
            "post": {
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/EmailTokenRequest",
                                "description": "Token from the link",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Token from the link",
                    "required": true
                },
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "429": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Too Many Requests"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "summary": "Confirm an email address from a mailed link",
                "tags": [
                    "auth"
                ]
            }
        },
        "/auth/github": {
            "get": {
                "responses": {
                    "302": {
                        "description": "Found"
                    },
                    "503": {
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "summary": "Begin a GitHub OAuth sign-in",
                "tags": [
                    "auth"
                ]
            }
        },
        "/auth/github/callback": {
            "get": {
                "parameters": [
                    {
                        "description": "Authorization code from GitHub",
                        "in": "query",
                        "name": "code",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "CSRF state echoed from BeginGitHub",
                        "in": "query",
                        "name": "state",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "302": {
                        "description": "Found"
                    },
                    "400": {
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "403": {
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden"
                    },
                    "409": {
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    }
                },
                "summary": "GitHub OAuth redirect target",
                "tags": [
                    "auth"
                ]
            }
        },
        "/auth/google": {
            "get": {
                "responses": {
                    "302": {
                        "description": "Found"
                    },
                    "503": {
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "summary": "Begin a Google OAuth sign-in",
                "tags": [
                    "auth"
                ]
            }
        },
        "/auth/google/callback": {
            "get": {
                "parameters": [
                    {
                        "description": "Authorization code from Google",
                        "in": "query",
                        "name": "code",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "CSRF state echoed from BeginGoogle",
                        "in": "query",
                        "name": "state",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "302": {
                        "description": "Found"
                    },
                    "400": {
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "403": {
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden"
                    },
                    "409": {
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    }
                },
                "summary": "Google OAuth redirect target",
                "tags": [
                    "auth"
                ]
            }
        },
        "/auth/login": {
            "post": {
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/LoginRequest",
                                "description": "Email and password",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Email and password",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AuthResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "202": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/MFAChallengeResponse"
                                }
                            }
                        },
                        "description": "Password checked out; finish with POST /auth/mfa/verify"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden"
                    },
                    "429": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Too Many Requests"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "summary": "Authenticate a user and return tokens",
                "tags": [
                    "auth"
                ]
            }
        },
        "/auth/logout": {
            "post": {
                "description": "Revokes the session in the httpOnly cookie and clears it. Requires the session's CSRF token in X-CSRF-Token and an allowed console origin.",
                "parameters": [
                    {
                        "description": "The csrf_token issued with the session",
                        "in": "header",
                        "name": "X-CSRF-Token",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "summary": "End the session",
                "tags": [
                    "auth"
                ]
            }
        },
        "/auth/mfa/verify": {
            "post": {
                "description": "Takes the ticket from a sign-in that answered mfa_required and a one-time or recovery code, and starts the session. The request must come from an allowed console origin.",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/MFAVerifyRequest",
                                "description": "Ticket and code",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Ticket and code",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AuthResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden"
                    },
                    "429": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Too Many Requests"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "summary": "Finish a sign-in with a second factor",
                "tags": [
                    "auth"
                ]
            }
        },
        "/auth/oauth/exchange": {
            "post": {
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/OAuthExchangeRequest",
                                "description": "One-time code from the OAuth callback redirect",
                                "summary": "payload"
                            }
                        }
                    },
                    "description": "One-time code from the OAuth callback redirect",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AuthResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "202": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/MFAChallengeResponse"
                                }
                            }
                        },
                        "description": "Finish with POST /auth/mfa/verify"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden"
                    },
                    "429": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Too Many Requests"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "summary": "Trade a one-time OAuth code for tokens",
                "tags": [
                    "auth"
                ]
            }
        },
        "/auth/password/forgot": {
            "post": {
                "description": "Always answers 202, whether or not the email belongs to an account.",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ForgotPasswordRequest",
                                "description": "Account email",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Account email",
                    "required": true
                },
                "responses": {
                    "202": {
                        "description": "Accepted"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "429": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Too Many Requests"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "summary": "Mail a password reset link",
                "tags": [
                    "auth"
                ]
            }
        },
        "/auth/password/reset": {
            "post": {
                "description": "Signs the account out of every session.",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ResetPasswordRequest",
                                "description": "Token and new password",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Token and new password",
                    "required": true
                },
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "429": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Too Many Requests"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "summary": "Set a new password from a mailed link",
                "tags": [
                    "auth"
                ]
            }
        },
        "/auth/refresh": {
            "post": {
                "description": "Reads the httpOnly session cookie, rotates it and returns new access and CSRF tokens. The request must come from an allowed console origin. A refresh token used before revokes the whole session.",
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AuthResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden"
                    },
                    "429": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Too Many Requests"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "summary": "Rotate the session and get a new access token",
                "tags": [
                    "auth"
                ]
            }
        },
        "/auth/signup": {
            "post": {
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SignUpRequest",
                                "description": "Credentials and profile fields",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Credentials and profile fields",
                    "required": true
                },
                "responses": {
                    "201": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AuthResponse"
                                }
                            }
                        },
                        "description": "Created"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "An invalid request; code documents_not_accepted when accepted_documents does not name every current document at its current version (documents then lists them), captcha_failed when the human check does not pass, email_domain_not_accepted for a throwaway email domain"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Code account_exists: an account exists for this address, or for another alias of the same mailbox"
                    },
                    "429": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Too Many Requests"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Code captcha_unavailable: the human check could not be asked; try again"
                    }
                },
                "summary": "Create a new user account",
                "tags": [
                    "auth"
                ]
            }
        },
        "/billing/plans": {
            "get": {
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/Plan"
                                    },
                                    "type": "array"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "summary": "List public subscription plans",
                "tags": [
                    "billing"
                ]
            }
        },
        "/companies": {
            "get": {
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/Company"
                                    },
                                    "type": "array"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "List companies the authenticated user is an operator of",
                "tags": [
                    "company"
                ]
            }
        },
        "/companies/{id}": {
            "delete": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/MessageResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Soft-delete a company",
                "tags": [
                    "company"
                ]
            },
            "get": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Company"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Get a company by ID",
                "tags": [
                    "company"
                ]
            },
            "patch": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/UpdateCompanyRequest",
                                "description": "Fields to update",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Fields to update",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Company"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "422": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unprocessable Entity"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Update a company's name and/or config",
                "tags": [
                    "company"
                ]
            }
        },
        "/companies/{id}/activity": {
            "get": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "RFC3339 start of window (defaults to now - plan retention)",
                        "in": "query",
                        "name": "from",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "RFC3339 end of window (defaults to now)",
                        "in": "query",
                        "name": "to",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Filter by event type (repeatable)",
                        "in": "query",
                        "name": "event_type",
                        "schema": {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        }
                    },
                    {
                        "description": "Filter by outcome",
                        "in": "query",
                        "name": "outcome",
                        "schema": {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        }
                    },
                    {
                        "description": "Filter by actor user UUID",
                        "in": "query",
                        "name": "actor_user_id",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Filter by target kind (paired with target_id)",
                        "in": "query",
                        "name": "target_kind",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Filter by target UUID (paired with target_kind)",
                        "in": "query",
                        "name": "target_id",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Free-text search",
                        "in": "query",
                        "name": "q",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Opaque pagination cursor",
                        "in": "query",
                        "name": "cursor",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Page size (default 50, max 200)",
                        "in": "query",
                        "name": "limit",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AuditListResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "List the activity feed for a company",
                "tags": [
                    "audit"
                ]
            }
        },
        "/companies/{id}/activity/summary": {
            "get": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "RFC3339 start (defaults to now - 30d)",
                        "in": "query",
                        "name": "from",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "RFC3339 end (defaults to now)",
                        "in": "query",
                        "name": "to",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Filter by event type (repeatable)",
                        "in": "query",
                        "name": "event_type",
                        "schema": {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AuditSummaryResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Daily summary aggregate for a company's activity",
                "tags": [
                    "audit"
                ]
            }
        },
        "/companies/{id}/billing/audit": {
            "get": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "RFC3339 start (inclusive)",
                        "in": "query",
                        "name": "from",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "RFC3339 end (exclusive)",
                        "in": "query",
                        "name": "to",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Filter to a specific event type",
                        "in": "query",
                        "name": "event_type",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Events to return (max 1000)",
                        "in": "query",
                        "name": "limit",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "description": "Return rows with sequence \u003c this value (pagination)",
                        "in": "query",
                        "name": "before_seq",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/BillingAuditEvent"
                                    },
                                    "type": "array"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "List billing audit events for the company",
                "tags": [
                    "billing"
                ]
            }
        },
        "/companies/{id}/billing/balance": {
            "get": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Ledger entries to return (max 100)",
                        "in": "query",
                        "name": "limit",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BalanceResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Get the company's credit balance with a recent ledger window",
                "tags": [
                    "billing"
                ]
            }
        },
        "/companies/{id}/billing/cancel": {
            "post": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CancelRequest",
                                "description": "Optional reason",
                                "summary": "payload"
                            }
                        }
                    },
                    "description": "Optional reason"
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Subscription"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Schedule subscription cancellation at period end",
                "tags": [
                    "billing"
                ]
            }
        },
        "/companies/{id}/billing/change-plan": {
            "post": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ChangePlanRequest",
                                "description": "Target plan",
                                "summary": "payload"
                            }
                        }
                    },
                    "description": "Target plan",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Subscription"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "402": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/InsufficientWalletResponse"
                                }
                            }
                        },
                        "description": "Payment Required"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Change the company's subscription plan",
                "tags": [
                    "billing"
                ]
            }
        },
        "/companies/{id}/billing/reactivate": {
            "post": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Subscription"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Undo a scheduled subscription cancellation",
                "tags": [
                    "billing"
                ]
            }
        },
        "/companies/{id}/billing/subscription": {
            "get": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SubscriptionResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Get the company's active subscription",
                "tags": [
                    "billing"
                ]
            },
            "post": {
                "description": "Starts the company's subscription; the first period is paid from the owner's wallet. A body with any field not listed here is refused.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SubscribeRequest",
                                "description": "Plan, billing period, LLM mode and discount code",
                                "summary": "payload"
                            }
                        }
                    },
                    "description": "Plan, billing period, LLM mode and discount code",
                    "required": true
                },
                "responses": {
                    "201": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Subscription"
                                }
                            }
                        },
                        "description": "Created"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "402": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/InsufficientWalletResponse"
                                }
                            }
                        },
                        "description": "Payment Required"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Subscribe the company to a public plan",
                "tags": [
                    "billing"
                ]
            }
        },
        "/companies/{id}/billing/usage": {
            "get": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "RFC3339 start (inclusive)",
                        "in": "query",
                        "name": "from",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "RFC3339 end (exclusive)",
                        "in": "query",
                        "name": "to",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/UsageSummary"
                                    },
                                    "type": "array"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Aggregated usage for a date range",
                "tags": [
                    "billing"
                ]
            }
        },
        "/companies/{id}/billing/usage/history": {
            "get": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "RFC3339 start (inclusive)",
                        "in": "query",
                        "name": "from",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "RFC3339 end (exclusive)",
                        "in": "query",
                        "name": "to",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Events to return (max 1000)",
                        "in": "query",
                        "name": "limit",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/UsageEvent"
                                    },
                                    "type": "array"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Raw usage events for a date range",
                "tags": [
                    "billing"
                ]
            }
        },
        "/companies/{id}/integrations/atlassian": {
            "delete": {
                "description": "Removes the stored organization credential and Crewlet's record of the service accounts. The accounts themselves are left in place, because they own issues and appear in history.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Also remove the identities Crewlet provisioned in the provider. Defaults to false, which leaves them in place.",
                        "in": "query",
                        "name": "remove_agents",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        },
                        "description": "Accepted"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Disconnect the company's Atlassian organization",
                "tags": [
                    "integrations"
                ]
            },
            "get": {
                "description": "Returns the organization identity and every agent's service account, including which are still waiting for an API token and what each one may actually do in the projects it works in.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AtlassianStatusResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Get the company's Atlassian connection",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/companies/{id}/integrations/atlassian/connect": {
            "post": {
                "description": "Stores the organization API key Crewlet provisions per-agent service accounts with, after proving it authenticates. Reconnecting replaces the stored credential in place.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/AtlassianConnectRequest",
                                "description": "Organization credential",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Organization credential",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AtlassianStatusResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Connect the company's Atlassian organization",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/companies/{id}/integrations/atlassian/credentials": {
            "post": {
                "description": "Accepts an API token an operator created for one agent's service account, proves it authenticates as that account, and seals it. This is a fallback: a sync mints each agent's token itself, so this is only needed when minting failed or the agent should use a credential a human made.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/AtlassianAdoptRequest",
                                "description": "Agent credential",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Agent credential",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AtlassianStatusResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Store an agent's Atlassian API token",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/companies/{id}/integrations/atlassian/sync": {
            "post": {
                "description": "Creates one service account per Atlassian-enabled agent, adopts any the organization already had whose display name matches, mints each one's API token scoped to the products it works in, grants product access per product, and places it in the projects and spaces its org chart names. Removes the accounts of agents that left the chart. An agent's account and credential are shared across Jira and Confluence; only the seat and the permissions differ. Each outcome reports what the agent may actually do in each project or space, as the product itself reports it: missing names contract permissions it did not get, and excess names administrative or destructive permissions the tenant's own permission scheme granted on top, which Crewlet reports but cannot revoke. An outcome carrying needs_token means minting failed for that agent; placement_error on the result means the Crewlet app is not installed, so no agent could be placed.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        },
                        "description": "Accepted"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Provision Atlassian service accounts for the company's agents",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/companies/{id}/integrations/datadog": {
            "delete": {
                "description": "Disables every agent service account Crewlet created, then removes the stored credentials and Crewlet's record of the accounts. Disabling rather than deleting keeps what the agents built attributable, and stops keys Crewlet is about to forget from still working.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Also remove the identities Crewlet provisioned in the provider. Defaults to false, which leaves them in place.",
                        "in": "query",
                        "name": "remove_agents",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        },
                        "description": "Accepted"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Disconnect the company's Datadog organization",
                "tags": [
                    "integrations"
                ]
            },
            "get": {
                "description": "Returns the organization identity and every agent's service account, including what each one may actually do as Datadog reports it.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/DatadogStatusResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Get the company's Datadog connection",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/companies/{id}/integrations/datadog/connect": {
            "post": {
                "description": "Stores the API key and application key Crewlet provisions per-agent service accounts with, after proving they authenticate and reporting which organization they belong to. Reconnecting replaces the stored credentials in place.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/DatadogConnectRequest",
                                "description": "Organization credentials",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Organization credentials",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/DatadogStatusResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Connect the company's Datadog organization",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/companies/{id}/integrations/datadog/sync": {
            "post": {
                "description": "Creates one Datadog service account per enabled agent, adopts any the organization already had that Crewlet made earlier, gives each the role carrying the agent contract, and creates the application key the agent acts with. Removes the accounts of agents that left the org chart. Each outcome reports what the agent may actually do, as Datadog itself reports it: missing names contract permissions it did not get, and excess names administrative or destructive permissions another of the tenant's roles granted on top, which Crewlet reports but cannot revoke. Agents that already hold exactly the right access are skipped, so a pass over an unchanged company costs no requests.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        },
                        "description": "Accepted"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Provision Datadog service accounts for the company's agents",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/companies/{id}/integrations/github": {
            "delete": {
                "description": "Forgets the installation and every agent's access. The app itself is left installed, because uninstalling is the tenant's to do from GitHub. No credential outlives this: tokens are minted per request and cannot be minted without a row.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Also remove the identities Crewlet provisioned in the provider. Defaults to false, which leaves them in place.",
                        "in": "query",
                        "name": "remove_agents",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        },
                        "description": "Accepted"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Disconnect the company's GitHub installation",
                "tags": [
                    "integrations"
                ]
            },
            "get": {
                "description": "Returns the account the app is installed on, what the installation grants, and every agent's repositories and tier with what its token actually carries. The installation is re-read from GitHub on every call, because the tenant can change it at any time.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/GitHubStatusResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Get the company's GitHub installation",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/companies/{id}/integrations/github/connect": {
            "post": {
                "description": "Stores the installation GitHub redirected back with, after reading it back from GitHub to learn what the tenant actually granted. No credential is accepted or stored: agent tokens are minted from the app's own key and expire within the hour.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/GitHubConnectRequest",
                                "description": "Installation",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Installation",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/GitHubStatusResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Record the company's GitHub App installation",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/companies/{id}/integrations/github/dedicated/install": {
            "post": {
                "description": "Called after somebody installs an agent's app on the account that holds the repositories. The installation is read back from GitHub rather than trusted, because the ID arrives on a redirect. Until this completes the agent holds no credential and cannot act: there is no shared identity to fall back to.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/GitHubDedicatedInstallRequest",
                                "description": "Agent and its installation",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Agent and its installation",
                    "required": true
                },
                "responses": {
                    "204": {
                        "description": "Recorded"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Record an agent's own app as installed",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/companies/{id}/integrations/github/dedicated/manifest": {
            "post": {
                "description": "Returns the GitHub App manifest for one agent, plus the URL to POST it to. Every agent acts under its own app, so this is how one is registered: GitHub has no API that creates an app, and a person has to confirm the registration in a browser. The manifest is scoped to the account the installation belongs to, so an organization install registers the app on the organization rather than on the person confirming it.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/GitHubManifestRequest",
                                "description": "Agent to give an identity",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Agent to give an identity",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ManifestStart"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Start giving an agent its own GitHub identity",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/companies/{id}/integrations/github/sync": {
            "post": {
                "description": "Records which repositories and tier each agent should have, then proves it by minting that agent's token and reading back what GitHub granted. Nothing is created upstream: there is no account to make, and isolation comes from what each token can reach. Reports repositories the installation does not cover, permissions it cannot provide, and any it holds beyond what agents ever ask for.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        },
                        "description": "Accepted"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Bring the company's GitHub access in line with its org chart",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/companies/{id}/integrations/gitlab": {
            "delete": {
                "description": "Removes the stored token. Optionally deletes the service accounts Crewlet created in the group, which is what actually ends their access; without it they are kept so a reconnect can adopt them.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Also remove the identities Crewlet provisioned in the group. Defaults to false, which leaves them in place.",
                        "in": "query",
                        "name": "remove_agents",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        },
                        "description": "Accepted"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Disconnect the company's GitLab group",
                "tags": [
                    "integrations"
                ]
            },
            "get": {
                "description": "Returns the group identity and every agent's service account, including the standing each one holds per project as GitLab reports it.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/GitLabStatusResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Get the company's GitLab connection",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/companies/{id}/integrations/gitlab/connect": {
            "post": {
                "description": "Stores the group token Crewlet provisions per-agent service accounts with, after proving it owns the group. Reconnecting replaces the stored token in place and adopts the identities already there.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/GitLabConnectRequest",
                                "description": "Group credential",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Group credential",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/GitLabStatusResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Connect the company's GitLab group",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/companies/{id}/integrations/gitlab/sync": {
            "post": {
                "description": "Books a reconcile pass. Accounts are created, adopted, granted their seats, or removed by the loop, which is the only thing that reconciles a company.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        },
                        "description": "Accepted"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Bring the company's GitLab accounts in line with its org chart",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/companies/{id}/integrations/slack": {
            "delete": {
                "description": "Revokes the stored authorization with Slack and removes the installation and its managed-app records.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Also remove the identities Crewlet provisioned in the provider. Defaults to false, which leaves them in place.",
                        "in": "query",
                        "name": "remove_agents",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/MessageResponse"
                                }
                            }
                        },
                        "description": "Accepted"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Disconnect the company's Slack workspace",
                "tags": [
                    "integrations"
                ]
            },
            "get": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SlackStatusResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Get the company's Slack connection status",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/companies/{id}/integrations/slack/connect": {
            "post": {
                "description": "Returns the Slack authorize URL for the Crewlet manager app, carrying a single-use state bound to this company and operator. The frontend navigates the browser to the returned URL; Slack redirects back to the global callback, which consumes the state to bind the grant.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SlackConnectResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Begin connecting the company's Slack workspace",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/companies/{id}/integrations/slack/sync": {
            "post": {
                "description": "Brings the company's Slack app fleet in line with its org configuration: creates an app per Slack-enabled agent, updates and reinstalls apps whose manifest changed, and deletes apps for agents that are gone. Idempotent and safe to re-run; one agent's failure does not stop the others.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        },
                        "description": "Accepted"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Provision the company's agents into Slack",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/companies/{id}/logo": {
            "delete": {
                "description": "Clears the company's logo_url and deletes the stored object.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Company"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Delete a company logo",
                "tags": [
                    "company"
                ]
            },
            "post": {
                "description": "Accepts a multipart form with a single \"file\" field (JPEG, PNG, or WebP). The image is re-encoded to a 512px JPEG (stripping metadata), stored in object storage, and the company's logo_url is updated. A previous logo is deleted.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "properties": {
                                    "file": {
                                        "description": "Image file to upload",
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "file"
                                ],
                                "type": "object"
                            }
                        }
                    },
                    "description": "Image file to upload",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Company"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "413": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Request Entity Too Large"
                    },
                    "415": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unsupported Media Type"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Upload a company logo",
                "tags": [
                    "company"
                ]
            }
        },
        "/companies/{id}/operators": {
            "get": {
                "description": "Every caller gets each operator's name, email and role. A caller with operators:write (owners and admins) also gets the operator record and the full user, including whether two-factor authentication is on.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/OperatorListItem"
                                    },
                                    "type": "array"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "List operators of a company",
                "tags": [
                    "operators"
                ]
            },
            "post": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/AddOperatorRequest",
                                "description": "User to add and target role",
                                "summary": "payload"
                            }
                        }
                    },
                    "description": "User to add and target role",
                    "required": true
                },
                "responses": {
                    "201": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CompanyOperator"
                                }
                            }
                        },
                        "description": "Created"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Add a user to a company at a given role",
                "tags": [
                    "operators"
                ]
            }
        },
        "/companies/{id}/operators/machines": {
            "get": {
                "description": "Returns every machine user of the company, including machines\nnot yet added as operators. Every caller gets each machine's\nname and role (omitted until it is an operator); a caller with\noperators:write (owners and admins) also gets the user record\nwith its creator and latest key. Roles are managed through the\n/operators endpoints.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/MachineListItem"
                                    },
                                    "type": "array"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "List the machine users of a company",
                "tags": [
                    "machine_operators"
                ]
            },
            "post": {
                "description": "Creates the machine user and its first key in one step. The\nmachine has no permissions until an admin adds it with POST\n/operators at a chosen role. Returns the cleartext `token`\nonce.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CreateMachineOperatorRequest",
                                "description": "Machine name + optional description",
                                "summary": "payload"
                            }
                        }
                    },
                    "description": "Machine name + optional description",
                    "required": true
                },
                "responses": {
                    "201": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CreatedMachineOperatorResponse"
                                }
                            }
                        },
                        "description": "Created"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Provision a machine user (identity + first key)",
                "tags": [
                    "machine_operators"
                ]
            }
        },
        "/companies/{id}/operators/{user_id}": {
            "delete": {
                "description": "Caller must hold operators:write OR be removing themselves.\nThe owner cannot be removed; transfer ownership first.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "User ID to remove",
                        "in": "path",
                        "name": "user_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/MessageResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Remove an operator from a company",
                "tags": [
                    "operators"
                ]
            },
            "patch": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Target user ID",
                        "in": "path",
                        "name": "user_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/UpdateOperatorRoleRequest",
                                "description": "New role",
                                "summary": "payload"
                            }
                        }
                    },
                    "description": "New role",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CompanyOperator"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Change an operator's role",
                "tags": [
                    "operators"
                ]
            }
        },
        "/companies/{id}/operators/{user_id}/disabled": {
            "patch": {
                "description": "Setting `disabled=true` refuses every credential the user\nholds (sessions, personal API tokens, machine keys) until\n`disabled=false` is sent. The owner cannot be disabled\n(transfer ownership first) and you cannot disable your own\naccount.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Target user ID",
                        "in": "path",
                        "name": "user_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SetDisabledRequest",
                                "description": "New disabled state",
                                "summary": "payload"
                            }
                        }
                    },
                    "description": "New disabled state",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/User"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Disable or re-enable an operator's user account",
                "tags": [
                    "operators"
                ]
            }
        },
        "/companies/{id}/operators/{user_id}/keys": {
            "get": {
                "description": "Includes revoked + expired keys for audit.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Machine user ID",
                        "in": "path",
                        "name": "user_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/MachineOperatorKey"
                                    },
                                    "type": "array"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "List a machine operator's keys",
                "tags": [
                    "machine_operators"
                ]
            },
            "post": {
                "description": "The cleartext `token` is returned ONCE.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Machine user ID",
                        "in": "path",
                        "name": "user_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CreateKeyRequest",
                                "description": "Key metadata",
                                "summary": "payload"
                            }
                        }
                    },
                    "description": "Key metadata",
                    "required": true
                },
                "responses": {
                    "201": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CreatedKeyResponse"
                                }
                            }
                        },
                        "description": "Created"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Mint an additional key for an existing machine operator",
                "tags": [
                    "machine_operators"
                ]
            }
        },
        "/companies/{id}/operators/{user_id}/keys/{key_id}": {
            "delete": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Machine user ID",
                        "in": "path",
                        "name": "user_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Key ID",
                        "in": "path",
                        "name": "key_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/MessageResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Revoke one of the machine's keys (idempotent)",
                "tags": [
                    "machine_operators"
                ]
            }
        },
        "/companies/{id}/operators/{user_id}/keys/{key_id}/rotate": {
            "post": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Machine user ID",
                        "in": "path",
                        "name": "user_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Key ID to rotate",
                        "in": "path",
                        "name": "key_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CreatedKeyResponse"
                                }
                            }
                        },
                        "description": "Created"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Mint a replacement of one of the machine's keys",
                "tags": [
                    "machine_operators"
                ]
            }
        },
        "/companies/{id}/operators/{user_id}/transfer-ownership": {
            "post": {
                "description": "The caller must currently be the owner. The target must\nalready be an operator of the company. The caller is\ndemoted to admin atomically.",
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "New owner user ID",
                        "in": "path",
                        "name": "user_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/MessageResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Transfer company ownership to another operator",
                "tags": [
                    "operators"
                ]
            }
        },
        "/companies/{id}/quotas": {
            "get": {
                "parameters": [
                    {
                        "description": "Company ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/EffectiveQuota"
                                    },
                                    "type": "array"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "List effective quotas for a company",
                "tags": [
                    "quota"
                ]
            }
        },
        "/discount/preview": {
            "post": {
                "description": "A code that cannot apply answers 400 with `code` set to discount_invalid, discount_ineligible or discount_exhausted.",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/PreviewRequest",
                                "description": "Code, plan and billing period",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Code, plan and billing period",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PreviewResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Preview a discount code against a plan and billing period",
                "tags": [
                    "billing"
                ]
            }
        },
        "/integrations/github/manifest/callback": {
            "get": {
                "description": "Where GitHub returns the browser after somebody confirms an agent's app. The temporary code is exchanged for the app's ID and private key, which is sealed before it is stored. Unauthenticated by design: the browser arrives here from GitHub, and the sealed state carries the company and agent it belongs to. Always redirects to the console rather than returning a body.",
                "parameters": [
                    {
                        "description": "Temporary code from GitHub",
                        "in": "query",
                        "name": "code",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Sealed state issued when the flow began",
                        "in": "query",
                        "name": "state",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "302": {
                        "description": "Redirects to the console with an error"
                    }
                },
                "summary": "Complete a dedicated GitHub App registration",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/integrations/slack/callback": {
            "get": {
                "parameters": [
                    {
                        "description": "Authorization code from Slack",
                        "in": "query",
                        "name": "code",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "CSRF state echoed from Connect",
                        "in": "query",
                        "name": "state",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Slack-reported error (consent denied)",
                        "in": "query",
                        "name": "error",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "302": {
                        "description": "Found"
                    },
                    "400": {
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "403": {
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden"
                    },
                    "503": {
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "summary": "Slack OAuth redirect target for the manager app",
                "tags": [
                    "integrations"
                ]
            }
        },
        "/legal/documents": {
            "get": {
                "description": "An empty array while no document is published.",
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/Document"
                                    },
                                    "type": "array"
                                }
                            }
                        },
                        "description": "OK"
                    }
                },
                "summary": "The legal documents every account accepts, at their current versions",
                "tags": [
                    "legal"
                ]
            }
        },
        "/organizations": {
            "get": {
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/MemberOrganization"
                                    },
                                    "type": "array"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "List the organizations the authenticated user belongs to",
                "tags": [
                    "organization"
                ]
            },
            "post": {
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CreateOrganizationRequest",
                                "description": "Organization",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Organization",
                    "required": true
                },
                "responses": {
                    "201": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/MemberOrganization"
                                }
                            }
                        },
                        "description": "Created"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Create an organization owned by the authenticated user",
                "tags": [
                    "organization"
                ]
            }
        },
        "/organizations/{org_id}": {
            "get": {
                "parameters": [
                    {
                        "description": "Organization ID",
                        "in": "path",
                        "name": "org_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/MemberOrganization"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Get an organization the authenticated user belongs to",
                "tags": [
                    "organization"
                ]
            }
        },
        "/organizations/{org_id}/members": {
            "get": {
                "parameters": [
                    {
                        "description": "Organization ID",
                        "in": "path",
                        "name": "org_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/OrganizationMember"
                                    },
                                    "type": "array"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "List the members of an organization the authenticated user belongs to",
                "tags": [
                    "organization"
                ]
            }
        },
        "/organizations/{org_id}/workspaces": {
            "post": {
                "description": "Creates the company and its workspace, which provisions in the background. The caller must be an owner or admin of the organization.",
                "parameters": [
                    {
                        "description": "Organization ID",
                        "in": "path",
                        "name": "org_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CreateWorkspaceRequest",
                                "description": "Workspace",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Workspace",
                    "required": true
                },
                "responses": {
                    "202": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WorkspaceSummary"
                                }
                            }
                        },
                        "description": "Accepted"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "402": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/InsufficientWalletResponse"
                                }
                            }
                        },
                        "description": "Payment Required"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "422": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unprocessable Entity"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Create a workspace in an organization",
                "tags": [
                    "workspace"
                ]
            }
        },
        "/plans": {
            "get": {
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/Plan"
                                    },
                                    "type": "array"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "summary": "List subscription plans",
                "tags": [
                    "plan"
                ]
            }
        },
        "/plans/{id}": {
            "get": {
                "parameters": [
                    {
                        "description": "Plan ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Plan"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "summary": "Get a plan by ID",
                "tags": [
                    "plan"
                ]
            }
        },
        "/user/me": {
            "get": {
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/MeResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Get the authenticated user",
                "tags": [
                    "user"
                ]
            },
            "patch": {
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/UpdateMeRequest",
                                "description": "Fields to update",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Fields to update",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/User"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Update the authenticated user",
                "tags": [
                    "user"
                ]
            }
        },
        "/user/me/activity": {
            "get": {
                "parameters": [
                    {
                        "description": "RFC3339 start (defaults to now - 90d)",
                        "in": "query",
                        "name": "from",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "RFC3339 end (defaults to now)",
                        "in": "query",
                        "name": "to",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Filter by event type (repeatable)",
                        "in": "query",
                        "name": "event_type",
                        "schema": {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        }
                    },
                    {
                        "description": "Opaque pagination cursor",
                        "in": "query",
                        "name": "cursor",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "description": "Page size (default 50, max 200)",
                        "in": "query",
                        "name": "limit",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AuditListResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "List the activity feed for the calling user (self-audit)",
                "tags": [
                    "audit"
                ]
            }
        },
        "/user/me/api-tokens": {
            "get": {
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/PersonalAPIToken"
                                    },
                                    "type": "array"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "List the caller's personal API tokens",
                "tags": [
                    "api_tokens"
                ]
            },
            "post": {
                "description": "The cleartext `token` field is returned ONCE; persist it now or rotate later.\nOptional `allowed_company_ids` and `allowed_permissions` attenuate the token's reach below the caller's full role.",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CreatePATRequest",
                                "description": "Token metadata + scope",
                                "summary": "payload"
                            }
                        }
                    },
                    "description": "Token metadata + scope",
                    "required": true
                },
                "responses": {
                    "201": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CreatedPATResponse"
                                }
                            }
                        },
                        "description": "Created"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Mint a new personal API token",
                "tags": [
                    "api_tokens"
                ]
            }
        },
        "/user/me/api-tokens/{id}": {
            "delete": {
                "parameters": [
                    {
                        "description": "Token ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/MessageResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Revoke a personal API token (idempotent)",
                "tags": [
                    "api_tokens"
                ]
            }
        },
        "/user/me/api-tokens/{id}/rotate": {
            "post": {
                "description": "Caller can only rotate their OWN tokens. Scope (companies, permissions) is preserved.\nThe old token remains valid until explicitly revoked.",
                "parameters": [
                    {
                        "description": "Token ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CreatedPATResponse"
                                }
                            }
                        },
                        "description": "Created"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Mint a replacement of the caller's own token",
                "tags": [
                    "api_tokens"
                ]
            }
        },
        "/user/me/avatar": {
            "delete": {
                "description": "Clears the user's avatar_url and deletes the stored object.",
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/User"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Delete the authenticated user's avatar",
                "tags": [
                    "user"
                ]
            },
            "post": {
                "description": "Accepts a multipart form with a single \"file\" field (JPEG, PNG, or WebP). The image is re-encoded to a 512px JPEG (stripping metadata), stored in object storage, and the user's avatar_url is updated. A previous avatar is deleted.",
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "properties": {
                                    "file": {
                                        "description": "Image file to upload",
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "file"
                                ],
                                "type": "object"
                            }
                        }
                    },
                    "description": "Image file to upload",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/User"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "413": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Request Entity Too Large"
                    },
                    "415": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unsupported Media Type"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Upload the authenticated user's avatar",
                "tags": [
                    "user"
                ]
            }
        },
        "/user/me/legal-acceptances": {
            "get": {
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/DocumentAcceptancesResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "The signed-in account's document acceptances, newest first",
                "tags": [
                    "legal"
                ]
            },
            "post": {
                "description": "Records each version with the time and the client address; the address is kept as consent evidence and no API returns it. Every entry must name a current document at its current version.",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/AcceptDocumentsRequest",
                                "description": "Documents and versions accepted",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Documents and versions accepted",
                    "required": true
                },
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "An invalid request, or code documents_not_accepted for a version that is not current; documents then lists the current ones"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Accept the current versions of legal documents",
                "tags": [
                    "legal"
                ]
            }
        },
        "/user/me/mfa/totp": {
            "post": {
                "description": "Returns a new TOTP secret, shown once. TOTP is on only after POST /user/me/mfa/totp/confirm proves the app has it.",
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TOTPEnrollmentResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Start setting up an authenticator app",
                "tags": [
                    "user"
                ]
            }
        },
        "/user/me/mfa/totp/confirm": {
            "post": {
                "description": "Returns ten recovery codes, shown once; each signs in once in place of a code.",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/MFACodeRequest",
                                "description": "Current code from the app",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Current code from the app",
                    "required": true
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/RecoveryCodesResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    },
                    "429": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Too Many Requests"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Turn TOTP on with a code from the app",
                "tags": [
                    "user"
                ]
            }
        },
        "/user/me/mfa/totp/disable": {
            "post": {
                "description": "Takes a current code or a recovery code, so an access token alone cannot remove the second factor.",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/MFACodeRequest",
                                "description": "Current or recovery code",
                                "summary": "request"
                            }
                        }
                    },
                    "description": "Current or recovery code",
                    "required": true
                },
                "responses": {
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Bad Request"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    },
                    "429": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Too Many Requests"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    },
                    "503": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Service Unavailable"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Turn TOTP off",
                "tags": [
                    "user"
                ]
            }
        },
        "/user/me/quotas": {
            "get": {
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/EffectiveQuota"
                                    },
                                    "type": "array"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "List effective quotas for the authenticated account",
                "tags": [
                    "quota"
                ]
            }
        },
        "/user/me/referrals": {
            "get": {
                "parameters": [
                    {
                        "description": "Max rows (default 100, max 500)",
                        "in": "query",
                        "name": "limit",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/Referral"
                                    },
                                    "type": "array"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "List the caller's referrals",
                "tags": [
                    "referrals"
                ]
            }
        },
        "/user/me/referrals/code": {
            "get": {
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ReferralCode"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Ensure the caller has a referral code",
                "tags": [
                    "referrals"
                ]
            }
        },
        "/user/me/referrals/code/rotate": {
            "post": {
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ReferralCode"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Rotate the caller's referral code",
                "tags": [
                    "referrals"
                ]
            }
        },
        "/workspaces": {
            "get": {
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/WorkspaceSummary"
                                    },
                                    "type": "array"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "List the workspaces the authenticated user may enter",
                "tags": [
                    "workspace"
                ]
            }
        },
        "/workspaces/{id}": {
            "get": {
                "parameters": [
                    {
                        "description": "Workspace ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WorkspaceSummary"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Get a workspace the authenticated user may enter",
                "tags": [
                    "workspace"
                ]
            }
        },
        "/workspaces/{id}/provisioning": {
            "get": {
                "parameters": [
                    {
                        "description": "Workspace ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProvisioningStatus"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Provisioning status of a workspace",
                "tags": [
                    "workspace"
                ]
            }
        },
        "/workspaces/{id}/provisioning/retry": {
            "post": {
                "parameters": [
                    {
                        "description": "Workspace ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Accepted"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "409": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Conflict"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Retry a workspace's failed provisioning now",
                "tags": [
                    "workspace"
                ]
            }
        },
        "/workspaces/{id}/version": {
            "get": {
                "description": "The version the engine last reported and where it stands in the supported window: supported (one of the three newest minor lines), deprecated (its line left the window, for up to 30 days), end_of_support (more than 30 days after deprecation), withdrawn (the release was pulled), or unknown (not a registered release). 404 with code version_unknown until the engine first reports one.",
                "parameters": [
                    {
                        "description": "Workspace ID",
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WorkspaceVersionResponse"
                                }
                            }
                        },
                        "description": "OK"
                    },
                    "401": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Unauthorized"
                    },
                    "403": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Forbidden. One cause is code documents_pending: the signed-in account has legal documents to accept, listed in pending"
                    },
                    "404": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Not Found"
                    },
                    "500": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        },
                        "description": "Internal Server Error"
                    }
                },
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "summary": "Engine version a workspace runs",
                "tags": [
                    "workspace"
                ]
            }
        }
    },
    "servers": [
        {
            "url": "/api/v1"
        }
    ]
}