{
  "openapi": "3.1.0",
  "jsonSchemaDialect": "http://json-schema.org/draft-07/schema#",
  "info": {
    "title": "BuildBase public API",
    "version": "0.1.0",
    "description": "The API `@buildbase/sdk` and an app call: the session API under `/api/v1/public`, hosted sign-in and OAuth under `/api/v1/auth`, beta sign-up, the monday.com integration and OAuth discovery.\n\nGenerated from the running router by `npm run openapi:generate` (server/src/openapi). Do not edit by hand.\n\nWhat this document states is read from the code: every method and path Express serves, the request schemas `validate()` checks, the credential gates, rate limits and permission checks in front of each route. Summaries, descriptions and response bodies come from committed overlays, captured responses and route comments where they exist; otherwise an operation lists only the refusals its middleware sends.\n\nRate limits are the defaults in the code; an install can change some of them through its environment. A limit with `counts: some` lets some requests through uncounted.\n\nValidation runs with type coercion (`\"1\"` is accepted for `1`) and request strings are sanitised, so the documented types are narrower than what is accepted.",
    "x-auth-none-at-router": "No router-level gate checks a credential. The route is public, or its handler verifies its own (a signature, a token in the body, a signed link)."
  },
  "servers": [
    {
      "url": "https://api.console.buildbase.app",
      "description": "BuildBase cloud"
    },
    {
      "url": "{serverUrl}",
      "description": "A self-hosted install",
      "variables": {
        "serverUrl": {
          "default": "http://localhost:3000"
        }
      }
    }
  ],
  "tags": [
    {
      "name": "Account",
      "x-key": "account"
    },
    {
      "name": "Accounts",
      "x-key": "accounts"
    },
    {
      "name": "Ad conversions",
      "x-key": "ad-conversions"
    },
    {
      "name": "Add ons",
      "x-key": "add-ons"
    },
    {
      "name": "Agent readiness",
      "x-key": "agent-readiness"
    },
    {
      "name": "Analytics",
      "x-key": "analytics"
    },
    {
      "name": "Auth",
      "x-key": "auth"
    },
    {
      "name": "Beta",
      "x-key": "beta"
    },
    {
      "name": "Billing",
      "x-key": "billing"
    },
    {
      "name": "Cart",
      "x-key": "cart"
    },
    {
      "name": "Checkout",
      "x-key": "checkout"
    },
    {
      "name": "Connected agents",
      "x-key": "connected-agents"
    },
    {
      "name": "Consent",
      "x-key": "consent"
    },
    {
      "name": "Credit packages",
      "x-key": "credit-packages"
    },
    {
      "name": "Device token",
      "x-key": "device-token"
    },
    {
      "name": "Devices",
      "x-key": "devices"
    },
    {
      "name": "Discovery",
      "x-key": "discovery"
    },
    {
      "name": "Web analytics beacon",
      "x-key": "e"
    },
    {
      "name": "Guest",
      "x-key": "guest"
    },
    {
      "name": "Invitations",
      "x-key": "invitations"
    },
    {
      "name": "Item types",
      "x-key": "item-types"
    },
    {
      "name": "Items",
      "x-key": "items"
    },
    {
      "name": "Logout",
      "x-key": "logout"
    },
    {
      "name": "Me",
      "x-key": "me"
    },
    {
      "name": "MFA",
      "x-key": "mfa"
    },
    {
      "name": "monday.com",
      "x-key": "monday.com"
    },
    {
      "name": "Notifications",
      "x-key": "notifications"
    },
    {
      "name": "OAuth 2.0",
      "x-key": "oauth2"
    },
    {
      "name": "Passkeys",
      "x-key": "passkeys"
    },
    {
      "name": "Plan group versions",
      "x-key": "plan-group-versions"
    },
    {
      "name": "Plans",
      "x-key": "plans"
    },
    {
      "name": "Profile",
      "x-key": "profile"
    },
    {
      "name": "Promotions",
      "x-key": "promotions"
    },
    {
      "name": "Push",
      "x-key": "push"
    },
    {
      "name": "Session",
      "x-key": "session"
    },
    {
      "name": "Sessions",
      "x-key": "sessions"
    },
    {
      "name": "Settings",
      "x-key": "settings"
    },
    {
      "name": "Token",
      "x-key": "token"
    },
    {
      "name": "Tracking",
      "x-key": "tracking"
    },
    {
      "name": "Uploads",
      "x-key": "uploads"
    },
    {
      "name": "Users",
      "x-key": "users"
    },
    {
      "name": "Workspaces",
      "x-key": "workspaces"
    }
  ],
  "paths": {
    "/.well-known/api-catalog": {
      "get": {
        "operationId": "discovery.apiCatalog.get",
        "summary": "Get the API catalog that lists this server's HTTP APIs",
        "description": "Public RFC 9727 linkset naming the public API and the organization API, each with the OpenAPI document this server serves and its documentation, at this install's own URL. The same for every organization; cacheable for five minutes.",
        "tags": [
          "Discovery"
        ],
        "responses": {
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "discovery",
            "windowMs": 60000,
            "max": 120,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/wellKnown/index.ts"
      }
    },
    "/.well-known/oauth-authorization-server/org/{orgId}": {
      "get": {
        "operationId": "discovery.oauthAuthorizationServer.org.get",
        "summary": "Get an organization's OAuth authorization server metadata",
        "description": "Public RFC 8414 authorization server metadata, one document per organization, cached in Redis. Answers 404 `not_found` for an id that is not shaped like an org key, for an unknown organization, or when the document cannot be built.",
        "tags": [
          "Discovery"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "agent_auth": {
                      "properties": {
                        "claim_endpoint": {
                          "type": "string"
                        },
                        "claim_uri": {
                          "type": "string"
                        },
                        "identity_assertion": {
                          "properties": {
                            "assertion_types_supported": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "credential_types_supported": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          },
                          "type": "object"
                        },
                        "identity_endpoint": {
                          "type": "string"
                        },
                        "identity_types_supported": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "register_uri": {
                          "type": "string"
                        },
                        "service_auth": {
                          "properties": {
                            "credential_types_supported": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          },
                          "type": "object"
                        },
                        "skill": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "authorization_endpoint": {
                      "type": "string"
                    },
                    "authorization_grant_profiles_supported": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "authorization_response_iss_parameter_supported": {
                      "type": "boolean"
                    },
                    "client_id_metadata_document_supported": {
                      "type": "boolean"
                    },
                    "code_challenge_methods_supported": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "device_authorization_endpoint": {
                      "type": "string"
                    },
                    "grant_types_supported": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "introspection_endpoint": {
                      "type": "string"
                    },
                    "introspection_endpoint_auth_methods_supported": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "issuer": {
                      "type": "string"
                    },
                    "registration_endpoint": {
                      "type": "string"
                    },
                    "response_types_supported": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "revocation_endpoint": {
                      "type": "string"
                    },
                    "revocation_endpoint_auth_methods_supported": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "token_endpoint": {
                      "type": "string"
                    },
                    "token_endpoint_auth_methods_supported": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "agent_auth": {
                    "claim_endpoint": "http://localhost:3000/api/v1/auth/oauth2/agent/identity/claim?org=000000000000000000000001",
                    "claim_uri": "http://localhost:3000/api/v1/auth/oauth2/agent/identity/claim?org=000000000000000000000001",
                    "identity_assertion": {
                      "assertion_types_supported": [
                        "verified_email"
                      ],
                      "credential_types_supported": [
                        "access_token"
                      ]
                    },
                    "identity_endpoint": "http://localhost:3000/api/v1/auth/oauth2/agent/identity?org=000000000000000000000001",
                    "identity_types_supported": [
                      "service_auth",
                      "identity_assertion"
                    ],
                    "register_uri": "http://localhost:3000/api/v1/auth/oauth2/agent/identity?org=000000000000000000000001",
                    "service_auth": {
                      "credential_types_supported": [
                        "access_token"
                      ]
                    },
                    "skill": "http://localhost:3000/org/000000000000000000000001/auth.md"
                  },
                  "authorization_endpoint": "[REDACTED]",
                  "authorization_response_iss_parameter_supported": true,
                  "code_challenge_methods_supported": [
                    "S256"
                  ],
                  "device_authorization_endpoint": "[REDACTED]",
                  "grant_types_supported": [
                    "authorization_code",
                    "refresh_token",
                    "urn:ietf:params:oauth:grant-type:device_code",
                    "urn:workos:agent-auth:grant-type:claim"
                  ],
                  "introspection_endpoint": "http://localhost:3000/api/v1/auth/oauth2/introspect?org=000000000000000000000001",
                  "introspection_endpoint_auth_methods_supported": [
                    "client_secret_basic",
                    "client_secret_post"
                  ],
                  "issuer": "http://localhost:3000/org/000000000000000000000001",
                  "response_types_supported": [
                    "code"
                  ],
                  "revocation_endpoint": "http://localhost:3000/api/v1/auth/oauth2/revoke?org=000000000000000000000001",
                  "revocation_endpoint_auth_methods_supported": [
                    "none",
                    "client_secret_basic",
                    "client_secret_post"
                  ],
                  "token_endpoint": "[REDACTED]",
                  "token_endpoint_auth_methods_supported": [
                    "[REDACTED]",
                    "[REDACTED]",
                    "[REDACTED]"
                  ]
                },
                "x-observed": true
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "discovery",
            "windowMs": 60000,
            "max": 120,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/wellKnown/index.ts"
      }
    },
    "/api/v1/auth/age-gate": {
      "post": {
        "operationId": "auth.ageGate.create",
        "summary": "Answer the age question on hosted sign-up or at sign-in",
        "description": "With the sign-in page's auth state, the answer is judged and kept only as a verdict under that state; answers 403 `age_refused` below the org's minimum and 400 `age_answer_invalid` for an answer that does not fit the question. With a `pending` token instead (an existing account parked at sign-in, no auth state needed), a pass is kept on the account and the parked sign-in finishes, while a refusal is kept on the account, ends its sessions and answers 403; an unknown or spent token answers 401 `mfa_expired`.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pending": {
                    "type": "string",
                    "minLength": 40,
                    "maxLength": 40
                  },
                  "confirmed": {
                    "type": "boolean"
                  },
                  "birthDate": {
                    "type": "string",
                    "maxLength": 10
                  }
                },
                "required": [
                  "pending"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "login",
            "windowMs": 60000,
            "max": 20,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/age-gate/index.ts"
      }
    },
    "/api/v1/auth/agent/register": {
      "post": {
        "operationId": "auth.agent.register.create",
        "summary": "Register a pre-verified agent user account",
        "description": "The caller must authenticate as a confidential OAuth client (client_id and client_secret); dynamically registered or public clients get 401 `invalid_client`. Answers 403 `access_denied` unless the org has turned on agent sign-up, or when the plan's end-user ceiling is reached. Creates a user labelled as an agent with its email already verified.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "password": {
                    "type": "string",
                    "minLength": 8
                  },
                  "client_id": {
                    "type": "string"
                  },
                  "client_secret": {
                    "type": "string"
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "timezone": {
                        "type": "string"
                      },
                      "country": {
                        "type": "string"
                      },
                      "language": {
                        "type": "string"
                      },
                      "currency": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "name",
                  "email",
                  "password"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "token": {
                          "type": "string"
                        },
                        "user": {
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "token": "[REDACTED]",
                    "user": {
                      "name": "Settings bot",
                      "role": "user"
                    }
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "login",
            "windowMs": 60000,
            "max": 20,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/agent/index.ts",
        "x-events": [
          "user.registered"
        ]
      }
    },
    "/api/v1/auth/captcha/challenge": {
      "get": {
        "operationId": "auth.captcha.challenge.list",
        "summary": "Get a proof-of-work challenge for the hosted sign-up page",
        "description": "Returns a fresh, single-use challenge bound to sign-up when the org's sign-up captcha is the built-in one, and 404 when sign-up does not use a challenge. Sent with `Cache-Control: no-store`.",
        "tags": [
          "Auth"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "algorithm": {
                      "type": "string"
                    },
                    "challenge": {
                      "type": "string"
                    },
                    "maxnumber": {
                      "type": "integer"
                    },
                    "salt": {
                      "type": "string"
                    },
                    "signature": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "algorithm": "SHA-256",
                  "challenge": "f181784692944189266f9a87fdd221a55eaac30dbb45f0a7227bc8eccd37dd94",
                  "maxnumber": 100000,
                  "salt": "000000000000000000000001?s=eb87e9420b8001e60ad7926a4df42109&expires=1794382733",
                  "signature": "[REDACTED]"
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "form-challenge",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/index.ts"
      }
    },
    "/api/v1/auth/config": {
      "get": {
        "operationId": "auth.config.list",
        "summary": "Get the hosted sign-in page configuration for an organization",
        "description": "Returns the org's auth page config (branding, waitlist screens) with per-request facts such as whether sign-up is open, the sign-up mode, the captcha and bot-protection public settings, the client's own branding and the white-label entitlement. Creates the org's default auth config on first read when none exists.",
        "tags": [
          "Auth"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "appName": {
                      "type": "string"
                    },
                    "betaConfigData": {
                      "properties": {
                        "approvalEmail": {
                          "type": "boolean"
                        },
                        "description": {
                          "type": "string"
                        },
                        "logoFallBack": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "privacyPolicy": {},
                        "screen": {
                          "properties": {
                            "register": {
                              "properties": {
                                "description": {
                                  "type": "string"
                                },
                                "title": {
                                  "type": "string"
                                }
                              },
                              "type": "object"
                            },
                            "thankYou": {
                              "properties": {
                                "description": {
                                  "type": "string"
                                },
                                "title": {
                                  "type": "string"
                                }
                              },
                              "type": "object"
                            }
                          },
                          "type": "object"
                        },
                        "termsOfService": {}
                      },
                      "type": "object"
                    },
                    "botProtection": {
                      "properties": {
                        "mode": {
                          "type": "string"
                        },
                        "siteKey": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "branding": {
                      "properties": {
                        "backgroundFit": {
                          "type": "string"
                        },
                        "font": {
                          "properties": {},
                          "type": "object"
                        },
                        "layout": {
                          "properties": {
                            "cardPosition": {
                              "type": "string"
                            },
                            "socialStyle": {
                              "type": "string"
                            },
                            "split": {
                              "type": "string"
                            },
                            "splitOnPhone": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "panel": {
                          "properties": {
                            "text": {
                              "type": "string"
                            },
                            "title": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "client": {
                      "properties": {
                        "copy": {
                          "properties": {
                            "byLocale": {
                              "properties": {
                                "de": {
                                  "properties": {
                                    "login": {
                                      "properties": {
                                        "title": {
                                          "properties": {
                                            "from": {
                                              "type": "string"
                                            },
                                            "text": {
                                              "type": "string"
                                            }
                                          },
                                          "type": "object"
                                        }
                                      },
                                      "type": "object"
                                    },
                                    "panel": {
                                      "properties": {
                                        "title": {
                                          "properties": {
                                            "from": {
                                              "type": "string"
                                            },
                                            "text": {
                                              "type": "string"
                                            }
                                          },
                                          "type": "object"
                                        }
                                      },
                                      "type": "object"
                                    }
                                  },
                                  "type": "object"
                                }
                              },
                              "type": "object"
                            },
                            "words": {
                              "properties": {
                                "login": {
                                  "properties": {
                                    "description": {
                                      "type": "string"
                                    },
                                    "title": {
                                      "type": "string"
                                    }
                                  },
                                  "type": "object"
                                },
                                "panel": {
                                  "properties": {
                                    "title": {
                                      "type": "string"
                                    }
                                  },
                                  "type": "object"
                                }
                              },
                              "type": "object"
                            }
                          },
                          "type": "object"
                        },
                        "name": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "primaryColor": {
                          "type": "string"
                        }
                      },
                      "type": [
                        "null",
                        "object"
                      ]
                    },
                    "consentLabel": {
                      "type": "string"
                    },
                    "copyByLocale": {
                      "properties": {
                        "es": {
                          "properties": {
                            "consent": {
                              "properties": {
                                "label": {
                                  "properties": {
                                    "from": {
                                      "type": "string"
                                    },
                                    "text": {
                                      "type": "string"
                                    }
                                  },
                                  "type": "object"
                                }
                              },
                              "type": "object"
                            },
                            "login": {
                              "properties": {
                                "title": {
                                  "properties": {
                                    "from": {
                                      "type": "string"
                                    },
                                    "text": {
                                      "type": "string"
                                    }
                                  },
                                  "type": "object"
                                }
                              },
                              "type": "object"
                            }
                          },
                          "type": "object"
                        },
                        "fr": {
                          "properties": {
                            "login": {
                              "properties": {
                                "title": {
                                  "properties": {
                                    "from": {
                                      "type": "string"
                                    },
                                    "text": {
                                      "type": "string"
                                    }
                                  },
                                  "type": "object"
                                }
                              },
                              "type": "object"
                            },
                            "panel": {
                              "properties": {
                                "title": {
                                  "properties": {
                                    "from": {
                                      "type": "string"
                                    },
                                    "text": {
                                      "type": "string"
                                    }
                                  },
                                  "type": "object"
                                }
                              },
                              "type": "object"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "isBetaEnabled": {
                      "type": "boolean"
                    },
                    "logo": {},
                    "logoFallBack": {},
                    "name": {
                      "type": "string"
                    },
                    "orgId": {
                      "type": "string"
                    },
                    "privacyPolicy": {},
                    "screen": {
                      "properties": {
                        "forgotPassword": {
                          "properties": {
                            "description": {
                              "type": "string"
                            },
                            "title": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "login": {
                          "properties": {
                            "description": {
                              "type": "string"
                            },
                            "title": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "magicLink": {
                          "properties": {
                            "description": {
                              "type": "string"
                            },
                            "title": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "registration": {
                          "properties": {
                            "description": {
                              "type": "string"
                            },
                            "title": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "resetPassword": {
                          "properties": {
                            "description": {
                              "type": "string"
                            },
                            "title": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "verifyEmail": {
                          "properties": {
                            "description": {
                              "type": "string"
                            },
                            "title": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "security": {
                      "properties": {
                        "accountDeletionGraceDays": {
                          "type": "integer"
                        },
                        "allowRememberMe": {
                          "type": "boolean"
                        },
                        "rememberMeDays": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "shortName": {
                      "type": "string"
                    },
                    "signupCaptcha": {
                      "properties": {
                        "widget": {
                          "type": "string"
                        }
                      },
                      "type": [
                        "null",
                        "object"
                      ]
                    },
                    "signupMode": {
                      "type": "string"
                    },
                    "signupOpen": {
                      "type": "boolean"
                    },
                    "smallName": {
                      "type": "string"
                    },
                    "supportUrl": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "termsOfService": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "untranslatedCopy": {
                      "type": "string"
                    },
                    "username": {
                      "properties": {
                        "enabled": {
                          "type": "boolean"
                        },
                        "required": {
                          "type": "boolean"
                        }
                      },
                      "type": "object"
                    },
                    "websiteUrl": {},
                    "whiteLabel": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "appName": "Acme & Co",
                  "betaConfigData": {
                    "approvalEmail": false,
                    "screen": {
                      "register": {
                        "description": "Register with your email for beta access",
                        "title": "Register to Beta Users"
                      },
                      "thankYou": {
                        "description": "You have successfully registered for beta access.",
                        "title": "Thank You for Registering"
                      }
                    }
                  },
                  "botProtection": {
                    "mode": "off"
                  },
                  "branding": {},
                  "client": {
                    "copy": {
                      "byLocale": {
                        "de": {
                          "login": {
                            "title": {
                              "from": "Use your work email",
                              "text": "Mit Ihrer Firmen-E-Mail anmelden"
                            }
                          }
                        }
                      },
                      "words": {
                        "login": {
                          "description": "Staff only. Ask IT if you cannot get in.",
                          "title": "Use your work email"
                        }
                      }
                    },
                    "name": null
                  },
                  "copyByLocale": {
                    "es": {
                      "consent": {
                        "label": {
                          "from": "Yes, Acme may use cookies to measure its ads.",
                          "text": "Sí, Acme puede usar cookies para medir los anuncios."
                        }
                      },
                      "login": {
                        "title": {
                          "from": "",
                          "text": "Inicia sesión para continuar"
                        }
                      }
                    },
                    "fr": {
                      "login": {
                        "title": {
                          "from": "",
                          "text": "Connectez-vous pour continuer"
                        }
                      }
                    }
                  },
                  "isBetaEnabled": false,
                  "logo": null,
                  "logoFallBack": null,
                  "name": "Acme & Co",
                  "orgId": "000000000000000000000001",
                  "privacyPolicy": null,
                  "screen": {
                    "login": {
                      "description": "Fast <3 \"really\"",
                      "title": "Sign in to {app} & friends"
                    }
                  },
                  "security": {
                    "accountDeletionGraceDays": 7
                  },
                  "shortName": "Acme & Co",
                  "signupCaptcha": null,
                  "signupMode": "open",
                  "signupOpen": true,
                  "smallName": "BuildBase Auth",
                  "supportUrl": null,
                  "termsOfService": "https://acme.test/terms",
                  "username": {
                    "enabled": false,
                    "required": false
                  },
                  "websiteUrl": null,
                  "whiteLabel": false
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/auth/config/index.ts"
      }
    },
    "/api/v1/auth/consent": {
      "get": {
        "operationId": "auth.consent.list",
        "summary": "Check whether the signed-in person must consent to an agent client",
        "description": "Needs the login token in `Authorization` and the auth state header; answers 401 otherwise or when the token belongs to another org. Non-agent clients answer `required: false`; for an agent client it returns the client, requested scopes, scopes not yet granted and whether consent is required, or a `refused` block when the person's company does not allow the app.",
        "tags": [
          "Auth"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "client": {
                      "properties": {
                        "identifiedBy": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "unverified": {
                          "type": "boolean"
                        }
                      },
                      "type": "object"
                    },
                    "grant": {
                      "properties": {
                        "actsAsUser": {
                          "type": "boolean"
                        },
                        "customClaims": {
                          "type": "array"
                        },
                        "identity": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "idleDays": {
                          "type": "integer"
                        },
                        "redirectHost": {
                          "type": "string"
                        },
                        "resource": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "scope": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "scopeDetails": {
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "newScope": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "refused": {
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "required": {
                      "type": "boolean"
                    },
                    "scope": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "scopeDetails": {
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "client": {
                    "title": "E2E Scoped Agent",
                    "unverified": false
                  },
                  "grant": {
                    "actsAsUser": true,
                    "customClaims": [],
                    "identity": [
                      "id",
                      "email",
                      "name",
                      "role",
                      "emailVerified",
                      "image",
                      "blocked",
                      "blockedReason",
                      "blockedAt"
                    ],
                    "idleDays": 30,
                    "redirectHost": "localhost:9971",
                    "resource": [],
                    "scope": [
                      "notes:read",
                      "notes:write"
                    ],
                    "scopeDetails": []
                  },
                  "newScope": [
                    "notes:write"
                  ],
                  "required": true,
                  "scope": [
                    "notes:read",
                    "notes:write"
                  ],
                  "scopeDetails": []
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/consent/index.ts"
      }
    },
    "/api/v1/auth/consent/approve": {
      "post": {
        "operationId": "auth.consent.approve.create",
        "summary": "Approve an agent client's requested scopes",
        "description": "Needs the login token and auth state header. For an agent client, records the person's consent to the requested scopes; answers 403 `app_not_allowed` when the person's company does not allow the app, and 503 when no more agents can be connected. When the person holds too many self-registered clients, the oldest grants are revoked along with their refresh tokens and sessions.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/consent/index.ts"
      }
    },
    "/api/v1/auth/consent/deny": {
      "post": {
        "operationId": "auth.consent.deny.create",
        "summary": "Deny an agent client's consent request",
        "description": "Needs the login token and auth state header. Ends the pending OAuth request and returns the client's redirect URL with `error=access_denied` when one can be built, otherwise a null `redirectUrl`.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "redirectUrl": {
                      "type": "string"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "redirectUrl": "http://localhost:9971/callback?error=access_denied&state=[REDACTED]&iss=http%3A%2F%2Flocalhost%3A3000%2Forg%2F6af413602865c46d9a5f7511",
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/consent/index.ts"
      }
    },
    "/api/v1/auth/consent/list": {
      "post": {
        "operationId": "auth.consent.list.create",
        "summary": "List the agents a user has connected, for the app's backend",
        "description": "The caller authenticates with its client credentials (401 `invalid_client` otherwise); agent clients get 403. Returns each agent client the user has granted, with its scopes, last grant time and source.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "maxLength": 256
                  },
                  "client_secret": {
                    "type": "string",
                    "maxLength": 1024
                  },
                  "userId": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "targetClientId": {
                    "type": "string",
                    "maxLength": 256
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "agents": {
                      "items": {
                        "properties": {
                          "clientId": {
                            "type": "string"
                          },
                          "lastGrantedAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "scope": {
                            "items": {
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "source": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "agents": [
                    {
                      "clientId": "PdcZi54Ss71u9xJsxkCpj3cRrNle48cSM5RTaFvK",
                      "lastGrantedAt": "2026-01-01T00:00:00.000Z",
                      "scope": [
                        "read:profile"
                      ],
                      "source": "consent",
                      "title": "E2E Agent"
                    },
                    {
                      "clientId": "d4UCagv45LlCvHo3zlW6nxa2hft8Q1yWEHJlxmOd",
                      "lastGrantedAt": "2026-01-01T00:00:00.000Z",
                      "scope": [
                        "notes:read",
                        "notes:write"
                      ],
                      "source": "consent",
                      "title": "E2E Scoped Agent"
                    }
                  ]
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/consent/index.ts"
      }
    },
    "/api/v1/auth/consent/revoke": {
      "post": {
        "operationId": "auth.consent.revoke.create",
        "summary": "Revoke a user's grant to an OAuth client",
        "description": "The caller authenticates with its client credentials (401 `invalid_client` otherwise) and revokes its own grant, or another client's when it is not an agent client (403 otherwise). Removes the consent, the user's refresh tokens and sessions for that client, and notifies the client of the revocation.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "maxLength": 256
                  },
                  "client_secret": {
                    "type": "string",
                    "maxLength": 1024
                  },
                  "userId": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "targetClientId": {
                    "type": "string",
                    "maxLength": 256
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/consent/index.ts"
      }
    },
    "/api/v1/auth/device/decide": {
      "post": {
        "operationId": "auth.device.decide.create",
        "summary": "Approve or deny a device authorization request",
        "description": "Needs the person's login token and the auth state from the device code lookup; answers 403 `sign_in_required` when the person has not signed in on that state, 403 `wrong_account` when the device asked for a different account, and 410 `code_expired` when the request is no longer pending. Approving for an agent client also records the person's consent to the requested scopes.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "approve": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "approve"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "approved": {
                      "type": "boolean"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "approved": false,
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/device/index.ts"
      }
    },
    "/api/v1/auth/device/lookup": {
      "post": {
        "operationId": "auth.device.lookup.create",
        "summary": "Look up the code a device shows and start a sign-in for it",
        "description": "No router-level gate: the org comes in the body. Returns a new auth state for the device sign-in with the client's name and requested scopes; answers 400 `invalid_code` for an unknown code or a client without the device grant, and 429 after too many wrong codes from one network.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orgId": {
                    "type": "string",
                    "minLength": 24,
                    "maxLength": 33
                  },
                  "userCode": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32
                  }
                },
                "required": [
                  "orgId",
                  "userCode"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "client": {
                      "properties": {
                        "title": {
                          "type": "string"
                        },
                        "unverified": {
                          "type": "boolean"
                        }
                      },
                      "type": "object"
                    },
                    "requestedFrom": {
                      "properties": {
                        "ip": {
                          "type": "string"
                        },
                        "userAgent": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "scope": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "state": {
                      "type": "string"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "client": {
                    "title": "E2E TV App",
                    "unverified": false
                  },
                  "requestedFrom": {
                    "ip": "127.0.0.1",
                    "userAgent": "undefined"
                  },
                  "scope": [
                    "read",
                    "write"
                  ],
                  "state": "BKjSb6vgXlaQ8MZtdMdrzB9D0yNmG4",
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/device/index.ts"
      }
    },
    "/api/v1/auth/enterprise/choices/{choice}": {
      "get": {
        "operationId": "auth.enterprise.choices.get",
        "summary": "Get the SSO connections offered for a pending enterprise sign-in choice",
        "description": "Called from the hosted sign-in page with its sign-in context. Reads the stored choice without spending it and answers the email and the connections the person may pick from. Answers 404 when the choice is unknown, expired, belongs to another organization or has no options left, and 503 when it cannot be read.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "choice",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "email": {
                      "type": "string"
                    },
                    "options": {
                      "items": {
                        "properties": {
                          "label": {
                            "type": "string"
                          },
                          "provider": {
                            "type": "string"
                          },
                          "ref": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "email": "user@example.com",
                  "options": [
                    {
                      "label": "Okta",
                      "provider": "okta",
                      "ref": "6da1c38316815ce6"
                    },
                    {
                      "label": "Umbrella (Entra)",
                      "provider": "entra",
                      "ref": "f2a0a3a5254d2007"
                    }
                  ]
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/enterprise/index.ts"
      }
    },
    "/api/v1/auth/enterprise/discover": {
      "post": {
        "operationId": "auth.enterprise.discover.create",
        "summary": "Start enterprise SSO discovery for an email address",
        "description": "Called from the hosted sign-in page with its sign-in context. Looks up the company whose verified domain matches the email and stores a short-lived handle for the SSO start; the answer is the same handle whether or not a company matches, so it does not reveal which domains have SSO.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  }
                },
                "required": [
                  "email"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "handle": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "handle": "00Ev4Lfi2nJ28T6ZHfWhGGg14e7DrJ"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/enterprise/index.ts"
      }
    },
    "/api/v1/auth/enterprise/{orgId}/callback": {
      "get": {
        "operationId": "auth.enterprise.callback.list",
        "summary": "Finish an enterprise SSO sign-in returning from WorkOS",
        "description": "No router-level gate; the handler spends the single-use state from the start and refuses (401) without it. Checks the profile against the company's organization, verified domains and connections, may create the user (JIT) or update a linked user's email, then redirects to the hosted sign-in page with a single-use handoff code. Refusals redirect back with an error and reason and are recorded in the auth audit log.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          },
          {
            "name": "error",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "error_description",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/enterprise/index.ts",
        "x-events": [
          "user.registered",
          "user.email_changed",
          "user.logged_in"
        ]
      }
    },
    "/api/v1/auth/enterprise/{orgId}/sign-in": {
      "get": {
        "operationId": "auth.enterprise.signIn.list",
        "summary": "Start an identity-provider-initiated enterprise SSO sign-in",
        "description": "No router-level gate. Used when a sign-in starts at the company's identity provider: when the org has an IdP-initiated landing app configured and the connection belongs to an active company, redirects to WorkOS with a new state; otherwise renders a page asking the person to start from the app. A connection the company does not list is refused and recorded in the auth audit log.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "connection_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/enterprise/index.ts"
      }
    },
    "/api/v1/auth/enterprise/{orgId}/start/{methodId}": {
      "get": {
        "operationId": "auth.enterprise.start.get",
        "summary": "Start an enterprise SSO sign-in for a discovered email address",
        "description": "No router-level gate; the handler requires a registered redirect origin (400 otherwise) and spends the discovery handle. Redirects to WorkOS for the company's connection, or back to the redirect URL with a `sso_choose` choice id when several connections could serve the email. Refusals (method or company not available, tenant restriction, no routed connection) redirect back with an error and reason.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "methodId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "authStateId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "challenge",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{43}$"
            }
          },
          {
            "name": "handle",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "invitationToken",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "redirect",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri",
              "maxLength": 2048
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/enterprise/index.ts"
      }
    },
    "/api/v1/auth/enterprise/{orgId}/start/{methodId}/choose": {
      "get": {
        "operationId": "auth.enterprise.start.choose.list",
        "summary": "Continue an enterprise SSO sign-in with the connection the person chose",
        "description": "No router-level gate; the handler spends the stored choice and redirects to WorkOS for the chosen connection. An expired or mismatched choice redirects back to a registered redirect URL with an error, or answers 400 when there is none; an option that was not offered redirects back refused.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "methodId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "choice",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "option",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 32
            }
          },
          {
            "name": "redirect",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uri",
              "maxLength": 2048
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/enterprise/index.ts"
      }
    },
    "/api/v1/auth/guest": {
      "post": {
        "operationId": "auth.guest.create",
        "summary": "Create a guest account and sign it in",
        "description": "Answers 403 `method_unavailable` when the app does not offer guest access, 403 `signup_closed` when sign-up is closed or the plan's end-user ceiling is reached, and 429 when one network makes too many guests in an hour. Returns a login token, as `/login` does, for the page to pass to `/redirect`.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "turnstileToken": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "captchaToken": {
                    "type": "string",
                    "maxLength": 8192
                  }
                },
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "deviceToken": {
                          "type": "string"
                        },
                        "token": {
                          "type": "string"
                        },
                        "user": {
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "deviceToken": "[REDACTED]",
                    "token": "[REDACTED]",
                    "user": {
                      "name": "Guest",
                      "role": "user"
                    }
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/guest/index.ts",
        "x-events": [
          "user.logged_in"
        ]
      }
    },
    "/api/v1/auth/impersonation/redeem": {
      "post": {
        "operationId": "auth.impersonation.redeem.create",
        "summary": "Redeem a one-time impersonation ticket for the app's callback URL",
        "description": "The second half of the console's \"Sign in as user\": no router-level gate, the org comes in the body. Spends the ticket, mints the impersonation code and returns the app's callback URL with `code` and the given `state`; the redemption is written to the security audit log.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orgId": {
                    "type": "string",
                    "format": "tenantKey"
                  },
                  "clientId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "ticket": {
                    "type": "string",
                    "pattern": "^[0-9A-Za-z]{48}$"
                  },
                  "state": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  }
                },
                "required": [
                  "orgId",
                  "clientId",
                  "ticket",
                  "state"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "redirectUrl": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "redirectUrl": "http://localhost:9999/callback?code=[REDACTED]&state=[REDACTED]"
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/index.ts"
      }
    },
    "/api/v1/auth/login": {
      "post": {
        "operationId": "auth.login.create",
        "summary": "Sign in with a password",
        "description": "Takes an email or, when the org has usernames turned on, a username. Answers 403 `method_unavailable` when the app does not offer password sign-in; a failed sign-in answers with a reason such as `invalid_credentials`, `locked` or `blocked`. On success returns a login token, or the second step's `mfaToken` when one is owed.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "username": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "password": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256
                  },
                  "turnstileToken": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "captchaToken": {
                    "type": "string",
                    "maxLength": 8192
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "timezone": {
                        "type": "string"
                      },
                      "country": {
                        "type": "string"
                      },
                      "language": {
                        "type": "string"
                      },
                      "currency": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "password"
                ],
                "anyOf": [
                  {
                    "required": [
                      "email"
                    ]
                  },
                  {
                    "required": [
                      "username"
                    ]
                  }
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "allowed": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "data": {
                      "properties": {
                        "deviceToken": {
                          "type": "string"
                        },
                        "passkeySetup": {
                          "type": "boolean"
                        },
                        "token": {
                          "type": "string"
                        },
                        "user": {
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "enrollRequired": {
                      "type": "boolean"
                    },
                    "factors": {
                      "items": {
                        "properties": {
                          "backupCodesRemaining": {
                            "type": "integer"
                          },
                          "phone": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "message": {
                      "type": "string"
                    },
                    "mfaRequired": {
                      "type": "boolean"
                    },
                    "mfaToken": {
                      "type": "string"
                    },
                    "passkeySetup": {
                      "type": "boolean"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "deviceToken": "[REDACTED]",
                    "passkeySetup": true,
                    "token": "[REDACTED]",
                    "user": {
                      "name": "Session User m19-issuer-initech-owner",
                      "role": "user"
                    }
                  },
                  "passkeySetup": true,
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "login",
            "windowMs": 60000,
            "max": 20,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/index.ts",
        "x-events": [
          "user.logged_in",
          "auth.login_failed"
        ]
      }
    },
    "/api/v1/auth/login-handoff": {
      "post": {
        "operationId": "auth.loginHandoff.create",
        "summary": "Exchange a single-use login handoff code for the login token",
        "description": "Used by the hosted sign-in pages after a server-side redirect (social sign-in) so the token never appears in a URL. When the code was bound to a PKCE challenge the matching verifier is required; an invalid, spent or unverified code answers 401. May answer with the second step's `mfaToken` instead of a token.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "code"
                ],
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "verifier": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "deviceToken": {
                      "type": "string"
                    },
                    "enrollRequired": {
                      "type": "boolean"
                    },
                    "factors": {
                      "items": {
                        "properties": {
                          "backupCodesRemaining": {
                            "type": "integer"
                          },
                          "type": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "mfaRequired": {
                      "type": "boolean"
                    },
                    "mfaToken": {
                      "type": "string"
                    },
                    "passkeySetup": {
                      "type": "boolean"
                    },
                    "success": {
                      "type": "boolean"
                    },
                    "token": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "enrollRequired": false,
                  "factors": [
                    {
                      "backupCodesRemaining": 10,
                      "type": "totp"
                    }
                  ],
                  "mfaRequired": true,
                  "mfaToken": "[REDACTED]",
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "sign-in-flow",
            "windowMs": 60000,
            "max": 300,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/index.ts",
        "x-events": [
          "user.logged_in"
        ]
      }
    },
    "/api/v1/auth/magic-link": {
      "post": {
        "operationId": "auth.magicLink.create",
        "summary": "Send a magic sign-in link to an email address",
        "description": "Called with the hosted sign-in context. Answers the same success message whether or not the address has an account; an email is queued only for an existing, unblocked account. Answers 403 when sign-in links are off, 400 for an origin that is not registered, 429 when the address has asked for too many links, and the email-sender refusal status when the org has no usable sender.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "origin": {
                    "type": "string",
                    "format": "uri"
                  },
                  "turnstileToken": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "captchaToken": {
                    "type": "string",
                    "maxLength": 8192
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "timezone": {
                        "type": "string"
                      },
                      "country": {
                        "type": "string"
                      },
                      "language": {
                        "type": "string"
                      },
                      "currency": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "email",
                  "origin"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "type": "string"
                    },
                    "deviceToken": {
                      "type": "string"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": "Check your email for magic link.",
                  "deviceToken": "[REDACTED]",
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/magic-link/index.ts"
      }
    },
    "/api/v1/auth/magic-link/check": {
      "post": {
        "operationId": "auth.magicLink.check.create",
        "summary": "Check whether a magic link can be used in this browser",
        "description": "No router-level gate; rate limited. Reads the link without spending it and answers why it cannot finish here: expired or used, opened in a different browser than the one that asked, or not usable in this browser. Names no address, account or org.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  }
                },
                "required": [
                  "code"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": "This link has expired or was already used. Ask for a new one on the sign-in page.",
                  "reason": "link_expired",
                  "success": false
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/magic-link/index.ts"
      }
    },
    "/api/v1/auth/magic-link/verify": {
      "post": {
        "operationId": "auth.magicLink.verify.create",
        "summary": "Verify a magic link and sign the person in",
        "description": "No router-level gate; the link's code (or a legacy magic-link token) is the credential, and it is spent once. Refuses a browser other than the one that asked when the org requires the same browser. Answers a login token, a second-step challenge (`mfaRequired`), or a refusal for an expired link, an agent account, required SSO or a sign-in method the person's company does not allow.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 1
                  },
                  "token": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "type": "string"
                    },
                    "deviceToken": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "success": {
                      "type": "boolean"
                    },
                    "token": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": "This link has expired or was already used. Ask for a new one on the sign-in page.",
                  "reason": "link_expired",
                  "success": false
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/magic-link/index.ts",
        "x-events": [
          "user.logged_in"
        ]
      }
    },
    "/api/v1/auth/mfa/sms/send": {
      "post": {
        "operationId": "auth.mfa.sms.send.create",
        "summary": "Send a text-message code for the second step of a pending sign-in",
        "description": "No router-level gate; the pending sign-in's `mfaToken` is the credential (401 when it has expired). Answers 400 when text-message codes are not offered for this sign-in, and the refusal status from the phone send limits or provider otherwise.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mfaToken": {
                    "type": "string",
                    "minLength": 40,
                    "maxLength": 40
                  }
                },
                "required": [
                  "mfaToken"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "retryAfter": {
                      "type": "integer"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "retryAfter": 30,
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "login",
            "windowMs": 60000,
            "max": 20,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/mfa/index.ts"
      }
    },
    "/api/v1/auth/mfa/totp/enroll": {
      "post": {
        "operationId": "auth.mfa.totp.enroll.create",
        "summary": "Start setting up an authenticator app during a sign-in that requires it",
        "description": "No router-level gate; the pending sign-in's `mfaToken` is the credential. Only for a sign-in that must enroll a second step first (400 otherwise). Answers the new secret, its otpauth URL and a QR code.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mfaToken": {
                    "type": "string",
                    "minLength": 40,
                    "maxLength": 40
                  }
                },
                "required": [
                  "mfaToken"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "otpauthUrl": {
                          "type": "string"
                        },
                        "qrSvg": {
                          "type": "string"
                        },
                        "secret": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "otpauthUrl": "otpauth://totp/Updated%20Auth%20Config:e2e-mfa-register-1767225600000%40test.example.com?secret=[REDACTED]&issuer=Updated%20Auth%20Config",
                    "qrSvg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 51 51\" shape-rendering=\"crispEdges\"><path fill=\"#ffffff\" d=\"M0 0h51v51H0z\"/><path stroke=\"#000000\" d=\"M1 1.5h7m1 0h2m3 0h1m1 0h4m3 0h4m1 0h2m2 0h1m3 0h2m3 0h1m1 0h7M1 2.5h1m5 0h1m1 0h6m3 0h1m2 0h1m3 0h3m4 0h2m5 0h3m1 0h1m5 0h1M1 3.5h1m1 0h3m1 0h1m1 0h4m2 0h1m3 0h2m2 0h3m3 0h5m1 0h2m1 0h1m1 0h2m1 0h1m1 0h3m1 0h1M1 4.5h1m1 0h3m1 0h1m3 0h1m1 0h3m4 0h5m2 0h3m1 0h6m1 0h1m1 0h1m2 0h1m1 0h3m1 0h1M1 5.5h1m1 0h3m1 0h1m1 0h1m3 0h2m3 0h2m1 0h1m1 0h6m1 0h",
                    "secret": "[REDACTED]"
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "login",
            "windowMs": 60000,
            "max": 20,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/mfa/index.ts"
      }
    },
    "/api/v1/auth/mfa/totp/enroll/confirm": {
      "post": {
        "operationId": "auth.mfa.totp.enroll.confirm.create",
        "summary": "Confirm a new authenticator app and finish the pending sign-in",
        "description": "No router-level gate; the pending sign-in's `mfaToken` is the credential. Confirms the app with its first code, returns the backup codes once, and completes the sign-in. A wrong code answers 400, or 401 once the sign-in has had too many wrong codes.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mfaToken": {
                    "type": "string",
                    "minLength": 40,
                    "maxLength": 40
                  },
                  "code": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 6
                  }
                },
                "required": [
                  "mfaToken",
                  "code"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "backupCodes": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "data": {
                      "properties": {
                        "deviceToken": {
                          "type": "string"
                        },
                        "token": {
                          "type": "string"
                        },
                        "user": {
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "backupCodes": [
                    "mfrdq-e6k78",
                    "r7rcr-c35xy",
                    "59xw9-g9ghk",
                    "kr6w4-yy3jb",
                    "63dkr-94yhs",
                    "fudhn-ruqpz",
                    "w5m29-xsg8x",
                    "q47zb-dyqp5",
                    "wkfbm-gvqst",
                    "a29eu-tuj5u"
                  ],
                  "data": {
                    "deviceToken": "[REDACTED]",
                    "token": "[REDACTED]",
                    "user": {
                      "name": "Registered",
                      "role": "user"
                    }
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "login",
            "windowMs": 60000,
            "max": 20,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/mfa/index.ts",
        "x-events": [
          "user.mfa_enrolled",
          "user.logged_in"
        ]
      }
    },
    "/api/v1/auth/mfa/verify": {
      "post": {
        "operationId": "auth.mfa.verify.create",
        "summary": "Verify a second-step code and finish the pending sign-in",
        "description": "No router-level gate; the pending sign-in's `mfaToken` is the credential. Accepts an authenticator or backup code, or a text-message code. A wrong code answers 400 and emits `auth.login_failed`; too many wrong codes answer 429 (account locked) or 401 (sign-in expired).",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mfaToken": {
                    "type": "string",
                    "minLength": 40,
                    "maxLength": 40
                  },
                  "code": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 20
                  },
                  "factor": {
                    "type": "string",
                    "enum": [
                      "sms"
                    ]
                  }
                },
                "required": [
                  "mfaToken",
                  "code"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "backupCodesRemaining": {
                      "type": "integer"
                    },
                    "data": {
                      "properties": {
                        "deviceToken": {
                          "type": "string"
                        },
                        "token": {
                          "type": "string"
                        },
                        "user": {
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "backupCodesRemaining": 9,
                  "data": {
                    "deviceToken": "[REDACTED]",
                    "token": "[REDACTED]",
                    "user": {
                      "name": "Session User mfa-backup",
                      "role": "user"
                    }
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "login",
            "windowMs": 60000,
            "max": 20,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/mfa/index.ts",
        "x-events": [
          "auth.login_failed",
          "user.logged_in"
        ]
      }
    },
    "/api/v1/auth/monday.com/authorize/{orgId}": {
      "get": {
        "operationId": "auth.mondayCom.authorize.get",
        "summary": "Start or resume the monday.com app authorization hand-off",
        "description": "No router-level gate: the `token` query value must be a JWT signed with the org's monday.com signing secret. If a valid stored token exists for that monday user, redirects to the app's authentication URL (or monday's `backToUrl`) with a signed hand-off; otherwise sets a per-state browser cookie and redirects to monday.com's consent screen.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/monday.com/auth/index.ts"
      }
    },
    "/api/v1/auth/monday.com/callback/{orgId}": {
      "get": {
        "operationId": "auth.mondayCom.callback.get",
        "summary": "Handle the monday.com OAuth callback",
        "description": "No router-level gate: the `state` must be the signed hand-off and must arrive in the same browser that started it, otherwise 401. Exchanges the code, refuses and revokes a token whose owner is not the monday user the state names, stores the token for that monday user and redirects with a signed hand-off for the linked app user.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/monday.com/auth/index.ts"
      }
    },
    "/api/v1/auth/monday.com/credentials/{orgId}": {
      "post": {
        "operationId": "auth.mondayCom.credentials.create",
        "summary": "List the saved monday.com credential for the calling monday user",
        "description": "Called by monday.com with an Authorization JWT signed with the org's signing secret (401 otherwise). Returns at most one entry, titled with the linked app user and valued with the row's id, or an empty list when no token is saved.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/monday.com/auth/index.ts"
      }
    },
    "/api/v1/auth/monday.com/credentials/{orgId}/delete": {
      "post": {
        "operationId": "auth.mondayCom.credentials.delete.create",
        "summary": "Delete a saved monday.com credential",
        "description": "Called by monday.com with an Authorization JWT signed with the org's signing secret (401 otherwise). Revokes the tokens at monday.com and removes them only when the credential belongs to the caller; answers 200 with an empty body either way.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "payload": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "credentialsId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 64
                      },
                      "credentialId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 64
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/monday.com/auth/index.ts"
      }
    },
    "/api/v1/auth/oauth2/agent/identity": {
      "post": {
        "operationId": "oauth2.agent.identity.create",
        "summary": "Register an agent for a person by their email address",
        "description": "Open to any caller; the org comes from the `org` query parameter. Accepts the auth.md email method (`service_auth` with `login_hint`, or `identity_assertion` with `verified_email`) and answers a claim token plus a device-style user code and verification link for the person to confirm; the agent then polls the token endpoint with the claim grant. Answers 400 `service_auth_not_enabled` unless the org has turned on agent registration with a usable agent client, and 400 `anonymous_not_enabled` or `issuer_not_enabled` for the other registration methods.",
        "tags": [
          "OAuth 2.0"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "login_hint": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "assertion_type": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "assertion": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "scope": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "resource": {
                    "anyOf": [
                      {
                        "type": [
                          "string",
                          "number",
                          "boolean",
                          "null"
                        ],
                        "maxLength": 4096
                      },
                      {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                          "type": "string",
                          "maxLength": 4096
                        }
                      }
                    ]
                  }
                }
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "login_hint": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "assertion_type": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "assertion": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "scope": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "resource": {
                    "anyOf": [
                      {
                        "type": [
                          "string",
                          "number",
                          "boolean",
                          "null"
                        ],
                        "maxLength": 4096
                      },
                      {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                          "type": "string",
                          "maxLength": 4096
                        }
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "claim": {
                      "properties": {
                        "expires_in": {
                          "type": "integer"
                        },
                        "interval": {
                          "type": "integer"
                        },
                        "user_code": {
                          "type": "string"
                        },
                        "verification_uri": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "claim_token": {
                      "type": "string"
                    },
                    "claim_token_expires": {
                      "type": "string"
                    },
                    "claim_url": {
                      "type": "string"
                    },
                    "registration_type": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "claim": {
                    "expires_in": 600,
                    "interval": 5,
                    "user_code": "[REDACTED]",
                    "verification_uri": "http://localhost:4103/v1/device?org=000000000000000000000001"
                  },
                  "claim_token": "[REDACTED]",
                  "claim_token_expires": "[REDACTED]",
                  "claim_url": "http://localhost:3000/api/v1/auth/oauth2/agent/identity/claim?org=000000000000000000000001",
                  "registration_type": "service_auth"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/OAuthError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/oauth2/agent/index.ts"
      }
    },
    "/api/v1/auth/oauth2/agent/identity/claim": {
      "post": {
        "operationId": "oauth2.agent.identity.claim.create",
        "summary": "Renew the confirmation code of an agent registration",
        "description": "Open to any caller holding the claim token; the org comes from the `org` query parameter. Starts a fresh confirmation attempt for the same email address and denies the previous code, so only the newest code can complete the registration. Answers 410 `claim_expired` for an expired or unknown claim token and 400 `invalid_login_hint` when the email is not the one the registration was made for.",
        "tags": [
          "OAuth 2.0"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "claim_token": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "email": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "login_hint": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  }
                }
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "claim_token": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "email": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "login_hint": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "claim_attempt": {
                      "properties": {
                        "expires_in": {
                          "type": "integer"
                        },
                        "interval": {
                          "type": "integer"
                        },
                        "user_code": {
                          "type": "string"
                        },
                        "verification_uri": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "expires_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "claim_attempt": {
                    "expires_in": 600,
                    "interval": 5,
                    "user_code": "[REDACTED]",
                    "verification_uri": "http://localhost:4103/v1/device?org=000000000000000000000001"
                  },
                  "expires_at": "2026-01-01T00:00:00.000Z",
                  "status": "initiated"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/OAuthError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/oauth2/agent/index.ts"
      }
    },
    "/api/v1/auth/oauth2/authorize": {
      "get": {
        "operationId": "oauth2.authorize.list",
        "summary": "Start an OAuth 2.0 authorization code request",
        "description": "Validates the client and its registered redirect URI (errors there answer 400 JSON), then redirects to the hosted sign-in page; later parameter errors are redirected back to the client as RFC 6749 error responses. Only `response_type=code` is supported, PKCE with `S256` is required for agent clients and for clients configured to require it (RFC 7636), and scope and RFC 8707 resource indicators are passed through without interpretation.",
        "tags": [
          "OAuth 2.0"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/oauth2/index.ts"
      }
    },
    "/api/v1/auth/oauth2/callback/{tokenId}": {
      "get": {
        "operationId": "oauth2.callback.get",
        "summary": "Complete sign-in and redirect to the client with an authorization code",
        "description": "The hosted sign-in page returns here with a one-time internal code; the handler checks it, refuses codes minted before a password change, and redirects to the client's redirect URI with a new OAuth 2.0 authorization code and the original `state`. Agent clients need a recorded consent covering the requested scopes, otherwise the client receives `access_denied`. Answers 400 when the sign-in request has expired or the code is invalid.",
        "tags": [
          "OAuth 2.0"
        ],
        "parameters": [
          {
            "name": "tokenId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/auth/oauth2/callback/index.ts"
      }
    },
    "/api/v1/auth/oauth2/device_authorization": {
      "post": {
        "operationId": "oauth2.deviceAuthorization.create",
        "summary": "Start a device authorization request",
        "description": "The RFC 8628 device authorization endpoint; the org comes from the `org` query parameter. The client authenticates with `client_id` and `client_secret` in the body or with HTTP Basic, and a public client (`token_endpoint_auth_method` none) by its `client_id` alone. Answers a device code, a user code and the hosted verification URI; 401 `invalid_client` on failed client authentication and 400 `unauthorized_client` when the client may not use the device code grant.",
        "tags": [
          "OAuth 2.0"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "client_secret": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "scope": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "resource": {
                    "anyOf": [
                      {
                        "type": [
                          "string",
                          "number",
                          "boolean",
                          "null"
                        ],
                        "maxLength": 4096
                      },
                      {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                          "type": "string",
                          "maxLength": 4096
                        }
                      }
                    ]
                  }
                }
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "client_secret": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "scope": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "resource": {
                    "anyOf": [
                      {
                        "type": [
                          "string",
                          "number",
                          "boolean",
                          "null"
                        ],
                        "maxLength": 4096
                      },
                      {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                          "type": "string",
                          "maxLength": 4096
                        }
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "device_code": {
                      "type": "string"
                    },
                    "expires_in": {
                      "type": "integer"
                    },
                    "interval": {
                      "type": "integer"
                    },
                    "user_code": {
                      "type": "string"
                    },
                    "verification_uri": {
                      "type": "string"
                    },
                    "verification_uri_complete": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "device_code": "[REDACTED]",
                  "expires_in": 600,
                  "interval": 5,
                  "user_code": "[REDACTED]",
                  "verification_uri": "http://localhost:4103/v1/device?org=000000000000000000000001",
                  "verification_uri_complete": "http://localhost:4103/v1/device?org=000000000000000000000001&user_code=[REDACTED]"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/OAuthError"
          },
          "401": {
            "$ref": "#/components/responses/OAuthInvalidClient"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "oauth-endpoint",
            "windowMs": 60000,
            "max": 300,
            "per": "ip"
          },
          {
            "prefix": "oauth-device-start",
            "windowMs": 60000,
            "max": 30,
            "per": "oauthClientLimiterKey"
          }
        ],
        "x-source": "server/src/routes/v1/auth/oauth2/device/index.ts"
      }
    },
    "/api/v1/auth/oauth2/introspect": {
      "post": {
        "operationId": "oauth2.introspect.create",
        "summary": "Introspect a refresh token",
        "description": "RFC 7662 token introspection for the refresh tokens the platform issues; access tokens are minted by the app's own server and are not covered. The client authenticates with `client_id` and `client_secret` in the body or with HTTP Basic, and a public client by its `client_id` alone; failed client authentication answers 401 and a missing `token` answers 400. A token that is unknown, expired, consumed, belongs to another client or whose user is deleted or blocked answers only `active: false`.",
        "tags": [
          "OAuth 2.0"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "token_type_hint": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "client_id": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "client_secret": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  }
                }
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "token_type_hint": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "client_id": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "client_secret": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "active": {
                      "type": "boolean"
                    },
                    "client_id": {
                      "type": "string"
                    },
                    "exp": {
                      "type": "integer"
                    },
                    "iat": {
                      "type": "integer"
                    },
                    "iss": {
                      "type": "string"
                    },
                    "sub": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "active": true,
                  "client_id": "Onk5TwQjhFIJ86vH7qEcuP4F1iVC6lZRUFz6brd1",
                  "exp": 1796972683,
                  "iat": 1794380683,
                  "iss": "http://localhost:3000/org/000000000000000000000001",
                  "sub": "000000000000000000000002"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/OAuthError"
          },
          "401": {
            "$ref": "#/components/responses/OAuthInvalidClient"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "oauth-endpoint",
            "windowMs": 60000,
            "max": 300,
            "per": "ip"
          },
          {
            "prefix": "oauth-client",
            "windowMs": 60000,
            "max": 150,
            "per": "oauthClientLimiterKey"
          }
        ],
        "x-source": "server/src/routes/v1/auth/oauth2/introspect/index.ts"
      }
    },
    "/api/v1/auth/oauth2/register": {
      "post": {
        "operationId": "oauth2.register.create",
        "summary": "Register an OAuth client dynamically",
        "description": "RFC 7591 dynamic client registration, open to any caller once the org has enabled it and chosen a base client (403 `access_denied` otherwise, or when the org's client limit is reached). The new client is an agent client that requires PKCE and inherits the base client's app-bridge URLs; it answers 201 with the client credentials (no secret for `token_endpoint_auth_method` none) and an RFC 7592 registration access token. Records an audit entry.",
        "tags": [
          "OAuth 2.0"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "redirect_uris": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2000
                    },
                    "minItems": 1,
                    "maxItems": 20
                  },
                  "client_name": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "scope": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "grant_types": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 200
                    },
                    "maxItems": 20
                  },
                  "response_types": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 200
                    },
                    "maxItems": 20
                  },
                  "token_endpoint_auth_method": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "contacts": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 200
                    },
                    "maxItems": 20
                  },
                  "logo_uri": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "client_uri": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "policy_uri": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "tos_uri": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "software_id": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "software_version": {
                    "type": "string",
                    "maxLength": 200
                  }
                },
                "required": [
                  "redirect_uris"
                ],
                "additionalProperties": true
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "redirect_uris": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2000
                    },
                    "minItems": 1,
                    "maxItems": 20
                  },
                  "client_name": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "scope": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "grant_types": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 200
                    },
                    "maxItems": 20
                  },
                  "response_types": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 200
                    },
                    "maxItems": 20
                  },
                  "token_endpoint_auth_method": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "contacts": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 200
                    },
                    "maxItems": 20
                  },
                  "logo_uri": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "client_uri": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "policy_uri": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "tos_uri": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "software_id": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "software_version": {
                    "type": "string",
                    "maxLength": 200
                  }
                },
                "required": [
                  "redirect_uris"
                ],
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "client_id": {
                      "type": "string"
                    },
                    "client_id_issued_at": {
                      "type": "integer"
                    },
                    "client_name": {
                      "type": "string"
                    },
                    "client_secret": {
                      "type": "string"
                    },
                    "client_secret_expires_at": {
                      "type": "integer"
                    },
                    "grant_types": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "redirect_uris": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "registration_access_token": {
                      "type": "string"
                    },
                    "registration_client_uri": {
                      "type": "string"
                    },
                    "response_types": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "token_endpoint_auth_method": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "client_id": "lyNLqehujJcQdxcET2INCEQEE0s77ABUNqHAECvL",
                  "client_id_issued_at": 1794380685,
                  "client_name": "Sec Agent",
                  "client_secret": "[REDACTED]",
                  "client_secret_expires_at": 0,
                  "grant_types": [
                    "authorization_code",
                    "refresh_token"
                  ],
                  "redirect_uris": [
                    "https://app.example.com/cb0",
                    "https://app.example.com/cb1",
                    "https://app.example.com/cb2",
                    "https://app.example.com/cb3",
                    "https://app.example.com/cb4",
                    "https://app.example.com/cb5",
                    "https://app.example.com/cb6",
                    "https://app.example.com/cb7",
                    "https://app.example.com/cb8",
                    "https://app.example.com/cb9"
                  ],
                  "registration_access_token": "[REDACTED]",
                  "registration_client_uri": "http://localhost:3000/api/v1/auth/oauth2/register/lyNLqehujJcQdxcET2INCEQEE0s77ABUNqHAECvL?org=000000000000000000000001",
                  "response_types": [
                    "code"
                  ],
                  "scope": "",
                  "token_endpoint_auth_method": "[REDACTED]"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "dcr",
            "windowMs": 60000,
            "max": 5,
            "per": "ip"
          },
          {
            "prefix": "dcr-address",
            "windowMs": 3600000,
            "max": 10,
            "per": "dcrAddressLimiterKey"
          }
        ],
        "x-source": "server/src/routes/v1/auth/oauth2/register/index.ts",
        "x-events": [
          "auth.client_self_registered"
        ]
      }
    },
    "/api/v1/auth/oauth2/register/{clientId}": {
      "get": {
        "operationId": "oauth2.register.get",
        "summary": "Get a dynamically registered client's configuration",
        "description": "RFC 7592 client read, authenticated with the registration access token as a Bearer token (401 `invalid_token` otherwise, including for unknown clients). Each successful read rotates the registration access token and returns the new one, so the client must replace its stored token.",
        "tags": [
          "OAuth 2.0"
        ],
        "parameters": [
          {
            "name": "clientId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "client_id": {
                      "type": "string"
                    },
                    "client_name": {
                      "type": "string"
                    },
                    "client_secret": {
                      "type": "string"
                    },
                    "client_secret_expires_at": {
                      "type": "integer"
                    },
                    "grant_types": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "redirect_uris": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "registration_access_token": {
                      "type": "string"
                    },
                    "registration_client_uri": {
                      "type": "string"
                    },
                    "response_types": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "token_endpoint_auth_method": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "client_id": "H3g33Wx7by8SVqZ7QihNRASSNQaQEeVWWPfItsTF",
                  "client_name": "Audit Test Agent",
                  "client_secret": "[REDACTED]",
                  "client_secret_expires_at": 0,
                  "grant_types": [
                    "authorization_code",
                    "refresh_token"
                  ],
                  "redirect_uris": [
                    "https://agent.example.com/callback"
                  ],
                  "registration_access_token": "[REDACTED]",
                  "registration_client_uri": "http://localhost:3000/api/v1/auth/oauth2/register/H3g33Wx7by8SVqZ7QihNRASSNQaQEeVWWPfItsTF?org=000000000000000000000001",
                  "response_types": [
                    "code"
                  ],
                  "scope": "",
                  "token_endpoint_auth_method": "[REDACTED]"
                },
                "x-observed": true
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/oauth2/register/index.ts"
      },
      "put": {
        "operationId": "oauth2.register.update",
        "summary": "Update a dynamically registered client's configuration",
        "description": "RFC 7592 client update, authenticated with the registration access token as a Bearer token. Only `redirect_uris` and `client_name` change, and an omitted `client_name` resets to the server default; a changed `client_id` or `client_secret` answers 400. Rotates the registration access token and records the before and after in the audit log.",
        "tags": [
          "OAuth 2.0"
        ],
        "parameters": [
          {
            "name": "clientId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 256
                  },
                  "client_secret": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 1024
                  },
                  "redirect_uris": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "maxItems": 100,
                    "items": {
                      "type": "string",
                      "maxLength": 2048
                    }
                  },
                  "client_name": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 1000
                  }
                },
                "additionalProperties": true
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 256
                  },
                  "client_secret": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 1024
                  },
                  "redirect_uris": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "maxItems": 100,
                    "items": {
                      "type": "string",
                      "maxLength": 2048
                    }
                  },
                  "client_name": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 1000
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "client_id": {
                      "type": "string"
                    },
                    "client_name": {
                      "type": "string"
                    },
                    "client_secret": {
                      "type": "string"
                    },
                    "client_secret_expires_at": {
                      "type": "integer"
                    },
                    "grant_types": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "redirect_uris": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "registration_access_token": {
                      "type": "string"
                    },
                    "registration_client_uri": {
                      "type": "string"
                    },
                    "response_types": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "token_endpoint_auth_method": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "client_id": "Onk5TwQjhFIJ86vH7qEcuP4F1iVC6lZRUFz6brd1",
                  "client_name": "E2E Dynamic Agent v2",
                  "client_secret": "[REDACTED]",
                  "client_secret_expires_at": 0,
                  "grant_types": [
                    "authorization_code",
                    "refresh_token"
                  ],
                  "redirect_uris": [
                    "http://127.0.0.1:9975/callback",
                    "http://127.0.0.1:9976/callback"
                  ],
                  "registration_access_token": "[REDACTED]",
                  "registration_client_uri": "http://localhost:3000/api/v1/auth/oauth2/register/Onk5TwQjhFIJ86vH7qEcuP4F1iVC6lZRUFz6brd1?org=000000000000000000000001",
                  "response_types": [
                    "code"
                  ],
                  "scope": "",
                  "token_endpoint_auth_method": "[REDACTED]"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/oauth2/register/index.ts"
      },
      "delete": {
        "operationId": "oauth2.register.delete",
        "summary": "Delete a dynamically registered client",
        "description": "RFC 7592 client deletion, authenticated with the registration access token as a Bearer token and allowed even after the org turns registration off. Revokes the client's consents, refresh tokens and grant-bound sessions and notifies the app's revoke URL before deleting the client; answers 204.",
        "tags": [
          "OAuth 2.0"
        ],
        "parameters": [
          {
            "name": "clientId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/oauth2/register/index.ts"
      }
    },
    "/api/v1/auth/oauth2/revoke": {
      "post": {
        "operationId": "oauth2.revoke.create",
        "summary": "Revoke a refresh token",
        "description": "RFC 7009 token revocation. The client authenticates with `client_id` and `client_secret` in the body or with HTTP Basic, and a public client by its `client_id` alone; only failed client authentication answers 401, and every other request answers 200 whether or not the token was found. Revoking a token of the caller's client deletes it (an agent client's whole rotation family), ends the user's sessions for that client and notifies the app's revoke URL.",
        "tags": [
          "OAuth 2.0"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "token_type_hint": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "client_id": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "client_secret": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  }
                }
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "token_type_hint": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "client_id": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "client_secret": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                },
                "example": "OK",
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/OAuthError"
          },
          "401": {
            "$ref": "#/components/responses/OAuthInvalidClient"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "oauth-endpoint",
            "windowMs": 60000,
            "max": 300,
            "per": "ip"
          },
          {
            "prefix": "oauth-client",
            "windowMs": 60000,
            "max": 150,
            "per": "oauthClientLimiterKey"
          }
        ],
        "x-source": "server/src/routes/v1/auth/oauth2/revoke/index.ts"
      }
    },
    "/api/v1/auth/oauth2/token": {
      "post": {
        "operationId": "oauth2.token.create",
        "summary": "Exchange a grant for an access token",
        "description": "Supports the `authorization_code`, `refresh_token`, device code (RFC 8628), auth.md claim and ID-JAG (`urn:ietf:params:oauth:grant-type:jwt-bearer`) grants; the access token is minted by the app's own server, and a failure there answers 503 `temporarily_unavailable`. Clients authenticate with `client_id` and `client_secret` in the body or with HTTP Basic, public clients by `client_id` plus PKCE; refresh of a non-agent client's token needs no client authentication. Errors use the RFC 6749 error shape, and every answer carries `Cache-Control: no-store`.",
        "tags": [
          "OAuth 2.0"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "grant_type": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "code": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "redirect_uri": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "code_verifier": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "refresh_token": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "device_code": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "claim_token": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "client_id": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "client_secret": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "resource": {
                    "anyOf": [
                      {
                        "type": [
                          "string",
                          "number",
                          "boolean",
                          "null"
                        ],
                        "maxLength": 4096
                      },
                      {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                          "type": "string",
                          "maxLength": 4096
                        }
                      }
                    ]
                  }
                }
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "grant_type": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "code": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "redirect_uri": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "code_verifier": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "refresh_token": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "device_code": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "claim_token": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "client_id": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "client_secret": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ],
                    "maxLength": 4096
                  },
                  "resource": {
                    "anyOf": [
                      {
                        "type": [
                          "string",
                          "number",
                          "boolean",
                          "null"
                        ],
                        "maxLength": 4096
                      },
                      {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                          "type": "string",
                          "maxLength": 4096
                        }
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "access_token": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "expires_in": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "refresh_token": {
                      "type": "string"
                    },
                    "resource": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "token_type": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "access_token": "[REDACTED]",
                  "email": "user@example.com",
                  "expires_in": 900,
                  "name": "Session User authtime-priya",
                  "refresh_token": "[REDACTED]",
                  "scope": "files:read",
                  "token_type": "[REDACTED]"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/OAuthError"
          },
          "401": {
            "$ref": "#/components/responses/OAuthInvalidClient"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "oauth-endpoint",
            "windowMs": 60000,
            "max": 300,
            "per": "ip"
          },
          {
            "prefix": "oauth-client",
            "windowMs": 60000,
            "max": 150,
            "per": "oauthClientLimiterKey"
          }
        ],
        "x-source": "server/src/routes/v1/auth/oauth2/token/index.ts"
      }
    },
    "/api/v1/auth/otp/send": {
      "post": {
        "operationId": "auth.otp.send.create",
        "summary": "Send a one-time email code for sign-in or sign-up",
        "description": "Called with the hosted sign-in context. Answers the same success message whether or not the address has an account; an email is sent only to an existing, unblocked account or for an allowed sign-up. Answers 403 when email codes are off or sign-up is closed, 429 during the resend cooldown or when the address has asked for too many codes, and the email-sender refusal status when the org has no usable sender.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "intent": {
                    "type": "string",
                    "enum": [
                      "sign-in",
                      "sign-up"
                    ]
                  },
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 200
                  },
                  "turnstileToken": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "captchaToken": {
                    "type": "string",
                    "maxLength": 8192
                  },
                  "invitationToken": {
                    "type": "string",
                    "minLength": 64,
                    "maxLength": 64
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "timezone": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "country": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "language": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "currency": {
                        "type": "string",
                        "maxLength": 64
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "email",
                  "intent"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/otp/index.ts"
      }
    },
    "/api/v1/auth/otp/verify": {
      "post": {
        "operationId": "auth.otp.verify.create",
        "summary": "Verify a one-time email code and sign the person in",
        "description": "Called with the hosted sign-in context. Creates the account when the code was sent for a sign-up, then answers a login token or a second-step challenge (`mfaRequired`). Answers 400 for a wrong code, 401 for an expired one, and 403 for an agent account, closed sign-up or a sign-in the person's company refuses.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "code": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 12
                  }
                },
                "required": [
                  "email",
                  "code"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/otp/index.ts",
        "x-events": [
          "user.registered",
          "user.logged_in"
        ]
      }
    },
    "/api/v1/auth/passkey/list": {
      "get": {
        "operationId": "auth.passkey.list.list",
        "summary": "List the signed-in user's passkeys",
        "description": "Requires the user's login token. Answers a summary of each passkey registered to the account.",
        "tags": [
          "Auth"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "loginToken": [],
            "signInState": []
          },
          {
            "loginToken": [],
            "orgQuery": []
          }
        ],
        "x-auth": "login-token",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/auth/passkey/index.ts"
      }
    },
    "/api/v1/auth/passkey/login/options": {
      "post": {
        "operationId": "auth.passkey.login.options.create",
        "summary": "Start a passkey sign-in",
        "description": "Called with the hosted sign-in context. Answers WebAuthn authentication options and an `optionsId` for the verify step. Answers 403 when passkey sign-in is not turned on for the app.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "options": {
                      "properties": {
                        "challenge": {
                          "type": "string"
                        },
                        "rpId": {
                          "type": "string"
                        },
                        "timeout": {
                          "type": "integer"
                        },
                        "userVerification": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "optionsId": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "options": {
                    "challenge": "-7l35qhwVvowcN33AA6YGbn96YVOVqsX3_h6ZxifCuM",
                    "rpId": "localhost",
                    "timeout": 60000,
                    "userVerification": "preferred"
                  },
                  "optionsId": "4wFztfudFMsG4EaC0VBgs9tF4FMKjMGrJw2hqxzj"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/passkey/index.ts"
      }
    },
    "/api/v1/auth/passkey/login/verify": {
      "post": {
        "operationId": "auth.passkey.login.verify.create",
        "summary": "Verify a passkey assertion and sign the person in",
        "description": "Called with the hosted sign-in context. Spends the challenge, checks the assertion against the stored passkey and answers the user and a login token, or a second-step challenge (`mfaRequired`). Refuses an unknown passkey, a blocked account, required SSO or a method the person's company does not allow.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "optionsId": {
                    "type": "string",
                    "minLength": 10
                  },
                  "response": {
                    "type": "object"
                  }
                },
                "required": [
                  "optionsId",
                  "response"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "deviceToken": {
                          "type": "string"
                        },
                        "token": {
                          "type": "string"
                        },
                        "user": {
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "enrollRequired": {
                      "type": "boolean"
                    },
                    "factors": {
                      "items": {
                        "properties": {
                          "backupCodesRemaining": {
                            "type": "integer"
                          },
                          "type": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "mfaRequired": {
                      "type": "boolean"
                    },
                    "mfaToken": {
                      "type": "string"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "deviceToken": "[REDACTED]",
                    "token": "[REDACTED]",
                    "user": {
                      "name": "Session User m19-issuer-initech-owner",
                      "role": "user"
                    }
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/passkey/index.ts",
        "x-events": [
          "user.logged_in"
        ]
      }
    },
    "/api/v1/auth/passkey/register/options": {
      "post": {
        "operationId": "auth.passkey.register.options.create",
        "summary": "Start registering a passkey for the signed-in user",
        "description": "Requires the user's login token. Answers WebAuthn registration options and an `optionsId`. Answers 409 for a guest account, and 403 when the person's company rules refuse the enrolment or the account already holds the most passkeys it can.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "options": {
                      "properties": {
                        "attestation": {
                          "type": "string"
                        },
                        "authenticatorSelection": {
                          "properties": {
                            "requireResidentKey": {
                              "type": "boolean"
                            },
                            "residentKey": {
                              "type": "string"
                            },
                            "userVerification": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "challenge": {
                          "type": "string"
                        },
                        "excludeCredentials": {
                          "items": {
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "transports": {
                                "items": {
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "type": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "extensions": {
                          "properties": {
                            "credProps": {
                              "type": "boolean"
                            }
                          },
                          "type": "object"
                        },
                        "hints": {
                          "type": "array"
                        },
                        "pubKeyCredParams": {
                          "items": {
                            "properties": {
                              "alg": {
                                "type": "integer"
                              },
                              "type": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "rp": {
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "timeout": {
                          "type": "integer"
                        },
                        "user": {
                          "properties": {
                            "displayName": {
                              "type": "string"
                            },
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "optionsId": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "options": {
                    "attestation": "none",
                    "authenticatorSelection": {
                      "requireResidentKey": false,
                      "residentKey": "[REDACTED]",
                      "userVerification": "preferred"
                    },
                    "challenge": "NK9ZdMcDW4i81ScOdKzhk5njcsF1AsY8JK60-bu8FXE",
                    "excludeCredentials": [
                      {
                        "id": "ekTOcArLyf-a3XEbAiR4jXk5eCEwTR5oADA8PpzRaes",
                        "transports": [
                          "internal"
                        ],
                        "type": "public-key"
                      }
                    ],
                    "extensions": {
                      "credProps": true
                    },
                    "hints": [],
                    "pubKeyCredParams": [
                      {
                        "alg": 0,
                        "type": "[REDACTED]"
                      },
                      {
                        "alg": 0,
                        "type": "[REDACTED]"
                      },
                      {
                        "alg": 0,
                        "type": "[REDACTED]"
                      }
                    ],
                    "rp": {
                      "id": "localhost",
                      "name": "update.e2e-example.com"
                    },
                    "timeout": 60000,
                    "user": {
                      "displayName": "Passkey Person · update.e2e-example.com",
                      "id": "NmFmNDE2NGFiZjBkMmUzM2E5ODRlMmJm",
                      "name": "user@example.com · update.e2e-example.com"
                    }
                  },
                  "optionsId": "xEdeaZyqpg0kWc5aPghUll7BRESV4jQ2GvFkoeTf"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "loginToken": [],
            "signInState": []
          },
          {
            "loginToken": [],
            "orgQuery": []
          }
        ],
        "x-auth": "login-token",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/passkey/index.ts"
      }
    },
    "/api/v1/auth/passkey/register/verify": {
      "post": {
        "operationId": "auth.passkey.register.verify.create",
        "summary": "Verify a new passkey and save it to the signed-in user's account",
        "description": "Requires the user's login token. Spends the challenge, verifies the attestation and stores the passkey. Refuses a passkey that is already registered, and answers 403 when the company rules refuse it or the account already holds the most passkeys it can.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "optionsId": {
                    "type": "string",
                    "minLength": 10
                  },
                  "response": {
                    "type": "object"
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 100,
                    "anyOf": [
                      {
                        "maxLength": 0
                      },
                      {
                        "minLength": 2
                      }
                    ]
                  }
                },
                "required": [
                  "optionsId",
                  "response"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "active": {
                          "type": "boolean"
                        },
                        "backedUp": {
                          "type": "boolean"
                        },
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "deviceType": {
                          "type": "string"
                        },
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "rpId": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "signInWithPasskey": {
                      "type": "boolean"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "active": true,
                    "backedUp": false,
                    "createdAt": "2026-01-01T00:00:00.000Z",
                    "deviceType": "singleDevice",
                    "id": "000000000000000000000001",
                    "name": "Priya laptop",
                    "rpId": "localhost"
                  },
                  "signInWithPasskey": true,
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "loginToken": [],
            "signInState": []
          },
          {
            "loginToken": [],
            "orgQuery": []
          }
        ],
        "x-auth": "login-token",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/passkey/index.ts"
      }
    },
    "/api/v1/auth/passkey/{id}": {
      "delete": {
        "operationId": "auth.passkey.delete",
        "summary": "Remove one of the signed-in user's passkeys",
        "description": "Requires the user's login token. Answers 404 when the passkey is not the user's, 409 when it is the last passkey the person's company requires, and 403 when the company requires a recent passkey sign-in before removing one.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "loginToken": [],
            "signInState": []
          },
          {
            "loginToken": [],
            "orgQuery": []
          }
        ],
        "x-auth": "login-token",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/passkey/index.ts"
      }
    },
    "/api/v1/auth/phone/register": {
      "post": {
        "operationId": "auth.phone.register.create",
        "summary": "Create an account for a verified phone number and sign in",
        "description": "Called with the hosted sign-in context, using the `signupToken` from phone verification (401 once it has expired or after three tries). Creates the account with the phone and the given email, then answers a login token or a second-step challenge. Answers 409 when the email cannot be used, 403 when sign-up is closed, and 400 for a disposable address.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "signupToken": {
                    "type": "string",
                    "minLength": 40,
                    "maxLength": 40
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 320
                  },
                  "turnstileToken": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "captchaToken": {
                    "type": "string",
                    "maxLength": 8192
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "timezone": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "country": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "language": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "currency": {
                        "type": "string",
                        "maxLength": 64
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "signupToken",
                  "name",
                  "email"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/phone/index.ts",
        "x-events": [
          "user.registered",
          "user.phone_added",
          "user.phone_verified",
          "user.logged_in"
        ]
      }
    },
    "/api/v1/auth/phone/send": {
      "post": {
        "operationId": "auth.phone.send.create",
        "summary": "Send a one-time code to a phone number",
        "description": "Called with the hosted sign-in context. Answers the same success message whether or not the number has an account; a code is delivered only to an existing, unblocked account or when public sign-up is open. Answers 403 when phone sign-in or the chosen channel is not offered, 400 for an invalid number, and 503 when no SMS provider is configured.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "phone": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32
                  },
                  "channel": {
                    "type": "string",
                    "enum": [
                      "sms",
                      "whatsapp",
                      "voice"
                    ]
                  },
                  "turnstileToken": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "captchaToken": {
                    "type": "string",
                    "maxLength": 8192
                  }
                },
                "required": [
                  "phone"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "retryAfter": {
                      "type": "integer"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "message": "We sent a code to your phone.",
                  "retryAfter": 30,
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/phone/index.ts"
      }
    },
    "/api/v1/auth/phone/verify": {
      "post": {
        "operationId": "auth.phone.verify.create",
        "summary": "Verify a phone code and sign the person in",
        "description": "Called with the hosted sign-in context. For a number with an account, marks the phone verified and answers a login token or a second-step challenge; for a new number, answers `signupRequired` with a `signupToken` for registration. Answers 400 for a wrong code, 401 for an expired one, and 403 for a blocked account.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "phone": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32
                  },
                  "code": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 10
                  }
                },
                "required": [
                  "phone",
                  "code"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "deviceToken": {
                      "type": "string"
                    },
                    "enrollRequired": {
                      "type": "boolean"
                    },
                    "factors": {
                      "items": {
                        "properties": {
                          "backupCodesRemaining": {
                            "type": "integer"
                          },
                          "type": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "mfaRequired": {
                      "type": "boolean"
                    },
                    "mfaToken": {
                      "type": "string"
                    },
                    "signupRequired": {
                      "type": "boolean"
                    },
                    "signupToken": {
                      "type": "string"
                    },
                    "success": {
                      "type": "boolean"
                    },
                    "token": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "enrollRequired": false,
                  "factors": [
                    {
                      "backupCodesRemaining": 10,
                      "type": "totp"
                    }
                  ],
                  "mfaRequired": true,
                  "mfaToken": "[REDACTED]",
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/phone/index.ts",
        "x-events": [
          "user.phone_verified",
          "user.logged_in"
        ]
      }
    },
    "/api/v1/auth/redirect": {
      "post": {
        "operationId": "auth.redirect.create",
        "summary": "Finish hosted sign-in and get the app's callback URL",
        "description": "Takes the login token in `Authorization` and the auth state header, spends the login token and returns the callback URL carrying a single-use authorization code. Answers 403 for a blocked account, a read-only token, a company or age refusal, an unverified email or an owed second step (`mfa_required` with an `mfaToken`), and 401 for a token already used or retired by a credentials change. With \"remember this device\" the device is marked trusted.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rememberMe": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                },
                "example": "http://localhost:3000/api/v1/auth/oauth2/callback/1lYGPA8BCRhd5vkCsti3syG5XKo0OCCDkJhxIo2G?code=[REDACTED]",
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "sign-in-flow",
            "windowMs": 60000,
            "max": 300,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/index.ts"
      }
    },
    "/api/v1/auth/register": {
      "post": {
        "operationId": "auth.register.create",
        "summary": "Register a new account on hosted sign-up",
        "description": "Answers 403 `method_unavailable` for a password the app does not take, 403 `signup_closed` when the org does not allow this sign-up, 400 `CAPTCHA_FAILED` for a failed security check, and 409 `username_taken`. Creates the user, sends the email verification code and returns a login token.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 100
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 320
                  },
                  "password": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 256
                  },
                  "invitationToken": {
                    "type": "string",
                    "minLength": 64,
                    "maxLength": 64
                  },
                  "turnstileToken": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "captchaToken": {
                    "type": "string",
                    "maxLength": 8192
                  },
                  "username": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "timezone": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "country": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "language": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "currency": {
                        "type": "string",
                        "maxLength": 64
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "name",
                  "email"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "deviceToken": {
                          "type": "string"
                        },
                        "passkeySetup": {
                          "type": "boolean"
                        },
                        "token": {
                          "type": "string"
                        },
                        "user": {
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "message": {
                      "type": "string"
                    },
                    "passkeySetup": {
                      "type": "boolean"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "message": "Your company does not allow that way to sign in here. Choose another way, or ask your IT team.",
                  "reason": "sign_in_method_not_allowed",
                  "success": false
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "login",
            "windowMs": 60000,
            "max": 20,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/index.ts",
        "x-events": [
          "user.registered"
        ]
      }
    },
    "/api/v1/auth/request": {
      "post": {
        "operationId": "auth.request.create",
        "summary": "Start a hosted sign-in and get the sign-in page URL",
        "description": "No router-level gate: the org and client come in the body. Checks the client belongs to the org and both redirect URLs are registered for it, refuses agent clients (they use the OAuth2 flow), stores the sign-in state and returns the hosted page URL. Answers 503 `temporarily_unavailable` when the state cannot be stored.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orgId": {
                    "type": "string",
                    "format": "tenantKey"
                  },
                  "clientId": {
                    "type": "string"
                  },
                  "redirect": {
                    "type": "object",
                    "properties": {
                      "success": {
                        "type": "string",
                        "format": "uri"
                      },
                      "error": {
                        "type": "string",
                        "format": "uri"
                      }
                    },
                    "required": [
                      "success",
                      "error"
                    ],
                    "additionalProperties": false
                  },
                  "state": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "trackingConsent": {
                    "type": "object",
                    "properties": {
                      "analytics": {
                        "type": "boolean"
                      },
                      "marketing": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "analytics",
                      "marketing"
                    ],
                    "additionalProperties": false
                  },
                  "trackingIdentity": {
                    "type": "object",
                    "properties": {
                      "gaClientId": {
                        "type": "string",
                        "pattern": "^[0-9]{1,20}\\.[0-9]{1,20}$"
                      },
                      "gaSessionId": {
                        "type": "string",
                        "pattern": "^[0-9]{1,20}$"
                      }
                    },
                    "required": [],
                    "additionalProperties": false
                  },
                  "trackingAttribution": {
                    "type": "object",
                    "properties": {
                      "params": {
                        "type": "object",
                        "maxProperties": 30,
                        "propertyNames": {
                          "pattern": "^[a-z_]{2,32}$"
                        },
                        "additionalProperties": {
                          "type": "string",
                          "pattern": "^[\\w.~-]{1,200}$"
                        }
                      },
                      "capturedAt": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "landingUrl": {
                        "type": "string",
                        "maxLength": 500
                      }
                    },
                    "required": [],
                    "additionalProperties": false
                  },
                  "invitationToken": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "locale": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})?$"
                  },
                  "notice": {
                    "type": "object",
                    "properties": {
                      "reason": {
                        "type": "string",
                        "enum": [
                          "enterprise_idle",
                          "enterprise_max_age",
                          "enterprise_signout",
                          "enterprise_session_ended",
                          "enterprise_workspace"
                        ]
                      },
                      "minutes": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 1000000
                      }
                    },
                    "required": [
                      "reason"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "orgId",
                  "clientId",
                  "redirect"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "redirectUrl": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "message": {
                      "type": "string"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "message": "Agent clients must use the OAuth2 authorization flow (see the org discovery document at /.well-known/oauth-authorization-server).",
                  "success": false
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "sign-in-flow",
            "windowMs": 60000,
            "max": 300,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/index.ts"
      }
    },
    "/api/v1/auth/reset-password": {
      "post": {
        "operationId": "auth.resetPassword.create",
        "summary": "Reset a password with an emailed code",
        "description": "Checks the reset code for the email address and refuses a breached password. On success sets the new password and revokes the user's sessions and outstanding login tokens.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "password": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 256
                  },
                  "code": {
                    "type": "number"
                  }
                },
                "required": [
                  "email",
                  "password",
                  "code"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "message": "That code did not work. Check the newest reset email we sent, or send a new code.",
                  "success": false
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/index.ts",
        "x-events": [
          "user.password_changed"
        ]
      }
    },
    "/api/v1/auth/send-forgot-password-verification-code": {
      "post": {
        "operationId": "auth.sendForgotPasswordVerificationCode.create",
        "summary": "Send a password reset code by email",
        "description": "Always answers with the same generic message, whether or not an account exists. For an existing, unblocked, non-agent account it stores a reset code and emails it, subject to the send quota.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  }
                },
                "required": [
                  "email"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "message": "If an account exists for this email, a reset code has been sent.",
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/index.ts",
        "x-events": [
          "user.password_reset_requested"
        ]
      }
    },
    "/api/v1/auth/social/google/{orgId}/{methodId}/one-tap": {
      "post": {
        "operationId": "auth.social.google.oneTap.create",
        "summary": "Sign in with a Google One Tap credential",
        "description": "No router-level gate; the handler spends a nonce from the nonce route and verifies the Google credential. May create the account, then answers a single-use `handoff` code redeemed like any social sign-in. Answers 404 when One Tap is off for the method, 401 for an expired nonce, 400 for a credential Google does not confirm, and 403 when the sign-in is refused.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "methodId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "credential": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 8192
                  },
                  "nonce": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "challenge": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{43}$"
                  }
                },
                "required": [
                  "credential",
                  "nonce",
                  "challenge"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "login",
            "windowMs": 60000,
            "max": 20,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/social/one-tap.ts",
        "x-events": [
          "user.registered",
          "user.logged_in"
        ]
      }
    },
    "/api/v1/auth/social/google/{orgId}/{methodId}/one-tap/nonce": {
      "get": {
        "operationId": "auth.social.google.oneTap.nonce.list",
        "summary": "Get a single-use nonce for Google One Tap",
        "description": "No router-level gate. Answers 404 when One Tap is not enabled for the Google sign-in method.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "methodId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "nonce": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "nonce": "8g6RDaYqwtvKVfQb9vaIPDyFFmLoHF_FLxDXQ4cFOLk"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "login",
            "windowMs": 60000,
            "max": 20,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/social/one-tap.ts"
      }
    },
    "/api/v1/auth/social/{slug}/shared/callback": {
      "get": {
        "operationId": "auth.social.shared.callback.list",
        "summary": "Finish a social sign-in that used the shared development provider app",
        "description": "No router-level gate; the handler spends the stored state and only accepts a non-production environment org (400 otherwise). Finishes the sign-in or account link as the per-org callback does and redirects to the hosted sign-in page with a handoff code, or back to the app with an error.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/auth/social/index.ts",
        "x-events": [
          "user.registered",
          "user.logged_in"
        ]
      }
    },
    "/api/v1/auth/social/{slug}/{orgId}/{methodId}": {
      "get": {
        "operationId": "auth.social.get",
        "summary": "Start a social sign-in by redirecting to the provider",
        "description": "No router-level gate; the handler requires a redirect URL on the org's registered origins (400 otherwise). Redirects to the provider's authorization URL, or back to the redirect URL with an error when it cannot be built.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "methodId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "authStateId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "challenge",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{43}$"
            }
          },
          {
            "name": "invitationToken",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "redirect",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri",
              "maxLength": 2048
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "methodId": {
                          "type": "string"
                        },
                        "orgId": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "error": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "methodId": "anymethod",
                    "orgId": "000000000000000000000001"
                  },
                  "error": true,
                  "message": "invalid auth settings"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/social/index.ts"
      }
    },
    "/api/v1/auth/social/{slug}/{orgId}/{methodId}/callback": {
      "get": {
        "operationId": "auth.social.callback.list",
        "summary": "Finish a social sign-in returning from the provider",
        "description": "No router-level gate; the handler spends the stored state and redirects to the sign-in page when it has expired. Exchanges the code, may create the account or link the provider to an existing one, and redirects to the hosted sign-in page with a single-use handoff code, or back to the app with an error and reason.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "methodId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/auth/social/index.ts",
        "x-events": [
          "user.registered",
          "user.logged_in"
        ]
      },
      "post": {
        "operationId": "auth.social.callback.create",
        "summary": "Finish a social sign-in returned by form post from the provider",
        "description": "The same handler as the GET callback, reading the fields from the posted body (used by providers that answer with a form post).",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "methodId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "state": {
                    "type": "string",
                    "maxLength": 512
                  },
                  "code": {
                    "type": "string",
                    "maxLength": 4096
                  },
                  "error": {
                    "type": "string",
                    "maxLength": 256
                  },
                  "user": {
                    "type": "string",
                    "maxLength": 8192
                  },
                  "id_token": {
                    "type": "string",
                    "maxLength": 16384
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/auth/social/index.ts",
        "x-events": [
          "user.registered",
          "user.logged_in"
        ]
      }
    },
    "/api/v1/auth/supported-methods": {
      "get": {
        "operationId": "auth.supportedMethods.list",
        "summary": "List the sign-in methods offered on a hosted sign-in screen",
        "description": "Returns the methods the app's client offers for the requested screen (login, register, forgot or reset password), narrowed during a re-confirmation to the ways the account has, plus any sign-up notice and the intent of the sign-in (re-confirmation or device). The register screen returns no methods when sign-up is closed.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "invitationToken",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "screen",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "login",
                "register",
                "forgot-password",
                "reset-password"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "items": {
                        "properties": {
                          "description": {
                            "type": "string"
                          },
                          "formDetails": {
                            "properties": {
                              "button": {
                                "properties": {
                                  "title": {
                                    "type": "string"
                                  }
                                },
                                "type": "object"
                              },
                              "channels": {
                                "items": {
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "clientId": {
                                "type": "string"
                              },
                              "clientRedirectUrl": {
                                "type": "string"
                              },
                              "defaultCountry": {
                                "type": "string"
                              },
                              "delivery": {
                                "type": "string"
                              },
                              "ethereumChainIds": {
                                "items": {
                                  "type": "integer"
                                },
                                "type": "array"
                              },
                              "fields": {
                                "items": {
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    },
                                    "placeholder": {
                                      "type": "string"
                                    },
                                    "required": {
                                      "type": "boolean"
                                    },
                                    "type": {
                                      "type": "string"
                                    }
                                  },
                                  "type": "object"
                                },
                                "type": "array"
                              },
                              "links": {
                                "items": {
                                  "properties": {
                                    "href": {
                                      "type": "string"
                                    },
                                    "title": {
                                      "type": "string"
                                    }
                                  },
                                  "type": "object"
                                },
                                "type": "array"
                              },
                              "solana": {
                                "type": "boolean"
                              }
                            },
                            "type": "object"
                          },
                          "icon": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          },
                          "validScreens": {
                            "items": {
                              "type": "string"
                            },
                            "type": "array"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "intent": {
                      "properties": {
                        "clientTitle": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "kind": {
                          "type": "string"
                        },
                        "methods": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "passkeySetup": {
                          "type": "boolean"
                        },
                        "returnUrl": {
                          "type": "string"
                        },
                        "scope": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "unverified": {
                          "type": "boolean"
                        },
                        "workspace": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "signup": {
                      "properties": {
                        "open": {
                          "type": "boolean"
                        },
                        "reason": {
                          "type": "string"
                        },
                        "withheld": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": [
                    {
                      "description": "Sign in with email and password",
                      "formDetails": {
                        "button": {
                          "title": "Sign in"
                        },
                        "clientRedirectUrl": "",
                        "fields": [
                          {
                            "id": "email",
                            "name": "Email",
                            "placeholder": "user@example.com",
                            "required": true,
                            "type": "email"
                          },
                          {
                            "id": "password",
                            "name": "Password",
                            "placeholder": "",
                            "required": true,
                            "type": "password"
                          }
                        ],
                        "links": [
                          {
                            "href": "/v1/auth/forgot-password",
                            "title": "Forgot password?"
                          }
                        ]
                      },
                      "icon": "",
                      "id": "password",
                      "name": "Password",
                      "type": "form",
                      "url": "http://localhost:3000/api/v1/auth/login",
                      "validScreens": [
                        "login"
                      ]
                    },
                    {
                      "description": "Login with GitHub",
                      "icon": "http://localhost:3000/api/images/auth/github.svg",
                      "id": "github",
                      "name": "GitHub",
                      "type": "button",
                      "url": "http://localhost:3000/api/v1/auth/social/github/000000000000000000000001/EHuYtkRaAmaMqH8UVC6w",
                      "validScreens": [
                        "login",
                        "register"
                      ]
                    },
                    {
                      "description": "Login with Google",
                      "icon": "http://localhost:3000/api/images/auth/google.svg",
                      "id": "google",
                      "name": "Google",
                      "type": "button",
                      "url": "http://localhost:3000/api/v1/auth/social/google/000000000000000000000001/fTPHpsqAUeCCsW3axU7v",
                      "validScreens": [
                        "login",
                        "register"
                      ]
                    },
                    {
                      "description": "Sign in with a passkey",
                      "icon": "",
                      "id": "passkey",
                      "name": "Passkey",
                      "type": "passkey",
                      "url": "http://localhost:3000/api/v1/auth/passkey",
                      "validScreens": [
                        "login"
                      ]
                    },
                    {
                      "description": "Login with magic link",
                      "formDetails": {
                        "button": {
                          "title": "Send Magic Link"
                        },
                        "clientRedirectUrl": "/v1/auth/check-email-for-magic-link",
                        "delivery": "link",
                        "fields": [
                          {
                            "id": "email",
                            "name": "Email",
                            "placeholder": "user@example.com",
                            "required": true,
                            "type": "email"
                          }
                        ]
                      },
                      "icon": "",
                      "id": "magic-link",
                      "name": "Magic Link",
                      "type": "form",
                      "url": "http://localhost:3000/api/v1/auth/magic-link",
                      "validScreens": [
                        "login"
                      ]
                    },
                    {
                      "description": "Sign in with a code sent to your phone",
                      "formDetails": {
                        "button": {
                          "title": "Continue"
                        },
                        "channels": [
                          "sms",
                          "whatsapp",
                          "voice"
                        ],
                        "clientRedirectUrl": "",
                        "defaultCountry": "US",
                        "fields": []
                      },
                      "icon": "",
                      "id": "phone",
                      "name": "Phone",
                      "type": "phone",
                      "url": "http://localhost:3000/api/v1/auth/phone",
                      "validScreens": [
                        "login",
                        "register"
                      ]
                    },
                    {
                      "description": "Sign in with a crypto wallet",
                      "formDetails": {
                        "button": {
                          "title": "Continue with a wallet"
                        },
                        "clientRedirectUrl": "",
                        "ethereumChainIds": [
                          1,
                          137
                        ],
                        "fields": [],
                        "solana": true
                      },
                      "icon": "",
                      "id": "wallet",
                      "name": "Wallet",
                      "type": "wallet",
                      "url": "http://localhost:3000/api/v1/auth/wallet",
                      "validScreens": [
                        "login",
                        "register"
                      ]
                    },
                    {
                      "description": "Continue without an account",
                      "formDetails": {
                        "button": {
                          "title": "Continue as guest"
                        },
                        "clientRedirectUrl": "",
                        "fields": []
                      },
                      "icon": "",
                      "id": "guest",
                      "name": "Guest",
                      "type": "guest",
                      "url": "http://localhost:3000/api/v1/auth/guest",
                      "validScreens": [
                        "login"
                      ]
                    }
                  ],
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/auth/index.ts"
      }
    },
    "/api/v1/auth/token": {
      "post": {
        "operationId": "auth.token.create",
        "summary": "Exchange an authorization code for a session and user profile",
        "description": "Called by the app's backend with the client id and secret; no router-level gate. Spends the single-use code from `/redirect` and creates a session whose lifetime follows the org's session policy. Answers 400 for an invalid client, secret or code, 403 for agent clients (OAuth2 only), and 401 when the code predates a credentials change.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 1
                  },
                  "clientId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "clientSecret": {
                    "type": "string",
                    "minLength": 1
                  },
                  "orgId": {
                    "type": "string",
                    "format": "tenantKey"
                  }
                },
                "required": [
                  "code",
                  "clientId",
                  "clientSecret",
                  "orgId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "sessionId": {
                          "type": "string"
                        },
                        "user": {
                          "properties": {
                            "amr": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "authTime": {
                              "format": "date-time",
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "claims": {
                              "properties": {},
                              "type": "object"
                            },
                            "country": {
                              "type": "string"
                            },
                            "createdAt": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "currency": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            },
                            "emailVerified": {
                              "type": "boolean"
                            },
                            "firstAuthAt": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "id": {
                              "type": "string"
                            },
                            "image": {
                              "type": "string"
                            },
                            "impersonation": {
                              "properties": {
                                "actorName": {
                                  "type": "string"
                                },
                                "expiresAt": {
                                  "format": "date-time",
                                  "type": "string"
                                },
                                "readOnly": {
                                  "type": "boolean"
                                }
                              },
                              "type": "object"
                            },
                            "isAnonymous": {
                              "type": "boolean"
                            },
                            "language": {
                              "type": "string"
                            },
                            "mfaEnabled": {
                              "type": "boolean"
                            },
                            "name": {
                              "type": "string"
                            },
                            "phone": {
                              "type": "string"
                            },
                            "phoneVerified": {
                              "type": "boolean"
                            },
                            "role": {
                              "type": "string"
                            },
                            "timezone": {
                              "type": "string"
                            },
                            "username": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "sessionId": "8wn72JqeEGqTEHtuMajhMkxecCOtX0CiR5U",
                    "user": {
                      "amr": [],
                      "authTime": null,
                      "claims": {},
                      "country": "",
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "currency": "",
                      "email": "user@example.com",
                      "emailVerified": true,
                      "firstAuthAt": "2026-01-01T00:00:00.000Z",
                      "id": "000000000000000000000001",
                      "image": "",
                      "impersonation": {
                        "actorName": "E2E Admin 1767225600000",
                        "expiresAt": "2026-01-01T00:00:00.000Z",
                        "readOnly": true
                      },
                      "isAnonymous": false,
                      "language": "",
                      "mfaEnabled": false,
                      "name": "Session User harden-audit-imp",
                      "phone": "",
                      "phoneVerified": false,
                      "role": "user",
                      "timezone": "",
                      "username": ""
                    }
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "code-exchange",
            "windowMs": 60000,
            "max": 300,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/index.ts"
      }
    },
    "/api/v1/auth/tracking": {
      "get": {
        "operationId": "auth.tracking.list",
        "summary": "Get the tracking settings for the current hosted sign-in",
        "description": "Needs the auth state header (401 without a client in it). Returns the org and client ids, the org's sign-in hosts, the visitor's cookie consent and analytics identity carried from the app, and the consent prompt setting.",
        "tags": [
          "Auth"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "clientId": {
                          "type": "string"
                        },
                        "consent": {
                          "properties": {
                            "analytics": {
                              "type": "boolean"
                            },
                            "marketing": {
                              "type": "boolean"
                            }
                          },
                          "type": "object"
                        },
                        "consentPrompt": {
                          "properties": {
                            "enabled": {
                              "type": "boolean"
                            }
                          },
                          "type": "object"
                        },
                        "identity": {},
                        "orgId": {
                          "type": "string"
                        },
                        "ownDomain": {},
                        "ownHosts": {
                          "type": "array"
                        },
                        "sharedHost": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "clientId": "tM2dJvpRsAzDaTbQpl3zQJcemZdfDJzqSta4imqI",
                    "consent": {
                      "analytics": true,
                      "marketing": true
                    },
                    "consentPrompt": {
                      "enabled": true
                    },
                    "identity": null,
                    "orgId": "000000000000000000000001",
                    "ownDomain": null,
                    "ownHosts": [],
                    "sharedHost": "localhost:4103"
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/auth/index.ts"
      }
    },
    "/api/v1/auth/users/profile": {
      "get": {
        "operationId": "auth.users.profile.list",
        "summary": "Get the profile of the user the login token belongs to",
        "tags": [
          "Auth"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "claims": {
                      "properties": {},
                      "type": "object"
                    },
                    "country": {
                      "type": "string"
                    },
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "emailVerified": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    },
                    "image": {
                      "type": "string"
                    },
                    "isAnonymous": {
                      "type": "boolean"
                    },
                    "language": {
                      "type": "string"
                    },
                    "mfaEnabled": {
                      "type": "boolean"
                    },
                    "name": {
                      "type": "string"
                    },
                    "phone": {
                      "type": "string"
                    },
                    "phoneVerified": {
                      "type": "boolean"
                    },
                    "role": {
                      "type": "string"
                    },
                    "timezone": {
                      "type": "string"
                    },
                    "username": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "claims": {},
                  "country": "",
                  "createdAt": "2026-01-01T00:00:00.000Z",
                  "currency": "",
                  "email": "user@example.com",
                  "emailVerified": false,
                  "id": "000000000000000000000001",
                  "image": "",
                  "isAnonymous": false,
                  "language": "",
                  "mfaEnabled": false,
                  "name": "Test User",
                  "phone": "",
                  "phoneVerified": false,
                  "role": "user",
                  "timezone": "",
                  "username": ""
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "loginToken": [],
            "signInState": []
          },
          {
            "loginToken": [],
            "orgQuery": []
          }
        ],
        "x-auth": "login-token",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/auth/users/index.ts"
      }
    },
    "/api/v1/auth/users/send-email-verification-code": {
      "post": {
        "operationId": "auth.users.sendEmailVerificationCode.create",
        "summary": "Send an email verification code to the signed-in user",
        "description": "Needs a login token for the org. Answers `Email Already verified.` when the token says the email is verified, and 429 `EMAIL_RECIPIENT_LIMIT` when the recipient limit is reached.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "message": "Verification Email Sent successfully.",
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "loginToken": [],
            "signInState": []
          },
          {
            "loginToken": [],
            "orgQuery": []
          }
        ],
        "x-auth": "login-token",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/users/index.ts"
      }
    },
    "/api/v1/auth/users/verify-email": {
      "post": {
        "operationId": "auth.users.verifyEmail.create",
        "summary": "Verify the signed-in user's email with a code",
        "description": "Needs a login token for the org. On success returns the result, or the second step's `mfaToken` when one is owed.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "number"
                  }
                },
                "required": [
                  "code"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "token": {
                          "type": "string"
                        },
                        "user": {
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "message": {
                      "type": "string"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "token": "[REDACTED]",
                    "user": {
                      "name": "Session User authtime-priya",
                      "role": "user"
                    }
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "loginToken": [],
            "signInState": []
          },
          {
            "loginToken": [],
            "orgQuery": []
          }
        ],
        "x-auth": "login-token",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/users/index.ts",
        "x-events": [
          "user.email_verified"
        ]
      }
    },
    "/api/v1/auth/wallet/nonce": {
      "post": {
        "operationId": "auth.wallet.nonce.create",
        "summary": "Get a nonce for a wallet sign-in message",
        "description": "Called with the hosted sign-in context and its auth state. Answers 403 when wallet sign-in is not available and 400 when the app does not accept the chain.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chain": {
                    "type": "string",
                    "enum": [
                      "ethereum",
                      "solana"
                    ]
                  }
                },
                "required": [
                  "chain"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "chainIds": {
                          "items": {
                            "type": "integer"
                          },
                          "type": "array"
                        },
                        "domain": {
                          "type": "string"
                        },
                        "issuedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "nonce": {
                          "type": "string"
                        },
                        "uri": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "chainIds": [
                      1,
                      137
                    ],
                    "domain": "localhost:4103",
                    "issuedAt": "2026-01-01T00:00:00.000Z",
                    "nonce": "1Yzqvhsbg0KTz2icgPn0BZpy",
                    "uri": "http://localhost:4103"
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/wallet/index.ts"
      }
    },
    "/api/v1/auth/wallet/register": {
      "post": {
        "operationId": "auth.wallet.register.create",
        "summary": "Create an account for a verified wallet and sign in",
        "description": "Called with the hosted sign-in context, using the `signupToken` from wallet verification (401 once it has expired or after three tries). Creates the account with the given email, links the wallet, then answers a login token or a second-step challenge. Answers 409 when the email cannot be used, 403 when sign-up is closed, and 400 for a disposable address.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "signupToken": {
                    "type": "string",
                    "minLength": 40,
                    "maxLength": 40
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 320
                  },
                  "turnstileToken": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "captchaToken": {
                    "type": "string",
                    "maxLength": 8192
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "timezone": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "country": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "language": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "currency": {
                        "type": "string",
                        "maxLength": 64
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "signupToken",
                  "name",
                  "email"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "deviceToken": {
                          "type": "string"
                        },
                        "token": {
                          "type": "string"
                        },
                        "user": {
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "deviceToken": "[REDACTED]",
                    "token": "[REDACTED]",
                    "user": {
                      "name": "Wallet Person",
                      "role": "user"
                    }
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/wallet/index.ts",
        "x-events": [
          "user.registered",
          "user.account_linked",
          "user.logged_in"
        ]
      }
    },
    "/api/v1/auth/wallet/verify": {
      "post": {
        "operationId": "auth.wallet.verify.create",
        "summary": "Verify a signed wallet message and sign the person in",
        "description": "Called with the hosted sign-in context and its auth state. For a wallet linked to an account, answers the user and a login token or a second-step challenge; for an unknown wallet, answers `signupRequired` with a `signupToken` for registration. Answers 403 for a blocked account.",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chain": {
                    "type": "string",
                    "enum": [
                      "ethereum",
                      "solana"
                    ]
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4096
                  },
                  "signature": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512
                  }
                },
                "required": [
                  "chain",
                  "message",
                  "signature"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "deviceToken": {
                          "type": "string"
                        },
                        "token": {
                          "type": "string"
                        },
                        "user": {
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "enrollRequired": {
                      "type": "boolean"
                    },
                    "factors": {
                      "items": {
                        "properties": {
                          "backupCodesRemaining": {
                            "type": "integer"
                          },
                          "type": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "mfaRequired": {
                      "type": "boolean"
                    },
                    "mfaToken": {
                      "type": "string"
                    },
                    "signupRequired": {
                      "type": "boolean"
                    },
                    "signupToken": {
                      "type": "string"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "enrollRequired": false,
                  "factors": [
                    {
                      "backupCodesRemaining": 10,
                      "type": "totp"
                    }
                  ],
                  "mfaRequired": true,
                  "mfaToken": "[REDACTED]",
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "signInState": []
          },
          {
            "orgQuery": []
          }
        ],
        "x-auth": "sign-in-context",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/auth/wallet/index.ts",
        "x-events": [
          "user.logged_in"
        ]
      }
    },
    "/api/v1/beta/config": {
      "get": {
        "operationId": "beta.config.list",
        "summary": "Get an organization's public waitlist configuration",
        "description": "Public, rate limited per IP. Answers only the fields the waitlist page draws and whether approving an entry sends an email, never the email templates; 404 when the organization has no waitlist configuration.",
        "tags": [
          "Beta"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "tenantKey"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "approvalEmail": {
                      "type": "boolean"
                    },
                    "description": {
                      "type": "string"
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "logoFallBack": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "privacyPolicy": {
                      "type": "string"
                    },
                    "screen": {
                      "properties": {
                        "register": {
                          "properties": {
                            "description": {
                              "type": "string"
                            },
                            "title": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "thankYou": {
                          "properties": {
                            "description": {
                              "type": "string"
                            },
                            "title": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "termsOfService": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "approvalEmail": true,
                  "description": "Signup for beta access to the application",
                  "enabled": true,
                  "logoFallBack": "",
                  "name": "Beta Users",
                  "privacyPolicy": "",
                  "screen": {
                    "register": {
                      "description": "Register with your email for beta access",
                      "title": "Register to Beta Users"
                    },
                    "thankYou": {
                      "description": "You have successfully registered for beta access.",
                      "title": "Thank You for Registering"
                    }
                  },
                  "termsOfService": ""
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "public-org-lookup",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/beta/index.ts"
      }
    },
    "/api/v1/beta/submit": {
      "post": {
        "operationId": "beta.submit.create",
        "summary": "Join an organization's waitlist",
        "description": "Public. The name is at most 200 characters, the email 254, and timezone, language, country and currency 64 each; a longer one answers 400. Every address, new, already listed or blocklisted, gets the same thank-you answer; a new address is stored as a pending entry and the waitlist's pending email is queued when the organization has switched it on and chosen a template. Answers 429 past the per-IP signup budget or when the waitlist is at its plan ceiling.",
        "tags": [
          "Beta"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orgId": {
                    "type": "string",
                    "format": "tenantKey"
                  },
                  "formData": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 200
                      },
                      "email": {
                        "type": "string",
                        "format": "email",
                        "maxLength": 254
                      },
                      "timezone": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "language": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "country": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "currency": {
                        "type": "string",
                        "maxLength": 64
                      }
                    },
                    "required": [
                      "name",
                      "email"
                    ]
                  }
                },
                "required": [
                  "orgId",
                  "formData"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "config": {
                      "properties": {
                        "approvalEmail": {
                          "type": "boolean"
                        },
                        "description": {
                          "type": "string"
                        },
                        "enabled": {
                          "type": "boolean"
                        },
                        "logoFallBack": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "privacyPolicy": {
                          "type": "string"
                        },
                        "screen": {
                          "properties": {
                            "register": {
                              "properties": {
                                "description": {
                                  "type": "string"
                                },
                                "title": {
                                  "type": "string"
                                }
                              },
                              "type": "object"
                            },
                            "thankYou": {
                              "properties": {
                                "description": {
                                  "type": "string"
                                },
                                "title": {
                                  "type": "string"
                                }
                              },
                              "type": "object"
                            }
                          },
                          "type": "object"
                        },
                        "termsOfService": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "data": {},
                    "message": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "code": "[REDACTED]",
                  "config": {
                    "approvalEmail": false,
                    "description": "Signup for beta access to the application",
                    "enabled": true,
                    "logoFallBack": "",
                    "name": "Beta Users",
                    "privacyPolicy": "",
                    "screen": {
                      "register": {
                        "description": "Register with your email for beta access",
                        "title": "Register to Beta Users"
                      },
                      "thankYou": {
                        "description": "You have successfully registered for beta access.",
                        "title": "Thank You for Registering"
                      }
                    },
                    "termsOfService": ""
                  },
                  "data": null,
                  "message": "You have successfully registered for beta access.",
                  "status": "success"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "public-write",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/beta/index.ts"
      }
    },
    "/api/v1/monday.com/actions/{orgId}": {
      "post": {
        "operationId": "mondayCom.actions.create",
        "summary": "Record the outcome of a monday.com action",
        "description": "Called by the customer's own app server with an Authorization JWT signed with the monday app's client secret that names the installer (`accountId`, `userId`) and expires within five minutes; anything else answers 401. Creates or updates the action log entry for `actionLogId`, and answers 403 when the body names a different installer than the signature.",
        "tags": [
          "monday.com"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "actionLogId": {
                    "type": "string"
                  },
                  "actionTimestamp": {
                    "type": "string"
                  },
                  "actionType": {
                    "type": "string"
                  },
                  "accountId": {
                    "type": "number"
                  },
                  "userId": {
                    "type": "number"
                  },
                  "boardId": {
                    "type": "number"
                  },
                  "itemId": {
                    "type": "number"
                  },
                  "recipeId": {
                    "type": "number"
                  },
                  "integrationId": {
                    "type": "number"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "failed",
                      "pending",
                      "success"
                    ]
                  },
                  "error": {
                    "type": "string"
                  },
                  "result": {
                    "type": "object"
                  }
                },
                "required": [
                  "actionLogId",
                  "actionTimestamp",
                  "actionType",
                  "accountId",
                  "userId",
                  "boardId",
                  "itemId",
                  "recipeId",
                  "integrationId",
                  "status"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "accountId": {
                          "type": "integer"
                        },
                        "actionLogId": {
                          "type": "string"
                        },
                        "actionTimestamp": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "actionType": {
                          "type": "string"
                        },
                        "boardId": {
                          "type": "integer"
                        },
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "deleted": {
                          "type": "boolean"
                        },
                        "error": {
                          "type": "string"
                        },
                        "id": {
                          "type": "string"
                        },
                        "integrationId": {
                          "type": "integer"
                        },
                        "itemId": {
                          "type": "integer"
                        },
                        "recipeId": {
                          "type": "integer"
                        },
                        "result": {
                          "properties": {},
                          "type": "object"
                        },
                        "status": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "userId": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "_id": "000000000000000000000001",
                    "accountId": 634771,
                    "actionLogId": "e2e-action-1767225600000",
                    "actionTimestamp": "2026-01-01T00:00:00.000Z",
                    "actionType": "create_item",
                    "boardId": 11,
                    "createdAt": "2026-01-01T00:00:00.000Z",
                    "deleted": false,
                    "error": "",
                    "id": "000000000000000000000001",
                    "integrationId": 33,
                    "itemId": 44,
                    "recipeId": 22,
                    "result": {},
                    "status": "success",
                    "updatedAt": "2026-01-01T00:00:00.000Z",
                    "userId": 634771
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "monday-action",
            "windowMs": 60000,
            "max": 600,
            "per": "mondayActionLimiterKey"
          }
        ],
        "x-source": "server/src/routes/v1/monday.com/actions/index.ts"
      }
    },
    "/api/v1/monday.com/auth/authorize/{orgId}": {
      "get": {
        "operationId": "mondayCom.auth.authorize.get",
        "summary": "Start the monday.com install sign-in for an installer",
        "description": "Takes monday.com's `token` query parameter, a JWT verified with the app's signing secret (400 when it does not verify). A returning installer whose stored token still works and carries the required scopes is redirected to the customer's application URL with a one-hour signed hand-off, or back to monday.com; otherwise the browser gets a state cookie and is redirected to monday.com's OAuth consent screen.",
        "tags": [
          "monday.com"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/monday.com/auth/index.ts"
      }
    },
    "/api/v1/monday.com/auth/callback/{orgId}": {
      "get": {
        "operationId": "mondayCom.auth.callback.get",
        "summary": "Complete the monday.com OAuth flow",
        "description": "monday.com's OAuth redirect target. Verifies the `state` with the app's signing secret and the state cookie set by the authorize step, exchanges the code, and refuses (401, revoking the token at monday.com) a token that does not belong to the installer the state names or whose owner cannot be read. Stores the token on the installer's row, links the app user, and redirects to the customer's application URL with a one-hour signed hand-off, or back to monday.com.",
        "tags": [
          "monday.com"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/monday.com/auth/index.ts"
      }
    },
    "/api/v1/monday.com/auth/credentials/{orgId}": {
      "post": {
        "operationId": "mondayCom.auth.credentials.create",
        "summary": "List the caller's saved monday.com credential",
        "description": "monday.com's Credentials URL, authenticated by an Authorization JWT signed with the app's signing secret (401 otherwise). Answers at most one entry, the caller's own stored credential, titled with the app user it signs in as and valued with the row id, or an empty list.",
        "tags": [
          "monday.com"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "properties": {
                      "title": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "type": "array"
                },
                "example": [
                  {
                    "title": "Monday install (user@example.com)",
                    "value": "000000000000000000000001"
                  }
                ],
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/monday.com/auth/index.ts"
      }
    },
    "/api/v1/monday.com/auth/credentials/{orgId}/delete": {
      "post": {
        "operationId": "mondayCom.auth.credentials.delete.create",
        "summary": "Delete the caller's saved monday.com credential",
        "description": "monday.com's Delete Credentials URL, authenticated by an Authorization JWT signed with the app's signing secret. When the named credential is the caller's own, its tokens are revoked at monday.com (a refusal there is logged) and removed here; a credential that is someone else's or already gone gets the same 200.",
        "tags": [
          "monday.com"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "payload": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "credentialsId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 64
                      },
                      "credentialId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 64
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/monday.com/auth/index.ts"
      }
    },
    "/api/v1/monday.com/events/{orgId}": {
      "post": {
        "operationId": "mondayCom.events.create",
        "summary": "Receive a monday.com app lifecycle webhook",
        "description": "Accepts only monday.com's own lifecycle JWT in the Authorization header (401 otherwise), and answers 403 when the event data names another installer than the signature. Stores the event, removes the account's tokens on `uninstall`, records user activity for a linked user, may create an unverified user for an unknown `user_email`, and forwards the event to the customer's configured URL without letting a failed forward fail the webhook.",
        "tags": [
          "monday.com"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "maxLength": 128
                  },
                  "data": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "account_id": {
                        "type": [
                          "integer",
                          "string",
                          "null"
                        ],
                        "maxLength": 32
                      },
                      "user_id": {
                        "type": [
                          "integer",
                          "string",
                          "null"
                        ],
                        "maxLength": 32
                      },
                      "user_email": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 320
                      },
                      "user_name": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 256
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {},
                  "type": "object"
                },
                "example": {},
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "monday-event",
            "windowMs": 3600000,
            "max": 60,
            "per": "mondayActionLimiterKey"
          }
        ],
        "x-source": "server/src/routes/v1/monday.com/events/index.ts"
      }
    },
    "/api/v1/monday.com/token/{orgId}": {
      "post": {
        "operationId": "mondayCom.token.create",
        "summary": "Get a current monday.com access token for an installer",
        "description": "Called by the customer's app server with an Authorization JWT signed with the app's client secret that names the installer (401 otherwise). Answers a working access token, refreshed or migrated as needed and never the refresh token; 404 when the installer has no token, 409 with `reauthorize` when the installer must authorize again, and 502 when monday.com cannot be reached.",
        "tags": [
          "monday.com"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "monday-token",
            "windowMs": 60000,
            "max": 600,
            "per": "mondayActionLimiterKey"
          }
        ],
        "x-source": "server/src/routes/v1/monday.com/token/index.ts"
      }
    },
    "/api/v1/openapi.json": {
      "get": {
        "operationId": "discovery.openapi.public.get",
        "summary": "Get the OpenAPI document for the public API",
        "description": "Public, rate limited by the discovery limiter. Answers this document with `servers[0].url` set to this install's URL, cacheable for five minutes, and a weak ETag that answers a matching `If-None-Match` with 304. Answers 503 when the document is not available on the server.",
        "tags": [
          "Discovery"
        ],
        "responses": {
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "discovery",
            "windowMs": 60000,
            "max": 120,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/openapi.ts"
      }
    },
    "/api/v1/openapi/org-api.json": {
      "get": {
        "operationId": "discovery.openapi.org.get",
        "summary": "Get the OpenAPI document for the organization API",
        "description": "Public, rate limited by the discovery limiter. Answers the organization API's document with `servers[0].url` set to this install's URL, cacheable for five minutes, with a weak ETag. Answers 503 when the document is not available on the server.",
        "tags": [
          "Discovery"
        ],
        "responses": {
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "discovery",
            "windowMs": 60000,
            "max": 120,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/openapi.ts"
      }
    },
    "/api/v1/public/account/delete": {
      "post": {
        "operationId": "account.delete.create",
        "summary": "Request deletion of the signed-in person's account",
        "description": "Needs a recent sign-in (403 otherwise) unless the person is a guest. With an org grace period the deletion is scheduled and every other session of the person is revoked; with none the account is scrubbed at once and this session ends with it. Answers 409 while the person owns workspaces with other members or a paid subscription, pays for a workspace, or (under the org's block setting) still holds paid add-ons or credits.",
        "tags": [
          "Account"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "deleteAfter": {
                      "format": "date-time",
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "deleted": {
                      "type": "boolean"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "deleteAfter": "2026-01-01T00:00:00.000Z",
                  "deleted": false,
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/account.ts",
        "x-events": [
          "user.deletion_scheduled",
          "user.deleted"
        ]
      }
    },
    "/api/v1/public/account/delete/cancel": {
      "post": {
        "operationId": "account.delete.cancel.create",
        "summary": "Cancel a scheduled deletion of the signed-in person's account",
        "description": "Clears the scheduled deletion and answers whether one was cancelled; answers `cancelled: false` when no deletion was scheduled.",
        "tags": [
          "Account"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "cancelled": {
                      "type": "boolean"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "cancelled": true,
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/account.ts",
        "x-events": [
          "user.deletion_cancelled"
        ]
      }
    },
    "/api/v1/public/accounts": {
      "get": {
        "operationId": "accounts.list",
        "summary": "List the social sign-ins connected to the signed-in person",
        "tags": [
          "Accounts"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "accounts": {
                      "items": {
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "canUnlink": {
                            "type": "boolean"
                          },
                          "detail": {
                            "type": "string"
                          },
                          "icon": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "provider": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "available": {
                      "items": {
                        "properties": {
                          "icon": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "methodId": {
                            "type": "string"
                          },
                          "provider": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "recentSignIn": {
                      "type": "boolean"
                    },
                    "signInWays": {
                      "type": "integer"
                    },
                    "wallet": {
                      "properties": {
                        "ethereumChainIds": {
                          "items": {
                            "type": "integer"
                          },
                          "type": "array"
                        },
                        "solana": {
                          "type": "boolean"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "accounts": [
                    {
                      "_id": "000000000000000000000001",
                      "canUnlink": false,
                      "icon": "http://localhost:3000/api/images/auth/oidc.svg",
                      "label": "Acme ID",
                      "provider": "custom:DINNn8KbGwd6DZBp3GFk"
                    }
                  ],
                  "available": [
                    {
                      "icon": "http://localhost:3000/api/images/auth/google.svg",
                      "label": "Google",
                      "methodId": "IF609c3HFq9JSBTdiiPd",
                      "provider": "google"
                    }
                  ],
                  "recentSignIn": true,
                  "signInWays": 1
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/accounts.ts"
      },
      "post": {
        "operationId": "accounts.create",
        "summary": "Start connecting a social sign-in to the signed-in person",
        "description": "Answers the provider URL to send the browser to. Answers 400 when the return address is not registered for the app, 404 when the sign-in method is not available, and 503 when the provider cannot be reached.",
        "tags": [
          "Accounts"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "methodId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "redirect": {
                    "type": "string",
                    "format": "uri",
                    "maxLength": 2048
                  },
                  "challenge": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{43}$"
                  }
                },
                "required": [
                  "methodId",
                  "redirect"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "url": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "url": "http://localhost:42155/authorize?response_type=code&client_id=linkbind-client&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fapi%2Fv1%2Fauth%2Fsocial%2Fcustom%2F6af413602865c46d9a5f7511%2FnpYIsgszJulYcfdJsdnp%2Fcallback&scope=openid+profile+email&state=[REDACTED]&nonce=[REDACTED]&code_challenge=7oVvImb7NmrrwKXilClV-52QJyo8E6TpkwQ1jzu6CLY&code_challenge_method=S256"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/accounts.ts"
      }
    },
    "/api/v1/public/accounts/complete": {
      "post": {
        "operationId": "accounts.complete.create",
        "summary": "Finish connecting a social sign-in started with a PKCE challenge",
        "description": "Redeems the one-time link code with the start's code verifier, from the session that started it, and only then links the identity. A guest connecting one becomes that account. Answers 409 when the identity is already connected to another account or the session ended.",
        "tags": [
          "Accounts"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "pattern": "^[0-9A-Za-z]{32}$"
                  },
                  "verifier": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._~-]{43,128}$"
                  }
                },
                "required": [
                  "code",
                  "verifier"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "provider": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "provider": "custom:npYIsgszJulYcfdJsdnp"
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/accounts.ts",
        "x-events": [
          "user.account_linked",
          "user.registered"
        ]
      }
    },
    "/api/v1/public/accounts/wallet": {
      "post": {
        "operationId": "accounts.wallet.create",
        "summary": "Connect a crypto wallet the person signed a message with",
        "description": "Verifies the signed message against a nonce from the nonce endpoint and links the wallet as a way to sign in. Answers 403 when wallets are not available for the app, 400 for a chain the app does not take, and 409 for a guest account.",
        "tags": [
          "Accounts"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chain": {
                    "type": "string",
                    "enum": [
                      "ethereum",
                      "solana"
                    ]
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4096
                  },
                  "signature": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512
                  }
                },
                "required": [
                  "chain",
                  "message",
                  "signature"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "detail": {
                          "type": "string"
                        },
                        "icon": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        },
                        "provider": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "_id": "000000000000000000000001",
                    "detail": "0x0E29…9008",
                    "icon": "",
                    "label": "Ethereum wallet",
                    "provider": "ethereum"
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/accounts.ts",
        "x-events": [
          "user.account_linked"
        ]
      }
    },
    "/api/v1/public/accounts/wallet/nonce": {
      "post": {
        "operationId": "accounts.wallet.nonce.create",
        "summary": "Get a nonce for the message that connects a wallet",
        "description": "Answers 403 when connecting a wallet is not available for the app and 400 for a chain the app does not take.",
        "tags": [
          "Accounts"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chain": {
                    "type": "string",
                    "enum": [
                      "ethereum",
                      "solana"
                    ]
                  }
                },
                "required": [
                  "chain"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "chainIds": {
                          "items": {
                            "type": "integer"
                          },
                          "type": "array"
                        },
                        "domain": {
                          "type": "string"
                        },
                        "issuedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "nonce": {
                          "type": "string"
                        },
                        "uri": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "chainIds": [
                      1,
                      137
                    ],
                    "domain": "localhost:9999",
                    "issuedAt": "2026-01-01T00:00:00.000Z",
                    "nonce": "O3EvEWhDariDxlqVBJ2r284K",
                    "uri": "http://localhost:9999"
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/accounts.ts"
      }
    },
    "/api/v1/public/accounts/{id}": {
      "delete": {
        "operationId": "accounts.delete",
        "summary": "Remove a connected sign-in from the signed-in person",
        "description": "Needs a recent sign-in (403 `reauth_required`). Answers 404 for an account that is not the person's and 409 when it is their only way to sign in.",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/accounts.ts",
        "x-events": [
          "user.account_unlinked"
        ]
      }
    },
    "/api/v1/public/analytics/link": {
      "post": {
        "operationId": "analytics.link.create",
        "summary": "Link the browser's web analytics visitor id to the signed-in user",
        "description": "Answers `linked: true` when the link is stored. A refused link (collection turned off, or a session acting for someone else such as impersonation or an agent grant) is answered 204 with nothing written, never 401. Rate limited.",
        "tags": [
          "Analytics"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "vid": {
                    "type": "string",
                    "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
                    "maxLength": 36
                  }
                },
                "required": [
                  "vid"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "linked": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "linked": true
                },
                "x-observed": true
              }
            }
          },
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "analytics-link",
            "windowMs": 60000,
            "max": 30,
            "per": "sessionLimiterKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/analytics.ts"
      }
    },
    "/api/v1/public/billing/payers/{payerId}/rollup": {
      "get": {
        "operationId": "billing.payers.rollup.list",
        "summary": "Get what a payer pays for",
        "description": "Returns the workspaces whose subscriptions the payer's Stripe customer carries, the payer's own subscription, its currency and how many more it may take on. The payer is the signed-in user when `payerId` is their own id, otherwise a workspace the caller may view billing for; any other id answers 404, as an unknown one does. Read only.",
        "tags": [
          "Billing"
        ],
        "parameters": [
          {
            "name": "payerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/billing.ts"
      }
    },
    "/api/v1/public/cart/checkout": {
      "post": {
        "operationId": "cart.checkout.create",
        "summary": "Start checkout for a cart of items across sellers",
        "description": "Creates one order per seller, sharing a `cartId`, for the signed-in user, holds stock and bookings, and returns a Stripe Checkout URL (a storefront checks out in steps). Refused when the cart is empty or has more lines than allowed. The buyer is always the session's user.",
        "tags": [
          "Cart"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lines": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "properties": {
                        "itemId": {
                          "type": "string",
                          "pattern": "^[a-f0-9]{24}$"
                        },
                        "variantId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "priceId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "optionValues": {
                          "type": "object",
                          "maxProperties": 3,
                          "propertyNames": {
                            "maxLength": 16
                          },
                          "additionalProperties": {
                            "type": "string",
                            "maxLength": 16
                          }
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100
                        },
                        "amount": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 99999999
                        },
                        "slotStart": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "slotStarts": {
                          "type": "object",
                          "maxProperties": 10,
                          "propertyNames": {
                            "minLength": 1,
                            "maxLength": 64
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 40
                          }
                        }
                      },
                      "required": [
                        "itemId"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "successUrl": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "cancelUrl": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "couponCode": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  },
                  "referral": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  },
                  "shippingQuote": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 8192
                  },
                  "buyerCountry": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 2,
                    "pattern": "^[A-Za-z]{2}$"
                  }
                },
                "required": [
                  "lines",
                  "successUrl",
                  "cancelUrl"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/cart.ts",
        "x-events": [
          "order.created"
        ]
      }
    },
    "/api/v1/public/cart/coupon": {
      "post": {
        "operationId": "cart.coupon.create",
        "summary": "Check what a coupon code takes off cart lines",
        "description": "Writes nothing. A code that does not apply is answered with a `problem` in the response rather than an error. Rate limited.",
        "tags": [
          "Cart"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  },
                  "lines": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "properties": {
                        "itemId": {
                          "type": "string",
                          "pattern": "^[a-f0-9]{24}$"
                        },
                        "variantId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "priceId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "optionValues": {
                          "type": "object",
                          "maxProperties": 3,
                          "propertyNames": {
                            "maxLength": 16
                          },
                          "additionalProperties": {
                            "type": "string",
                            "maxLength": 16
                          }
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100
                        },
                        "amount": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 99999999
                        },
                        "slotStart": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "slotStarts": {
                          "type": "object",
                          "maxProperties": 10,
                          "propertyNames": {
                            "minLength": 1,
                            "maxLength": 64
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 40
                          }
                        }
                      },
                      "required": [
                        "itemId"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "code",
                  "lines"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "public-write",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/cart.ts"
      }
    },
    "/api/v1/public/cart/shipping-quote": {
      "post": {
        "operationId": "cart.shippingQuote.create",
        "summary": "Get carrier shipping quotes for cart lines",
        "description": "Returns each seller's shipping options for the lines and an address, with a signed token that checkout accepts. Writes nothing. Rate limited.",
        "tags": [
          "Cart"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lines": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "properties": {
                        "itemId": {
                          "type": "string",
                          "pattern": "^[a-f0-9]{24}$"
                        },
                        "variantId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "priceId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "optionValues": {
                          "type": "object",
                          "maxProperties": 3,
                          "propertyNames": {
                            "maxLength": 16
                          },
                          "additionalProperties": {
                            "type": "string",
                            "maxLength": 16
                          }
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100
                        },
                        "amount": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 99999999
                        },
                        "slotStart": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "slotStarts": {
                          "type": "object",
                          "maxProperties": 10,
                          "propertyNames": {
                            "minLength": 1,
                            "maxLength": 64
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 40
                          }
                        }
                      },
                      "required": [
                        "itemId"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "address": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 100
                      },
                      "line1": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 200
                      },
                      "line2": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 200
                      },
                      "city": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 100
                      },
                      "state": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 50
                      },
                      "postalCode": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 20
                      },
                      "country": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 2
                      }
                    },
                    "required": [
                      "postalCode",
                      "country"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "lines",
                  "address"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "public-write",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/cart.ts"
      }
    },
    "/api/v1/public/connected-agents": {
      "get": {
        "operationId": "connectedAgents.list",
        "summary": "List the agents the signed-in person has connected to their account",
        "description": "Lists the person's OAuth consents for agent (third-party) clients only, with the granted scope and whether the person or their company's identity provider approved it.",
        "tags": [
          "Connected agents"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "agents": {
                      "items": {
                        "properties": {
                          "clientId": {
                            "type": "string"
                          },
                          "lastGrantedAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "scope": {
                            "items": {
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "source": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "agents": [
                    {
                      "clientId": "VXsk3VwZodEHrA6UT9OJFZ1TuzgO4t2ON88hwYDb",
                      "lastGrantedAt": "2026-01-01T00:00:00.000Z",
                      "scope": [
                        "mcp",
                        "read"
                      ],
                      "source": "idp",
                      "title": "Okta tester 1767225600000"
                    }
                  ]
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/connected-agents/index.ts"
      }
    },
    "/api/v1/public/connected-agents/revoke": {
      "post": {
        "operationId": "connectedAgents.revoke.create",
        "summary": "Disconnect an agent from the signed-in person's account",
        "description": "Deletes the person's grant to the client, revokes its refresh tokens and the sessions bound to it, and notifies the agent's app. Idempotent; answers 400 when `clientId` is missing.",
        "tags": [
          "Connected agents"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clientId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 256
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/connected-agents/index.ts",
        "x-events": [
          "oauth.consent_revoked"
        ]
      }
    },
    "/api/v1/public/consent/mine": {
      "get": {
        "operationId": "consent.mine.list",
        "summary": "List the signed-in person's consent records",
        "description": "Answers the person's 50 most recent consent records, newest first, and the latest one.",
        "tags": [
          "Consent"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/consent.ts"
      }
    },
    "/api/v1/public/device-token": {
      "get": {
        "operationId": "deviceToken.list",
        "summary": "Get the signed device token for the caller's session",
        "description": "Resolves the `x-session-id` itself (no router-level gate) and answers 401 without a live session. A session with no device, such as an agent's, gets an empty token.",
        "tags": [
          "Device token"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "deviceToken": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "deviceToken": "[REDACTED]"
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "device-token-ip",
            "windowMs": 60000,
            "max": 300,
            "per": "ip"
          },
          {
            "prefix": "device-token",
            "windowMs": 60000,
            "max": 30,
            "per": "sessionLimiterKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/index.ts"
      }
    },
    "/api/v1/public/devices": {
      "get": {
        "operationId": "devices.list",
        "summary": "List the devices the signed-in person has signed in from",
        "description": "Answers the devices and `maxDevices`: how many devices the plan keeps signed in at once, so a client can say that signing in on one more signs the least recently used one out; `null` when no device ceiling is in force.",
        "tags": [
          "Devices"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "devices": {
                      "items": {
                        "properties": {
                          "activeSessions": {
                            "type": "integer"
                          },
                          "current": {
                            "type": "boolean"
                          },
                          "deviceId": {
                            "type": "string"
                          },
                          "firstSeenAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "ip": {
                            "type": "string"
                          },
                          "ipInfo": {
                            "properties": {
                              "ip": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "lastActiveAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "origin": {
                            "type": "string"
                          },
                          "pushEnabled": {
                            "type": "boolean"
                          },
                          "trusted": {
                            "type": "boolean"
                          },
                          "userAgent": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "devices": [
                    {
                      "activeSessions": 1,
                      "current": false,
                      "deviceId": "dv_5a679ea71806e8e1d2721a62691ed97c",
                      "firstSeenAt": "2026-01-01T00:00:00.000Z",
                      "ip": "127.0.0.1",
                      "ipInfo": {
                        "ip": "127.0.0.1"
                      },
                      "lastActiveAt": "2026-01-01T00:00:00.000Z",
                      "name": "My Test Laptop",
                      "origin": "",
                      "pushEnabled": false,
                      "trusted": false,
                      "userAgent": "undefined"
                    },
                    {
                      "activeSessions": 0,
                      "current": false,
                      "deviceId": "dv_fd3e840e225f2a3d0ddfa479d7ca1530",
                      "firstSeenAt": "2026-01-01T00:00:00.000Z",
                      "ip": "127.0.0.1",
                      "ipInfo": {
                        "ip": "127.0.0.1"
                      },
                      "lastActiveAt": "2026-01-01T00:00:00.000Z",
                      "name": "Unknown device",
                      "origin": "",
                      "pushEnabled": false,
                      "trusted": false,
                      "userAgent": "undefined"
                    }
                  ]
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/devices.ts"
      }
    },
    "/api/v1/public/devices/{deviceId}": {
      "delete": {
        "operationId": "devices.delete",
        "summary": "Sign out one of the signed-in person's devices",
        "description": "Revokes every live session started on the device and drops its push subscription; `?forget=true` also deletes the device's history row. Answers 404 for a device that is not the person's.",
        "tags": [
          "Devices"
        ],
        "parameters": [
          {
            "name": "deviceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "revokedSessions": {
                      "type": "integer"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "revokedSessions": 1,
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/devices.ts"
      },
      "patch": {
        "operationId": "devices.update",
        "summary": "Rename one of the signed-in person's devices",
        "description": "Answers 404 for a device that is not the person's.",
        "tags": [
          "Devices"
        ],
        "parameters": [
          {
            "name": "deviceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 100
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "current": {
                          "type": "boolean"
                        },
                        "deviceId": {
                          "type": "string"
                        },
                        "firstSeenAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "lastActiveAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "trusted": {
                          "type": "boolean"
                        },
                        "userAgent": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "current": false,
                    "deviceId": "dv_5a679ea71806e8e1d2721a62691ed97c",
                    "firstSeenAt": "2026-01-01T00:00:00.000Z",
                    "lastActiveAt": "2026-01-01T00:00:00.000Z",
                    "name": "My Test Laptop",
                    "trusted": false,
                    "userAgent": "undefined"
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/devices.ts"
      }
    },
    "/api/v1/public/guest/upgrade": {
      "post": {
        "operationId": "guest.upgrade.create",
        "summary": "Start turning a guest into an account by emailing a code",
        "description": "Checks the address and the password, then emails a confirmation code to the address. Answers 409 when the caller is not a guest or the address is unavailable, 429 during a cooldown or after too many codes for the address, and 503 when the code cannot be sent.",
        "tags": [
          "Guest"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 320
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "password": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 256
                  }
                },
                "required": [
                  "email"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "retryAfter": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "retryAfter": 30
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/guest.ts"
      }
    },
    "/api/v1/public/guest/upgrade/confirm": {
      "post": {
        "operationId": "guest.upgrade.confirm.create",
        "summary": "Confirm a guest upgrade with the emailed code",
        "description": "Makes the guest an account at the address with the same user id, marks this session's address as verified and answers the profile. Answers 400 for a wrong code and 410 for an expired one.",
        "tags": [
          "Guest"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 12
                  }
                },
                "required": [
                  "code"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "claims": {
                          "properties": {},
                          "type": "object"
                        },
                        "country": {
                          "type": "string"
                        },
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "emailVerified": {
                          "type": "boolean"
                        },
                        "firstAuthAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "id": {
                          "type": "string"
                        },
                        "image": {
                          "type": "string"
                        },
                        "isAnonymous": {
                          "type": "boolean"
                        },
                        "language": {
                          "type": "string"
                        },
                        "mfaEnabled": {
                          "type": "boolean"
                        },
                        "name": {
                          "type": "string"
                        },
                        "phone": {
                          "type": "string"
                        },
                        "phoneVerified": {
                          "type": "boolean"
                        },
                        "role": {
                          "type": "string"
                        },
                        "timezone": {
                          "type": "string"
                        },
                        "username": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "claims": {},
                    "country": "",
                    "createdAt": "2026-01-01T00:00:00.000Z",
                    "currency": "",
                    "email": "user@example.com",
                    "emailVerified": true,
                    "firstAuthAt": "2026-01-01T00:00:00.000Z",
                    "id": "000000000000000000000001",
                    "image": "",
                    "isAnonymous": false,
                    "language": "",
                    "mfaEnabled": false,
                    "name": "Grace Guest",
                    "phone": "",
                    "phoneVerified": false,
                    "role": "user",
                    "timezone": "",
                    "username": ""
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/guest.ts",
        "x-events": [
          "user.registered"
        ]
      }
    },
    "/api/v1/public/invitations": {
      "get": {
        "operationId": "invitations.list",
        "summary": "List workspace invitations sent to the signed-in person's address",
        "tags": [
          "Invitations"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/invitations/index.ts"
      }
    },
    "/api/v1/public/invitations/{id}/accept": {
      "patch": {
        "operationId": "invitations.accept.update",
        "summary": "Accept a workspace invitation",
        "description": "The session's email must match the invitation's (403 otherwise), and an unverified address must send the emailed link's token, which then marks it verified. Adds the person to the workspace at the invited role, clamped to what is assignable; answers 410 for an expired invitation, 409 for one already handled, and a refusal when the workspace is at its member limit.",
        "tags": [
          "Invitations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string",
                    "minLength": 64,
                    "maxLength": 64
                  }
                },
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/invitations/index.ts",
        "x-events": [
          "workspace.member_added",
          "workspace.invitation_accepted"
        ]
      }
    },
    "/api/v1/public/invitations/{id}/reject": {
      "patch": {
        "operationId": "invitations.reject.update",
        "summary": "Decline a workspace invitation",
        "description": "The session's email must match the invitation's (403 otherwise). Answers 410 for an expired invitation and 409 for one already handled.",
        "tags": [
          "Invitations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/invitations/index.ts",
        "x-events": [
          "workspace.invitation_declined"
        ]
      }
    },
    "/api/v1/public/item-types": {
      "get": {
        "operationId": "itemTypes.list",
        "summary": "List the published item types sellers can list",
        "description": "Returns the live version of each active item type, so an app can build its own seller form.",
        "tags": [
          "Item types"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/item-types.ts"
      }
    },
    "/api/v1/public/item-types/{key}": {
      "get": {
        "operationId": "itemTypes.get",
        "summary": "Get a published item type by key",
        "description": "Answers 404 when no published item type has that key.",
        "tags": [
          "Item types"
        ],
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 48
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/item-types.ts"
      }
    },
    "/api/v1/public/items": {
      "get": {
        "operationId": "items.list",
        "summary": "List published marketplace items",
        "description": "Returns published items, filtered by item type, seller or title text, with public field values only; metadata, payees and named buyers are never included.",
        "tags": [
          "Items"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "sellerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "sellerType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "user",
                "workspace",
                "org"
              ]
            }
          },
          {
            "name": "typeKey",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 48
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/items.ts"
      }
    },
    "/api/v1/public/items/{id}": {
      "get": {
        "operationId": "items.get",
        "summary": "Get a marketplace item by id",
        "description": "Returns a published or unlisted item with public field values only.",
        "tags": [
          "Items"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/items.ts"
      }
    },
    "/api/v1/public/items/{id}/checkout": {
      "post": {
        "operationId": "items.checkout.create",
        "summary": "Start checkout for one item",
        "description": "Creates an order for the signed-in user, holds stock (and a booking slot or coupon when given) and returns the Stripe Checkout URL; a free claim is marked paid at once and returns no URL. The buyer is always the session's user.",
        "tags": [
          "Items"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "variantId": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "priceId": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "optionValues": {
                    "type": "object",
                    "maxProperties": 3,
                    "propertyNames": {
                      "maxLength": 16
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 16
                    }
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  },
                  "amount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 99999999
                  },
                  "successUrl": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "cancelUrl": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "couponCode": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  },
                  "slotStart": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  },
                  "slotStarts": {
                    "type": "object",
                    "maxProperties": 10,
                    "propertyNames": {
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "additionalProperties": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    }
                  },
                  "referral": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  },
                  "shippingQuote": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 8192
                  },
                  "buyerCountry": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 2,
                    "pattern": "^[A-Za-z]{2}$"
                  }
                },
                "required": [
                  "successUrl",
                  "cancelUrl"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/items.ts",
        "x-events": [
          "order.created"
        ]
      }
    },
    "/api/v1/public/items/{id}/shipping-quote": {
      "post": {
        "operationId": "items.shippingQuote.create",
        "summary": "Get carrier shipping quotes for one item",
        "description": "Returns the shipping options for the item and an address, with a signed token that checkout accepts as `shippingQuote`. Writes nothing. Rate limited.",
        "tags": [
          "Items"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "variantId": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "priceId": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "optionValues": {
                    "type": "object",
                    "maxProperties": 3,
                    "propertyNames": {
                      "maxLength": 16
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 16
                    }
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  },
                  "amount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 99999999
                  },
                  "address": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 100
                      },
                      "line1": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 200
                      },
                      "line2": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 200
                      },
                      "city": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 100
                      },
                      "state": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 50
                      },
                      "postalCode": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 20
                      },
                      "country": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 2
                      }
                    },
                    "required": [
                      "postalCode",
                      "country"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "address"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "public-write",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/items.ts"
      }
    },
    "/api/v1/public/items/{id}/slots": {
      "get": {
        "operationId": "items.slots.list",
        "summary": "List open booking slots for an item",
        "tags": [
          "Items"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40
            }
          },
          {
            "name": "variantId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/items.ts"
      }
    },
    "/api/v1/public/logout": {
      "post": {
        "operationId": "logout.create",
        "summary": "End the caller's session, or every session of the person",
        "description": "No router-level gate, so it also works with an expired session id; idempotent. `all: true` revokes every session of the person and retires login tokens already issued, except from a read-only sign-in-as session, which ends only itself.",
        "tags": [
          "Logout"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "all": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "logout",
            "windowMs": 60000,
            "max": 60,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/index.ts"
      }
    },
    "/api/v1/public/me": {
      "delete": {
        "operationId": "me.delete",
        "summary": "Delete the signed-in user's account, now or after the org's grace period",
        "description": "Same request as POST /account/delete and behind the same recent sign-in check (403 `reauth_required` when the sign-in is too old; a guest user skips it). With no grace period the account is scrubbed at once and `deleted` is true; otherwise `deleteAfter` is set and the user's other sessions are revoked. Answers 409 `owns_workspaces` or `pays_for_workspaces` while the user owns a workspace with other members or a paid plan, or pays for one, and 409 `PAID_GRANTS_PRESENT` when the org blocks deletion while paid add-ons or credits are held.",
        "tags": [
          "Me"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/index.ts",
        "x-events": [
          "user.deletion_scheduled",
          "user.deleted"
        ]
      }
    },
    "/api/v1/public/me/access": {
      "get": {
        "operationId": "me.access.list",
        "summary": "Check whether the signed-in user may use one app resource now",
        "description": "Answers from the user's live access grants for `resourceType` and `resourceId`, counting only grants whose item may give access to that resource type. Attaches the user's earlier guest purchases first, at most once a minute. Answers 503 `SELLING_UNAVAILABLE` when selling is switched off on the server.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "resourceId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "resourceType",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/holdings.ts"
      }
    },
    "/api/v1/public/me/affiliate-invitations": {
      "get": {
        "operationId": "me.affiliateInvitations.list",
        "summary": "List the signed-in user's pending invitations to affiliate programs",
        "description": "Lists invitations sent to the signed-in user that are still pending and not expired, newest first, and only for programs that take affiliates now. Paged with `page` and `limit`. Answers 503 while selling is turned off on the server.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      }
    },
    "/api/v1/public/me/affiliate-invitations/{id}/accept": {
      "post": {
        "operationId": "me.affiliateInvitations.accept.create",
        "summary": "Accept an invitation and join the seller's affiliate program",
        "description": "Marks the signed-in user's own invitation accepted and enrolls them in the program as an active affiliate, answering 201 with the new affiliate row, or 200 with the row they already had (approved if it was waiting). Another person's invitation, an expired one or a program that is off reads as not found; joining their own program is refused with 422. `shareContact: true` shares their email with the seller.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "shareContact": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts",
        "x-events": [
          "affiliate.joined",
          "affiliate.approved",
          "affiliate.status_changed"
        ]
      }
    },
    "/api/v1/public/me/affiliate-invitations/{id}/decline": {
      "post": {
        "operationId": "me.affiliateInvitations.decline.create",
        "summary": "Decline an invitation to a seller's affiliate program",
        "description": "Marks the signed-in user's own pending invitation declined. Another person's invitation, or one already answered or expired, reads as not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      }
    },
    "/api/v1/public/me/affiliate-programs": {
      "get": {
        "operationId": "me.affiliatePrograms.list",
        "summary": "List the affiliate programs the signed-in user runs as a seller",
        "description": "Lists the programs owned by the signed-in user's seller account, each with its affiliate count. Answers 404 when the user has not started selling.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "sellerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      },
      "post": {
        "operationId": "me.affiliatePrograms.create",
        "summary": "Create an affiliate program on the signed-in seller's own items",
        "description": "Creates a program owned by the signed-in user's seller account and answers 201. Refused with 409 when the app does not let sellers run affiliate programs, and with 422 when the seller already has the most programs allowed, the terms are invalid, or PayPal payouts are not open on the platform. Answers 404 when the user has not started selling.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 1000
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "percent",
                      "fixed"
                    ]
                  },
                  "percentBps": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "fixedAmount": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 99999999
                  },
                  "currency": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-zA-Z]{3}$"
                  },
                  "recurrence": {
                    "type": "string",
                    "enum": [
                      "first",
                      "all",
                      "count"
                    ]
                  },
                  "recurringPayments": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 36
                  },
                  "windowDays": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 365
                  },
                  "holdDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 120
                  },
                  "join": {
                    "type": "string",
                    "enum": [
                      "open",
                      "approval",
                      "invite"
                    ]
                  },
                  "payoutMethod": {
                    "type": "string",
                    "enum": [
                      "transfer",
                      "manual",
                      "paypal",
                      "wise_export"
                    ]
                  },
                  "minPayout": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 99999999
                  },
                  "itemIds": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  },
                  "active": {
                    "type": "boolean"
                  },
                  "payoutMethods": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 4,
                    "items": {
                      "type": "string",
                      "enum": [
                        "transfer",
                        "manual",
                        "paypal",
                        "wise_export"
                      ]
                    }
                  },
                  "tiers": {
                    "type": "array",
                    "maxItems": 5,
                    "items": {
                      "type": "object",
                      "properties": {
                        "threshold": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 999999999
                        },
                        "percentBps": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 10000
                        },
                        "fixedAmount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 99999999
                        }
                      },
                      "required": [
                        "threshold"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "tierMetric": {
                    "type": "string",
                    "enum": [
                      "paid_referrals",
                      "revenue"
                    ]
                  },
                  "tierCurrency": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-zA-Z]{3}$"
                  },
                  "tierPeriod": {
                    "type": "string",
                    "enum": [
                      "lifetime",
                      "calendar_month",
                      "calendar_quarter",
                      "rolling_30d"
                    ]
                  },
                  "tierApply": {
                    "type": "string",
                    "enum": [
                      "forward",
                      "retroactive"
                    ]
                  },
                  "codeAttribution": {
                    "type": "string",
                    "enum": [
                      "coupon_wins",
                      "link_wins"
                    ]
                  },
                  "couponRateBps": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "codeOnlyAttribution": {
                    "type": "boolean"
                  },
                  "levels": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 2
                  },
                  "levelBps": {
                    "type": "array",
                    "maxItems": 2,
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 10000
                    }
                  },
                  "levelBasis": {
                    "type": "string",
                    "enum": [
                      "commission",
                      "net"
                    ]
                  },
                  "levelsAcknowledged": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name",
                  "kind"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      }
    },
    "/api/v1/public/me/affiliate-programs/affiliates/{id}/approve": {
      "post": {
        "operationId": "me.affiliatePrograms.affiliates.approve.create",
        "summary": "Approve a pending affiliate in one of the signed-in seller's programs",
        "description": "Moves a pending affiliate to active, with an optional `note`. Refused with 409 when the affiliate is not pending, their account was deleted, or the row changed meanwhile. An affiliate of another seller reads as not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts",
        "x-events": [
          "affiliate.status_changed",
          "affiliate.approved"
        ]
      }
    },
    "/api/v1/public/me/affiliate-programs/affiliates/{id}/ban": {
      "post": {
        "operationId": "me.affiliatePrograms.affiliates.ban.create",
        "summary": "Ban an affiliate from one of the signed-in seller's programs",
        "description": "Moves a pending, active or paused affiliate to banned, with an optional `note`, and voids their commissions that are waiting and not yet in a payout. Refused with 409 when the affiliate is already banned or the row changed meanwhile. An affiliate of another seller reads as not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts",
        "x-events": [
          "affiliate.status_changed",
          "commission.reversed"
        ]
      }
    },
    "/api/v1/public/me/affiliate-programs/affiliates/{id}/pause": {
      "post": {
        "operationId": "me.affiliatePrograms.affiliates.pause.create",
        "summary": "Pause an active affiliate in one of the signed-in seller's programs",
        "description": "Moves an active affiliate to paused, with an optional `note`; a paused affiliate's code and links stop attributing sales. Refused with 409 when the affiliate is not active or the row changed meanwhile. An affiliate of another seller reads as not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts",
        "x-events": [
          "affiliate.status_changed"
        ]
      }
    },
    "/api/v1/public/me/affiliate-programs/affiliates/{id}/resume": {
      "post": {
        "operationId": "me.affiliatePrograms.affiliates.resume.create",
        "summary": "Resume a paused affiliate in one of the signed-in seller's programs",
        "description": "Moves a paused affiliate back to active, with an optional `note`. Refused with 409 when the affiliate is not paused, their account was deleted, or the row changed meanwhile. An affiliate of another seller reads as not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts",
        "x-events": [
          "affiliate.status_changed",
          "affiliate.approved"
        ]
      }
    },
    "/api/v1/public/me/affiliate-programs/payouts/wise.csv": {
      "get": {
        "operationId": "me.affiliatePrograms.payouts.wiseCsv.list",
        "summary": "Download the signed-in seller's pending Wise payouts as a CSV file",
        "description": "Answers a Wise batch CSV of the seller's pending Wise payouts, optionally for one `programId`, and stamps each as exported so the next file leaves it out; `again=true` includes payouts already in an earlier file. Payouts whose affiliate gave no bank details are left out and named in the `X-Missing-Bank-Details` header, and the count left out as exported before is in `X-Already-Exported`. Each download is written to the audit log.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "again",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "programId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      }
    },
    "/api/v1/public/me/affiliate-programs/payouts/{id}/mark-paid": {
      "post": {
        "operationId": "me.affiliatePrograms.payouts.markPaid.create",
        "summary": "Mark a manual or Wise payout of the signed-in seller's program paid",
        "description": "Marks a pending manual or Wise payout paid with the seller's `reference`, and its commissions paid. Refused with 409 when the payout is already paid, came back failed, is sent by PayPal or transfer, or changed meanwhile. Accepts an `Idempotency-Key` header.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reference": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "reference"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts",
        "x-events": [
          "commission.paid"
        ]
      }
    },
    "/api/v1/public/me/affiliate-programs/payouts/{id}/wise.csv": {
      "get": {
        "operationId": "me.affiliatePrograms.payouts.byId.wiseCsv.list",
        "summary": "Download one of the signed-in seller's Wise payouts as a CSV file",
        "description": "Answers a Wise batch CSV for one pending Wise payout and stamps it as exported. Refused with 409 `payout_already_exported` when it was in an earlier file, unless `again=true`. Each download is written to the audit log.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "again",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "programId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      }
    },
    "/api/v1/public/me/affiliate-programs/{id}": {
      "get": {
        "operationId": "me.affiliatePrograms.get",
        "summary": "Get one of the signed-in seller's affiliate programs",
        "description": "Answers the program with its affiliate count. Another seller's program reads as not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      },
      "delete": {
        "operationId": "me.affiliatePrograms.delete",
        "summary": "Delete one of the signed-in seller's affiliate programs",
        "description": "Deletes the program, so no new click, join or sale is counted for it; commissions already earned stay and are paid out as before. Another seller's program reads as not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      },
      "patch": {
        "operationId": "me.affiliatePrograms.update",
        "summary": "Update the terms of one of the signed-in seller's affiliate programs",
        "description": "Changes the fields sent and checks them together with the stored terms. Refused with 422 when the resulting terms are invalid or PayPal payouts are not open on the platform. Another seller's program reads as not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 1000
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "percent",
                      "fixed"
                    ]
                  },
                  "percentBps": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "fixedAmount": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 99999999
                  },
                  "currency": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-zA-Z]{3}$"
                  },
                  "recurrence": {
                    "type": "string",
                    "enum": [
                      "first",
                      "all",
                      "count"
                    ]
                  },
                  "recurringPayments": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 36
                  },
                  "windowDays": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 365
                  },
                  "holdDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 120
                  },
                  "join": {
                    "type": "string",
                    "enum": [
                      "open",
                      "approval",
                      "invite"
                    ]
                  },
                  "payoutMethod": {
                    "type": "string",
                    "enum": [
                      "transfer",
                      "manual",
                      "paypal",
                      "wise_export"
                    ]
                  },
                  "minPayout": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 99999999
                  },
                  "itemIds": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  },
                  "active": {
                    "type": "boolean"
                  },
                  "payoutMethods": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 4,
                    "items": {
                      "type": "string",
                      "enum": [
                        "transfer",
                        "manual",
                        "paypal",
                        "wise_export"
                      ]
                    }
                  },
                  "tiers": {
                    "type": "array",
                    "maxItems": 5,
                    "items": {
                      "type": "object",
                      "properties": {
                        "threshold": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 999999999
                        },
                        "percentBps": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 10000
                        },
                        "fixedAmount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 99999999
                        }
                      },
                      "required": [
                        "threshold"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "tierMetric": {
                    "type": "string",
                    "enum": [
                      "paid_referrals",
                      "revenue"
                    ]
                  },
                  "tierCurrency": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-zA-Z]{3}$"
                  },
                  "tierPeriod": {
                    "type": "string",
                    "enum": [
                      "lifetime",
                      "calendar_month",
                      "calendar_quarter",
                      "rolling_30d"
                    ]
                  },
                  "tierApply": {
                    "type": "string",
                    "enum": [
                      "forward",
                      "retroactive"
                    ]
                  },
                  "codeAttribution": {
                    "type": "string",
                    "enum": [
                      "coupon_wins",
                      "link_wins"
                    ]
                  },
                  "couponRateBps": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "codeOnlyAttribution": {
                    "type": "boolean"
                  },
                  "levels": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 2
                  },
                  "levelBps": {
                    "type": "array",
                    "maxItems": 2,
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 10000
                    }
                  },
                  "levelBasis": {
                    "type": "string",
                    "enum": [
                      "commission",
                      "net"
                    ]
                  },
                  "levelsAcknowledged": {
                    "type": "boolean"
                  }
                },
                "minProperties": 1,
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      }
    },
    "/api/v1/public/me/affiliate-programs/{id}/affiliates": {
      "get": {
        "operationId": "me.affiliatePrograms.affiliates.list",
        "summary": "List the affiliates of one of the signed-in seller's programs",
        "description": "Lists the program's affiliates with their earning totals and tier, optionally filtered by `status`. An affiliate's email is shown only when they consented and the app owner lets sellers see it.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "programId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "active",
                "paused",
                "banned"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      },
      "post": {
        "operationId": "me.affiliatePrograms.affiliates.create",
        "summary": "Add a person to a program directly (refused for sellers)",
        "description": "Never succeeds. A seller cannot enroll a person without asking, so this answers 403 `AFFILIATE_INVITE_NOT_ALLOWED`, or 404 `SELLER_NOT_FOUND` when the signed-in person has not started selling. Invite the person with `POST /api/v1/public/me/affiliate-programs/{id}/invitations` instead (`me.affiliatePrograms.invitations.create`); they join once they accept.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "userId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "required": [
                  "userId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      }
    },
    "/api/v1/public/me/affiliate-programs/{id}/commissions": {
      "get": {
        "operationId": "me.affiliatePrograms.commissions.list",
        "summary": "List the commissions earned in one of the signed-in seller's programs",
        "description": "Lists commissions for the program, filtered by `affiliateId`, `orderId` or `status`.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "affiliateId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "orderId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "programId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "approved",
                "paid",
                "reversed",
                "void"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      }
    },
    "/api/v1/public/me/affiliate-programs/{id}/invitations": {
      "post": {
        "operationId": "me.affiliatePrograms.invitations.create",
        "summary": "Invite a person by email or user id to the signed-in seller's program",
        "description": "Answers 202 `{ invited: true }` whoever the body names, so the answer reveals nothing about the person; when they exist and are not already in the program, a pending invitation is kept and they are notified. Nobody is enrolled until they accept. Refused with 409 when the program is turned off.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "userId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "email": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 254,
                    "pattern": "^[^@\\s]+@[^@\\s]+$"
                  }
                },
                "oneOf": [
                  {
                    "required": [
                      "userId"
                    ]
                  },
                  {
                    "required": [
                      "email"
                    ]
                  }
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      }
    },
    "/api/v1/public/me/affiliate-programs/{id}/payouts": {
      "get": {
        "operationId": "me.affiliatePrograms.payouts.list",
        "summary": "List the payouts of one of the signed-in seller's programs",
        "description": "Lists payout batches for the program, filtered by `affiliateId`, `status` or `method`.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "affiliateId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "method",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "transfer",
                "manual",
                "paypal",
                "wise_export"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "programId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "paid",
                "failed"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      }
    },
    "/api/v1/public/me/affiliates": {
      "get": {
        "operationId": "me.affiliates.list",
        "summary": "List the affiliate programs the signed-in user has joined",
        "description": "Lists the signed-in user's own affiliate rows with their earning totals and tier, filtered by `programId` or `status`.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "programId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "active",
                "paused",
                "banned"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      },
      "post": {
        "operationId": "me.affiliates.create",
        "summary": "Join an affiliate program as the signed-in user",
        "description": "Joins the program, active at once when it is open or pending when it asks for approval, and answers 201 with the new row or 200 with the row the user already has. An invitation-only program is joined only with a pending invitation, which this accepts, and is otherwise refused with 403. Joining one's own program is refused with 422; `code`, `recruitCode` and `shareContact` are optional.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "programId": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  },
                  "code": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 32
                  },
                  "recruitCode": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "shareContact": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "programId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts",
        "x-events": [
          "affiliate.joined"
        ]
      }
    },
    "/api/v1/public/me/affiliates/commissions": {
      "get": {
        "operationId": "me.affiliates.commissions.list",
        "summary": "List the signed-in user's affiliate commissions",
        "description": "Lists commissions on the user's own affiliate rows, filtered by `affiliateId`, `programId`, `orderId` or `status`. An `affiliateId` that is not theirs returns an empty list.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "affiliateId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "orderId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "programId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "approved",
                "paid",
                "reversed",
                "void"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      }
    },
    "/api/v1/public/me/affiliates/payout-account": {
      "post": {
        "operationId": "me.affiliates.payoutAccount.create",
        "summary": "Start a Stripe onboarding session for the signed-in affiliate's payouts",
        "description": "Uses the user's existing payout account, a seller account of theirs that takes transfers, or creates a Stripe recipient account for the given `country`, and answers a client secret for Stripe's embedded onboarding and payouts screens with the account status. Answers 404 when the user has joined no program, and 422 when their account has no email or the country is not supported.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  }
                },
                "required": [
                  "country"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      }
    },
    "/api/v1/public/me/affiliates/payout-account/sync": {
      "post": {
        "operationId": "me.affiliates.payoutAccount.sync.create",
        "summary": "Refresh the status of the signed-in affiliate's Stripe payout account",
        "description": "Reads the payout account from Stripe again, stores its status on the user's affiliate rows and answers it; answers `none` when no account is set up.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      }
    },
    "/api/v1/public/me/affiliates/payouts": {
      "get": {
        "operationId": "me.affiliates.payouts.list",
        "summary": "List the signed-in user's affiliate payouts",
        "description": "Lists payout batches made to the signed-in user, filtered by `affiliateId`, `programId`, `status` or `method`.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "affiliateId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "method",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "transfer",
                "manual",
                "paypal",
                "wise_export"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "programId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "paid",
                "failed"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      }
    },
    "/api/v1/public/me/affiliates/{id}": {
      "get": {
        "operationId": "me.affiliates.get",
        "summary": "Get one of the signed-in user's affiliate rows",
        "description": "Answers the affiliate row with its earning totals and tier. Another person's row reads as not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      }
    },
    "/api/v1/public/me/affiliates/{id}/code": {
      "put": {
        "operationId": "me.affiliates.code.update",
        "summary": "Change the signed-in user's referral code in one program",
        "description": "Sets a new code and the old one stops working. Refused with 422 when the code is not 3 to 32 letters, digits, dashes or underscores, and with 409 when it is taken.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 32
                  }
                },
                "required": [
                  "code"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      }
    },
    "/api/v1/public/me/affiliates/{id}/contact-consent": {
      "put": {
        "operationId": "me.affiliates.contactConsent.update",
        "summary": "Share or stop sharing the signed-in user's email with a program's seller",
        "description": "Records or withdraws consent to show the user's email to the program's seller; withdrawing hides it at once. The seller sees it only if the app owner allows it.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "shareContact": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "shareContact"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      }
    },
    "/api/v1/public/me/affiliates/{id}/payout-method": {
      "put": {
        "operationId": "me.affiliates.payoutMethod.update",
        "summary": "Choose how one program pays the signed-in affiliate",
        "description": "Sets the payout method from those the program offers: a Stripe transfer, by hand, PayPal or a Wise file with bank details. Setting a PayPal email or bank details needs a recent sign-in (403 `reauth_required`), and a new destination either waits for a confirmation link or applies with a hold, as the app owner's policies say, with the account emailed. Refused with 422 when the method is not offered, PayPal is not open or the details are invalid.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "method": {
                    "type": "string",
                    "enum": [
                      "transfer",
                      "manual",
                      "paypal",
                      "wise_export"
                    ]
                  },
                  "paypalEmail": {
                    "type": "string",
                    "maxLength": 254
                  },
                  "paypalEmailConfirm": {
                    "type": "string",
                    "maxLength": 254
                  },
                  "bank": {
                    "type": "object",
                    "properties": {
                      "holderName": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      },
                      "currency": {
                        "type": "string",
                        "pattern": "^[a-zA-Z]{3}$"
                      },
                      "receiverType": {
                        "type": "string",
                        "enum": [
                          "PRIVATE",
                          "BUSINESS"
                        ]
                      },
                      "iban": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 64
                      },
                      "bic": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 64
                      },
                      "accountNumber": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 64
                      },
                      "sortCode": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 64
                      },
                      "abartn": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 64
                      },
                      "accountType": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "enum": [
                          "CHECKING",
                          "SAVINGS",
                          null
                        ]
                      },
                      "addressCountryCode": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "pattern": "^[a-zA-Z]{2}$"
                      },
                      "addressCity": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 64
                      },
                      "addressFirstLine": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 128
                      },
                      "addressPostCode": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 64
                      }
                    },
                    "required": [
                      "holderName",
                      "currency"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "method"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/affiliates.ts"
      }
    },
    "/api/v1/public/me/billing/add-ons/{grantId}/cancel": {
      "post": {
        "operationId": "me.billing.addOns.cancel.create",
        "summary": "Remove a recurring add-on from the signed-in user's own subscription",
        "description": "Takes the add-on off the person's subscription with no proration; what was paid applies until `removeAt`. An optional `expectedQuantity` that no longer matches the units held is refused with 409 `QUANTITY_CHANGED`, and an `Idempotency-Key` sent again answers the first request. A one-time, pending, inactive or seat-class add-on is refused with its `reason`; in the management tenant an unverified email is refused with 403 `EMAIL_NOT_VERIFIED`.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedQuantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000000
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "addon-purchase",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/add-ons.ts",
        "x-events": [
          "addon.revoked"
        ]
      }
    },
    "/api/v1/public/me/billing/add-ons/{grantId}/cancel/preview": {
      "post": {
        "operationId": "me.billing.addOns.cancel.preview.create",
        "summary": "Preview removing a recurring add-on from the signed-in user's subscription",
        "description": "Answers what the cancel would do: the next invoice before and after, `removeAt` and the entitlements lost then. Refuses where the cancel would, with the same bodies, and writes nothing.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "subscription-preview",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/add-ons.ts"
      }
    },
    "/api/v1/public/me/billing/add-ons/{grantId}/decrease": {
      "post": {
        "operationId": "me.billing.addOns.decrease.create",
        "summary": "Lower the quantity of a recurring add-on on the signed-in user's subscription",
        "description": "Takes `quantity` units off with no proration; taking off every unit removes the add-on, as the cancel does. An `expectedQuantity` that no longer matches is refused with 409 `QUANTITY_CHANGED`, and the same `Idempotency-Key` sent again answers the first decrease. In the management tenant an unverified email is refused with 403 `EMAIL_NOT_VERIFIED`.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  },
                  "expectedQuantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000000
                  }
                },
                "required": [
                  "quantity"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "addon-purchase",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/add-ons.ts",
        "x-events": [
          "addon.changed",
          "addon.revoked"
        ]
      }
    },
    "/api/v1/public/me/billing/add-ons/{grantId}/decrease/preview": {
      "post": {
        "operationId": "me.billing.addOns.decrease.preview.create",
        "summary": "Preview lowering the quantity of a recurring add-on the signed-in user holds",
        "description": "Answers what taking `quantity` units off would do to the next invoice, with `removeAt` and the entitlement changes. Refuses where the decrease would and writes nothing.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  }
                },
                "required": [
                  "quantity"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "subscription-preview",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/add-ons.ts"
      }
    },
    "/api/v1/public/me/billing/add-ons/{grantId}/future-versions": {
      "post": {
        "operationId": "me.billing.addOns.futureVersions.create",
        "summary": "Opt a lifetime add-on the signed-in user holds out of later versions, or back in",
        "description": "`optOut: true` keeps the version held and takes no later one; `optOut: false` opts back in and brings the licence to the current version at once. Moves no money. Refused with 409 `FUTURE_VERSIONS_NOT_INCLUDED` when the add-on was not sold with future versions, and 409 `NOT_HELD` when it is not held.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "optOut": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "optOut"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "addon-purchase",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/add-ons.ts"
      }
    },
    "/api/v1/public/me/billing/add-ons/{grantId}/upgrade": {
      "get": {
        "operationId": "me.billing.addOns.upgrade.list",
        "summary": "Quote upgrading a one-time or lifetime add-on to its offer's current version",
        "description": "Answers what the upgrade costs for the signed-in user, crediting what was paid, and what it changes. Writes nothing. Refused with 409 when the add-on is already current, includes later versions at no charge, or has a payment still settling.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "subscription-preview",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/add-ons.ts"
      },
      "post": {
        "operationId": "me.billing.addOns.upgrade.create",
        "summary": "Buy the upgrade of an add-on the signed-in user holds to its current version",
        "description": "Opens a Checkout session on the person's own customer for the amount due, or makes the upgrade at once when nothing is due. The body's `requestId` makes a retry answer what the first request made; the same `requestId` reused for another purchase is refused with 409 `IDEMPOTENCY_KEY_REUSED`. Also refused with 409 when the add-on is already current or a payment is settling, and with 409 `STRIPE_NOT_CONNECTED` when the app has no Stripe account.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "requestId": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 100,
                    "pattern": "^[A-Za-z0-9._:-]+$"
                  },
                  "successUrl": {
                    "type": "string",
                    "format": "uri",
                    "maxLength": 2000
                  },
                  "cancelUrl": {
                    "type": "string",
                    "format": "uri",
                    "maxLength": 2000
                  },
                  "uiMode": {
                    "type": "string",
                    "enum": [
                      "hosted",
                      "embedded"
                    ]
                  },
                  "returnUrl": {
                    "type": "string",
                    "format": "uri",
                    "maxLength": 2000
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "maxProperties": 20
                  }
                },
                "required": [
                  "requestId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "addon-purchase",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/add-ons.ts",
        "x-events": [
          "addon.purchased"
        ]
      }
    },
    "/api/v1/public/me/billing/checkout": {
      "post": {
        "operationId": "me.billing.checkout.create",
        "summary": "Buy an add-on offer for the signed-in user",
        "description": "A one-time, lifetime or consumable offer opens a Stripe Checkout session on the person's own customer; a recurring offer is added to the person's own subscription with no session, answered `added` or `payment_required`. Refused with 409 `STRIPE_NOT_CONNECTED` when the app has no Stripe account, 409 `IDEMPOTENCY_KEY_REUSED` for an `Idempotency-Key` sent again with another purchase, and in the management tenant 403 `EMAIL_NOT_VERIFIED` for an unverified email.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "offerSlug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  },
                  "currency": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 3
                  },
                  "promotionCode": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "successUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "cancelUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "uiMode": {
                    "type": "string",
                    "enum": [
                      "hosted",
                      "embedded"
                    ]
                  },
                  "returnUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "prorationDate": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "maxProperties": 20
                  }
                },
                "required": [
                  "offerSlug"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "addon-purchase",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/add-ons.ts"
      }
    },
    "/api/v1/public/me/billing/checkout/preview": {
      "post": {
        "operationId": "me.billing.checkout.preview.create",
        "summary": "Preview the cost of a recurring add-on on the user's own subscription",
        "description": "Answers what buying the recurring add-on named by `offerSlug` (and `quantity`) will cost now and on the next invoice, and refuses where the purchase would; nothing is written. Answers 404 when no recurring add-on with that slug is on sale. Behind the money gate: in the management tenant a user with an unverified email gets 403 `EMAIL_NOT_VERIFIED`.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "offerSlug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  }
                },
                "required": [
                  "offerSlug"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "subscription-preview",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/money.ts"
      }
    },
    "/api/v1/public/me/billing/offers": {
      "get": {
        "operationId": "me.billing.offers.list",
        "summary": "List the add-on offers the signed-in user can buy, with what they hold",
        "description": "Lists the one-time, lifetime and consumable offers sold to people, priced in the person's billing currency, else the `currency` asked, else the app's first. Each offer carries the rows the person holds from it and whether it can be bought now.",
        "tags": [
          "Me"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/add-ons.ts"
      }
    },
    "/api/v1/public/me/billing/payment-method/default": {
      "post": {
        "operationId": "me.billing.paymentMethod.default.create",
        "summary": "Make a confirmed card the signed-in user's default payment method",
        "description": "Takes the `setupIntentId` of a card setup the user confirmed and makes that card the default on their own Stripe customer. Answers 404 for an unknown setup, 409 when the setup did not succeed or another account pays for the user's plan, and 409 `STRIPE_NOT_CONNECTED` when the app has no Stripe account. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "setupIntentId": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 255,
                    "pattern": "^seti_[A-Za-z0-9]+$"
                  }
                },
                "required": [
                  "setupIntentId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "payment-method",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/money.ts"
      }
    },
    "/api/v1/public/me/billing/payment-method/setup": {
      "post": {
        "operationId": "me.billing.paymentMethod.setup.create",
        "summary": "Start a card setup on the signed-in user's own Stripe customer",
        "description": "Creates a Stripe SetupIntent for a new card and answers its client secret with the publishable key to confirm it in the browser; the customer is created on first use. Answers 409 when another account pays for the user's plan, 409 `STRIPE_NOT_CONNECTED` when the app has no Stripe account, and 400 when the app's keys cannot open Stripe.js. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "payment-method",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/money.ts"
      }
    },
    "/api/v1/public/me/bookings": {
      "get": {
        "operationId": "me.bookings.list",
        "summary": "List the signed-in user's bookings, soonest first",
        "description": "Returns the times the signed-in user booked, confirmed and cancelled by default, filtered by status, item, calendar or a start range, sorted by start (`-start` for latest first). Bookings a guest made with the user's verified email are attached to the user first. Answers 503 while selling is turned off on the server.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "calendarId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40
            }
          },
          {
            "name": "itemId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "start",
                "-start"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "held",
                "confirmed",
                "cancelled",
                "expired"
              ]
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/bookings.ts"
      }
    },
    "/api/v1/public/me/bookings/{id}": {
      "get": {
        "operationId": "me.bookings.get",
        "summary": "Get one of the signed-in user's bookings",
        "description": "Returns the booking with the actions the user may take on it. Another person's booking is not found. Answers 503 while selling is turned off on the server.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/bookings.ts"
      }
    },
    "/api/v1/public/me/bookings/{id}/calendar.ics": {
      "get": {
        "operationId": "me.bookings.calendarIcs.list",
        "summary": "Download one of the signed-in user's bookings as a calendar file",
        "description": "Answers a `text/calendar` attachment named `booking-<id>.ics`, not JSON. Another person's booking is not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/bookings.ts"
      }
    },
    "/api/v1/public/me/bookings/{id}/cancel": {
      "post": {
        "operationId": "me.bookings.cancel.create",
        "summary": "Cancel one of the signed-in user's bookings",
        "description": "Cancels a confirmed booking within the seller's cancel rules, gives its seats back and refunds it when the seller's rule says `full`; a time included in a bundle is never refunded on its own. A cancel outside the rules answers 422, and a booking changed meanwhile 409; a refund Stripe refuses leaves the booking cancelled and the answer carries `refundFailed: true`.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/bookings.ts",
        "x-events": [
          "booking.cancelled",
          "order.refunded"
        ]
      }
    },
    "/api/v1/public/me/bookings/{id}/reschedule": {
      "post": {
        "operationId": "me.bookings.reschedule.create",
        "summary": "Move one of the signed-in user's bookings to another slot",
        "description": "Moves the booking to `slotStart` on its item, keeping its length and the seller's notice and cancel-window rules. Answers 409 when the new slot is full, a booking limit is reached, the item's bookings are moving to another calendar or the booking changed meanwhile, and 422 when the slot is not valid or the rules refuse the move.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slotStart": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  }
                },
                "required": [
                  "slotStart"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/bookings.ts",
        "x-events": [
          "booking.rescheduled"
        ]
      }
    },
    "/api/v1/public/me/calendars": {
      "get": {
        "operationId": "me.calendars.list",
        "summary": "List the signed-in user's shared booking calendars as a seller",
        "description": "Returns the seller's calendars, paged, each with the items booked on it. Answers 404 when the user has not started selling, and 503 while selling is turned off on the server.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/calendars.ts"
      },
      "post": {
        "operationId": "me.calendars.create",
        "summary": "Create a shared booking calendar for the signed-in user as a seller",
        "description": "Saves a calendar with its name, slot grid and settings, for the seller's items to book on. Answers 404 when the user has not started selling, and 422 when the grid is not valid or the seller already keeps the most calendars allowed (20).",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "timeZone": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "slotMinutes": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 720
                  },
                  "bufferMinutes": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 240
                  },
                  "bufferBeforeMinutes": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 240
                  },
                  "seatsPerSlot": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000
                  },
                  "weekly": {
                    "type": "object",
                    "properties": {
                      "mon": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "tue": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "wed": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "thu": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "fri": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "sat": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "sun": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "additionalProperties": false
                  },
                  "exceptions": {
                    "type": "array",
                    "maxItems": 200,
                    "items": {
                      "type": "object",
                      "properties": {
                        "date": {
                          "type": "string",
                          "maxLength": 10
                        },
                        "windows": {
                          "type": "array",
                          "maxItems": 6,
                          "items": {
                            "type": "object",
                            "properties": {
                              "from": {
                                "type": "string",
                                "maxLength": 5
                              },
                              "to": {
                                "type": "string",
                                "maxLength": 5
                              }
                            },
                            "required": [
                              "from",
                              "to"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "date",
                        "windows"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "capacityModel": {
                    "type": "string",
                    "enum": [
                      "shared_pool",
                      "item_caps",
                      "exclusive"
                    ]
                  },
                  "moveConflicts": {
                    "type": "string",
                    "enum": [
                      "refuse",
                      "overbook"
                    ]
                  },
                  "bookingLimits": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "perDay": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "perWeek": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "maximum": 1000
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "name",
                  "timeZone",
                  "slotMinutes",
                  "weekly"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/calendars.ts"
      }
    },
    "/api/v1/public/me/calendars/{id}": {
      "get": {
        "operationId": "me.calendars.get",
        "summary": "Get one of the signed-in user's shared booking calendars",
        "description": "Returns the calendar with the items booked on it. Another seller's calendar is not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/calendars.ts"
      },
      "put": {
        "operationId": "me.calendars.update",
        "summary": "Replace the name, grid and settings of one of the user's calendars",
        "description": "Saves the calendar whole. Answers 422 when the zone, slot length or buffer changes, or the capacity model narrows, while a booking on it has not ended, or when seats per slot drop below the most taken on a slot to come; 409 when the calendar changed meanwhile.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "timeZone": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "slotMinutes": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 720
                  },
                  "bufferMinutes": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 240
                  },
                  "bufferBeforeMinutes": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 240
                  },
                  "seatsPerSlot": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000
                  },
                  "weekly": {
                    "type": "object",
                    "properties": {
                      "mon": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "tue": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "wed": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "thu": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "fri": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "sat": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "sun": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "additionalProperties": false
                  },
                  "exceptions": {
                    "type": "array",
                    "maxItems": 200,
                    "items": {
                      "type": "object",
                      "properties": {
                        "date": {
                          "type": "string",
                          "maxLength": 10
                        },
                        "windows": {
                          "type": "array",
                          "maxItems": 6,
                          "items": {
                            "type": "object",
                            "properties": {
                              "from": {
                                "type": "string",
                                "maxLength": 5
                              },
                              "to": {
                                "type": "string",
                                "maxLength": 5
                              }
                            },
                            "required": [
                              "from",
                              "to"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "date",
                        "windows"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "capacityModel": {
                    "type": "string",
                    "enum": [
                      "shared_pool",
                      "item_caps",
                      "exclusive"
                    ]
                  },
                  "moveConflicts": {
                    "type": "string",
                    "enum": [
                      "refuse",
                      "overbook"
                    ]
                  },
                  "bookingLimits": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "perDay": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "perWeek": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "maximum": 1000
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "name",
                  "timeZone",
                  "slotMinutes",
                  "weekly"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/calendars.ts"
      },
      "delete": {
        "operationId": "me.calendars.delete",
        "summary": "Delete one of the signed-in user's shared booking calendars",
        "description": "Deletes a calendar no item is booked on; one with items answers 422 (`calendar_has_items`). Another seller's calendar is not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/calendars.ts"
      }
    },
    "/api/v1/public/me/carts/{cartId}": {
      "get": {
        "operationId": "me.carts.get",
        "summary": "Get a cart the signed-in user checked out, with its orders",
        "description": "Answers the cart's orders, one per seller, as the page Stripe returns the buyer to reads them. A cart with none of the signed-in user's orders is not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "cartId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/orders.ts"
      }
    },
    "/api/v1/public/me/carts/{cartId}/next": {
      "post": {
        "operationId": "me.carts.next.create",
        "summary": "Open the next payment step of the signed-in user's storefront cart",
        "description": "For a cart paid in steps, opens the next step's Stripe page, or returns the open one again; a cart paid on one page is answered as it is. Takes no body. Another person's cart is not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "cartId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/orders.ts"
      }
    },
    "/api/v1/public/me/coupons": {
      "get": {
        "operationId": "me.coupons.list",
        "summary": "List the signed-in user's coupons as a seller",
        "description": "Lists, a page at a time, the coupons the person made for their own items. Refused with 404 `SELLER_NOT_FOUND` when the person has not started selling.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/coupons.ts"
      },
      "post": {
        "operationId": "me.coupons.create",
        "summary": "Create a coupon for the signed-in user's own items",
        "description": "Creates a percent or amount coupon owned by the person's seller account and answers 201. Items named in `itemIds` must be the person's own. Refused with 404 `SELLER_NOT_FOUND` when the person has not started selling, 409 `COUPON_CODE_TAKEN` when another coupon has the code, and 422 `COUPON_INVALID` for terms that do not hold together.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 32
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "percent",
                      "amount"
                    ]
                  },
                  "percentBps": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "amount": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 99999999
                  },
                  "currency": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-zA-Z]{3}$"
                  },
                  "duration": {
                    "type": "string",
                    "enum": [
                      "once",
                      "repeating",
                      "forever"
                    ]
                  },
                  "durationPeriods": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 36
                  },
                  "maxRedemptions": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 1000000
                  },
                  "perBuyerOnce": {
                    "type": "boolean"
                  },
                  "startsAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 40
                  },
                  "endsAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 40
                  },
                  "minSubtotal": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 99999999
                  },
                  "itemIds": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  },
                  "active": {
                    "type": "boolean"
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200
                  },
                  "affiliateId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-f0-9]{24}$"
                  }
                },
                "required": [
                  "code",
                  "kind"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/coupons.ts"
      }
    },
    "/api/v1/public/me/coupons/{id}": {
      "get": {
        "operationId": "me.coupons.get",
        "summary": "Get one of the signed-in user's coupons",
        "description": "Another seller's coupon is not found. Refused with 404 `SELLER_NOT_FOUND` when the person has not started selling.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/coupons.ts"
      },
      "delete": {
        "operationId": "me.coupons.delete",
        "summary": "Delete one of the signed-in user's coupons",
        "description": "No new checkout can use the coupon and its code is free again; checkouts already holding it keep their discount. Another seller's coupon is not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/coupons.ts"
      },
      "patch": {
        "operationId": "me.coupons.update",
        "summary": "Update the terms of one of the signed-in user's coupons",
        "description": "Changes the coupon's terms; its code and kind stay as made. Another seller's coupon is not found, and terms that do not hold together are refused with 422 `COUPON_INVALID`.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "percentBps": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "amount": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 99999999
                  },
                  "currency": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-zA-Z]{3}$"
                  },
                  "duration": {
                    "type": "string",
                    "enum": [
                      "once",
                      "repeating",
                      "forever"
                    ]
                  },
                  "durationPeriods": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 36
                  },
                  "maxRedemptions": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 1000000
                  },
                  "perBuyerOnce": {
                    "type": "boolean"
                  },
                  "startsAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 40
                  },
                  "endsAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 40
                  },
                  "minSubtotal": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 99999999
                  },
                  "itemIds": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  },
                  "active": {
                    "type": "boolean"
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200
                  },
                  "affiliateId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-f0-9]{24}$"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/coupons.ts"
      }
    },
    "/api/v1/public/me/credits": {
      "get": {
        "operationId": "me.credits.list",
        "summary": "Get the signed-in user's own credit balance",
        "description": "Answers the personal wallet's available and held credits, lifetime totals granted, consumed, expired and refunded, and the automatic top-up switch, threshold and pause reason.",
        "tags": [
          "Me"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/credits.ts"
      }
    },
    "/api/v1/public/me/credits/auto-top-up": {
      "get": {
        "operationId": "me.credits.autoTopUp.list",
        "summary": "Get the automatic top-up setting of the user's own credit wallet",
        "description": "Answers the setting, its pack priced in the user's billing currency, this month's top-up count and the card the next top-up charges.",
        "tags": [
          "Me"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/credits.ts"
      },
      "patch": {
        "operationId": "me.credits.autoTopUp.update",
        "summary": "Change the automatic top-up setting of the user's own credit wallet",
        "description": "Saves the threshold, pack and monthly cap; switched on with no saved card it is saved paused. Answers 403 `AUTO_TOP_UP_OFF` when the app does not offer automatic top-up, 400 for a pack not on sale or without a price in the user's currency, a cap above the app's limit or a switch-on without threshold and pack, and 409 when the pack's terms changed since they were shown or the org collects tax. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "threshold": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "creditPackageId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "monthlyCap": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50
                  },
                  "resume": {
                    "type": "boolean"
                  },
                  "acceptVersion": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  }
                },
                "additionalProperties": false,
                "minProperties": 1
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/credits.ts"
      }
    },
    "/api/v1/public/me/credits/buckets": {
      "get": {
        "operationId": "me.credits.buckets.list",
        "summary": "List the credit buckets in the user's own wallet, newest first",
        "description": "Paginated, 20 per page by default and at most 100, filterable by `status` and `source`.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1
            }
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/credits.ts"
      }
    },
    "/api/v1/public/me/credits/consume": {
      "post": {
        "operationId": "me.credits.consume.create",
        "summary": "Spend credits from the signed-in user's own wallet",
        "description": "Deducts `amount` from the personal balance; a repeated `idempotencyKey` returns the earlier result instead of spending twice. Answers 402 with `available` and `requested` when the balance is short. Emits `credit.low_balance` too when what is left is under a fifth of the amount spent, and may start an automatic top-up.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "number",
                    "minimum": 1
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "metadata": {
                    "type": "object",
                    "maxProperties": 10
                  }
                },
                "required": [
                  "amount"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "credit",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/credits.ts",
        "x-events": [
          "credit.consumed",
          "credit.low_balance"
        ]
      }
    },
    "/api/v1/public/me/credits/expiring": {
      "get": {
        "operationId": "me.credits.expiring.list",
        "summary": "List the user's own credits that expire within a number of days",
        "description": "Answers active buckets with credits left whose expiry falls within `days` (1 to 90, 7 by default), soonest first, and the total about to expire.",
        "tags": [
          "Me"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/credits.ts"
      }
    },
    "/api/v1/public/me/credits/holds": {
      "get": {
        "operationId": "me.credits.holds.list",
        "summary": "List the credit holds on the signed-in user's own wallet",
        "description": "Paginated, filterable by hold `status`.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "held",
                "settling",
                "settled",
                "released",
                "expired"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/credits.ts"
      }
    },
    "/api/v1/public/me/credits/holds/{holdId}/release": {
      "post": {
        "operationId": "me.credits.holds.release.create",
        "summary": "Release a credit hold on the user's own wallet, returning its credits",
        "description": "Closes the hold without spending and puts its credits back in the available balance. Answers 409 `HOLD_NOT_OPEN` for a hold already settled, released or expired.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "holdId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "credit-hold",
            "windowMs": 60000,
            "max": 60,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/credits.ts",
        "x-events": [
          "credit.released"
        ]
      }
    },
    "/api/v1/public/me/credits/holds/{holdId}/settle": {
      "post": {
        "operationId": "me.credits.holds.settle.create",
        "summary": "Settle a credit hold on the user's own wallet for the real cost",
        "description": "Spends `amount` (0 or more) from the hold and returns the rest to the balance. Answers 409 `HOLD_NOT_OPEN` for a hold already closed, and 402 when the cost is more than the balance can cover.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "holdId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "number",
                    "minimum": 0
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "metadata": {
                    "type": "object",
                    "maxProperties": 10
                  }
                },
                "required": [
                  "amount"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "credit-hold",
            "windowMs": 60000,
            "max": 60,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/credits.ts",
        "x-events": [
          "credit.consumed",
          "credit.settled"
        ]
      }
    },
    "/api/v1/public/me/credits/packages": {
      "get": {
        "operationId": "me.credits.packages.list",
        "summary": "List the credit packs on sale, in the order the app set",
        "description": "Only packs that are active, not archived and priced above zero.",
        "tags": [
          "Me"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/credits.ts"
      }
    },
    "/api/v1/public/me/credits/payment-method-setup": {
      "post": {
        "operationId": "me.credits.paymentMethodSetup.create",
        "summary": "Open a Stripe page that saves a card for the user's automatic top-up",
        "description": "Creates a Stripe setup session on the user's own customer and answers its URL; `successUrl` and `cancelUrl` are optional and checked against the app's allowed return URLs. Answers 409 `IDEMPOTENCY_KEY_REUSED` when the `Idempotency-Key` was sent before for another request. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "successUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "cancelUrl": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/credits.ts"
      }
    },
    "/api/v1/public/me/credits/purchase": {
      "post": {
        "operationId": "me.credits.purchase.create",
        "summary": "Start a Stripe checkout to buy a credit pack for the signed-in user",
        "description": "Creates a checkout for `creditPackageId` on the user's own customer, in their billing currency, with an optional `promotionCode` and hosted or embedded `uiMode`; the credits are granted when Stripe reports the payment. Answers 400 for an invalid code or a currency the pack has no price in, 409 `STRIPE_NOT_CONNECTED` or `IDEMPOTENCY_KEY_REUSED`, and 503 when the org's tax setting could not be read. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "creditPackageId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "currency": {
                    "type": "string",
                    "minLength": 2
                  },
                  "successUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "cancelUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "maxProperties": 20
                  },
                  "promotionCode": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "uiMode": {
                    "type": "string",
                    "enum": [
                      "hosted",
                      "embedded"
                    ]
                  },
                  "returnUrl": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": [
                  "creditPackageId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/credits.ts"
      }
    },
    "/api/v1/public/me/credits/reserve": {
      "post": {
        "operationId": "me.credits.reserve.create",
        "summary": "Put credits from the user's own wallet on hold for work not yet costed",
        "description": "Holds `amount` for `ttlSeconds` (released by itself when it runs out) so a later settle spends the real cost. Answers 402 with `available` and `requested` when the balance is short. Emits `credit.low_balance` too when what is left is under a fifth of the amount held.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "number",
                    "minimum": 1
                  },
                  "ttlSeconds": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 86400
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "metadata": {
                    "type": "object",
                    "maxProperties": 10
                  }
                },
                "required": [
                  "amount"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "credit-hold",
            "windowMs": 60000,
            "max": 60,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/credits.ts",
        "x-events": [
          "credit.reserved",
          "credit.low_balance"
        ]
      }
    },
    "/api/v1/public/me/credits/transactions": {
      "get": {
        "operationId": "me.credits.transactions.list",
        "summary": "List the credit transactions on the user's own wallet, newest first",
        "description": "Paginated, 20 per page by default and at most 100, filterable by transaction `type`.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/credits.ts"
      }
    },
    "/api/v1/public/me/deletion": {
      "get": {
        "operationId": "me.deletion.list",
        "summary": "Preview what deleting the signed-in user's account would forfeit",
        "description": "Lists the user's own subscription (ended with nothing credited), the add-ons and credits they hold, and whether the org's setting blocks the delete until those are used, refunded or expired. Read only.",
        "tags": [
          "Me"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/index.ts"
      }
    },
    "/api/v1/public/me/entitlements/check": {
      "post": {
        "operationId": "me.entitlements.check.create",
        "summary": "Check one entitlement slug against the user and their workspaces",
        "description": "Each subject in `subjects` (`{user: true}` or `{workspaceId}`) answers from its own entitlement, in the order given, and `allowed` is true when any of them allows it. `current` is the caller's count for a limit and `wanted` what the request would add. Answers 403 when the user is not a member of a named workspace or the workspace's company rules refuse them.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slug": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  },
                  "subjects": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 5,
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "user": {
                              "const": true
                            }
                          },
                          "required": [
                            "user"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "workspaceId": {
                              "type": "string",
                              "pattern": "^[a-fA-F0-9]{24}$"
                            }
                          },
                          "required": [
                            "workspaceId"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "current": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "wanted": {
                    "type": "integer",
                    "minimum": 1
                  }
                },
                "required": [
                  "slug",
                  "subjects"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/index.ts"
      }
    },
    "/api/v1/public/me/files": {
      "get": {
        "operationId": "me.files.list",
        "summary": "List the signed-in seller's files for buyers, newest first",
        "description": "Each file carries its malware scan status and the ids of the releases that hold it. Answers 404 `SELLER_NOT_FOUND` when the user has not started selling.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/releases.ts"
      }
    },
    "/api/v1/public/me/files/uploads": {
      "post": {
        "operationId": "me.files.uploads.create",
        "summary": "Start an upload of one file for buyers as the signed-in seller",
        "description": "Answers an upload URL, method, headers, expiry and size ceiling for the browser to send the file to directly, in one request or in chunks. Answers 503 `UPLOADS_UNAVAILABLE` when the org's plan refuses the upload and 501 when direct uploads are not available. Answers 404 `SELLER_NOT_FOUND` when the user has not started selling.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 1024
                  },
                  "size": {
                    "type": "number"
                  },
                  "contentType": {
                    "type": "string",
                    "maxLength": 255
                  }
                },
                "required": [
                  "name",
                  "size",
                  "contentType"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "public-write",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/releases.ts"
      }
    },
    "/api/v1/public/me/files/uploads/{uploadId}/complete": {
      "post": {
        "operationId": "me.files.uploads.complete.create",
        "summary": "Finish a seller's file upload and record the file",
        "description": "Answers the stored file with its scan pending. Answers 409 `UPLOAD_NOT_RECEIVED` when the file has not arrived yet and 409 `UPLOAD_FINALIZING` while it is being checked; retry either later.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "uploadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "public-write",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/releases.ts"
      }
    },
    "/api/v1/public/me/files/{fileId}": {
      "get": {
        "operationId": "me.files.get",
        "summary": "Get one of the signed-in seller's files and the releases that hold it",
        "description": "Another seller's file answers 404.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/releases.ts"
      },
      "delete": {
        "operationId": "me.files.delete",
        "summary": "Delete one of the signed-in seller's files that no release holds",
        "description": "Answers 409 `FILE_IN_USE` while any release holds the file, and 502 when storage could not remove it. Another seller's file answers 404.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/releases.ts"
      }
    },
    "/api/v1/public/me/grants": {
      "get": {
        "operationId": "me.grants.list",
        "summary": "List what the signed-in user holds beyond their plan",
        "description": "Every grant source, for display only: a sponsored grant names its sponsor and an admin grant its `expiresAt`. Feature gating reads the entitlement, not this list.",
        "tags": [
          "Me"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/grants.ts"
      }
    },
    "/api/v1/public/me/holdings": {
      "get": {
        "operationId": "me.holdings.list",
        "summary": "List the signed-in user's holdings from purchases, newest first",
        "description": "Each holding carries what it delivers now, such as the releases of a file benefit or the keys of a license key benefit. Filter by `orderId` or `kind`. Attaches the user's earlier guest purchases first, at most once a minute.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "file",
                "link",
                "message",
                "license_key",
                "access",
                "manual",
                "webhook_only",
                "transfer",
                "item"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "orderId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/holdings.ts"
      }
    },
    "/api/v1/public/me/holdings/{id}/deactivate": {
      "post": {
        "operationId": "me.holdings.deactivate.create",
        "summary": "Remove one activation from a license key the signed-in user holds",
        "description": "Frees the activation named by the key's `unit` and the `instance`, to move the key to another machine, and answers the holding's keys. Answers 404 `ACTIVATION_NOT_FOUND` when that key has no activation on that instance.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "unit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  },
                  "instance": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "unit",
                  "instance"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/holdings.ts"
      }
    },
    "/api/v1/public/me/holdings/{id}/downloads": {
      "post": {
        "operationId": "me.holdings.downloads.create",
        "summary": "Get a short-lived download link for one file of a holding",
        "description": "The holding must be the user's own, active and available, and the file must be in a release it gives and pass the scan; otherwise 404. Answers 403 `DOWNLOAD_LIMIT_REACHED` when every included download is used. The download is counted when the link is used, not here.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fileId": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  }
                },
                "required": [
                  "fileId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/holdings.ts"
      }
    },
    "/api/v1/public/me/item-subscriptions": {
      "get": {
        "operationId": "me.itemSubscriptions.list",
        "summary": "List the subscriptions the signed-in user holds from items they bought",
        "description": "Lists the person's own item subscriptions, apart from the app's plan, filtered by `status`, `itemId` or `groupId`. Subscriptions bought as a guest under the person's verified email are attached to the account first.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "groupId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "itemId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "incomplete",
                "trialing",
                "active",
                "past_due",
                "ended"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/item-subscriptions.ts"
      }
    },
    "/api/v1/public/me/item-subscriptions/{id}": {
      "get": {
        "operationId": "me.itemSubscriptions.get",
        "summary": "Get one item subscription the signed-in user holds",
        "description": "Another person's subscription is not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/item-subscriptions.ts"
      }
    },
    "/api/v1/public/me/item-subscriptions/{id}/cancel": {
      "post": {
        "operationId": "me.itemSubscriptions.cancel.create",
        "summary": "Cancel an item subscription the signed-in user holds at the period end",
        "description": "The person keeps what they paid for until the end of the current period and can resume until then. `mode: now` is refused for the holder with 409 `SUBSCRIPTION_CHANGE_REFUSED`, as is a subscription already set to end or already ended. Accepts an `Idempotency-Key`.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "at_period_end",
                      "now"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/item-subscriptions.ts",
        "x-events": [
          "item_subscription.canceled"
        ]
      }
    },
    "/api/v1/public/me/item-subscriptions/{id}/change": {
      "post": {
        "operationId": "me.itemSubscriptions.change.create",
        "summary": "Move an item subscription the signed-in user holds to another tier",
        "description": "Moves to the tier named by `variantId` now, sets the move for the period end, or withdraws a move already set. Refused with 409 `SUBSCRIPTION_CHANGE_REFUSED` when the subscription is set to end, has an unpaid renewal, or is in an introductory price or set number of payments. Accepts an `Idempotency-Key`.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "variantId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$"
                  }
                },
                "required": [
                  "variantId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/item-subscriptions.ts",
        "x-events": [
          "item_subscription.changed"
        ]
      }
    },
    "/api/v1/public/me/item-subscriptions/{id}/change-preview": {
      "get": {
        "operationId": "me.itemSubscriptions.changePreview.list",
        "summary": "Preview moving an item subscription the signed-in user holds to another tier",
        "description": "Answers, for the tier named by `variantId`, whether the move is up or down, when it applies and what is charged today. Writes nothing.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "variantId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/item-subscriptions.ts"
      }
    },
    "/api/v1/public/me/item-subscriptions/{id}/resume": {
      "post": {
        "operationId": "me.itemSubscriptions.resume.create",
        "summary": "Undo the cancel of an item subscription the signed-in user holds",
        "description": "Keeps a subscription set to end at the period end going, before that end. Refused with 409 `SUBSCRIPTION_CHANGE_REFUSED` when it is not set to end or changed meanwhile. Accepts an `Idempotency-Key`.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/item-subscriptions.ts",
        "x-events": [
          "item_subscription.resumed"
        ]
      }
    },
    "/api/v1/public/me/items": {
      "get": {
        "operationId": "me.items.list",
        "summary": "List the items the signed-in user sells, most recently updated first",
        "description": "Filtered by `status`, `q` (name or slug) and `typeKey`. The pending review list is oldest first instead.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "sellerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "sellerType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "user",
                "workspace",
                "org"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "pending_review",
                "published",
                "unlisted",
                "archived",
                "rejected"
              ]
            }
          },
          {
            "name": "typeKey",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 48
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/items.ts"
      },
      "post": {
        "operationId": "me.items.create",
        "summary": "Create an item the signed-in user sells, as a draft",
        "description": "Creates a draft item of the type named by `typeKey` under the person's seller account and answers 201. Refused with 404 `SELLER_NOT_FOUND` when the person has not started selling, 409 when the slug or a resource is taken, and 422 when the content does not meet the item type.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "typeKey": {
                    "type": "string",
                    "maxLength": 48
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "slug": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "summary": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 20000
                  },
                  "media": {
                    "type": "array",
                    "maxItems": 8,
                    "items": {
                      "type": "string",
                      "maxLength": 64
                    }
                  },
                  "ctaText": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "variants": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 250,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "label": {
                          "type": "string",
                          "maxLength": 126
                        },
                        "optionValues": {
                          "type": "object",
                          "maxProperties": 3,
                          "propertyNames": {
                            "maxLength": 16
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 16
                          }
                        },
                        "rank": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 1000
                        },
                        "prices": {
                          "type": "array",
                          "maxItems": 40,
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[a-z]{3}$"
                              },
                              "mode": {
                                "type": "string",
                                "enum": [
                                  "fixed",
                                  "free",
                                  "pwyw"
                                ]
                              },
                              "amount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "compareAtAmount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "minimum": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "suggested": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "maximum": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "recurring": {
                                "type": "object",
                                "properties": {
                                  "interval": {
                                    "type": "string",
                                    "enum": [
                                      "day",
                                      "week",
                                      "month",
                                      "year"
                                    ]
                                  },
                                  "intervalCount": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 365
                                  },
                                  "trialDays": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 730
                                  },
                                  "endAfterPayments": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 1000
                                  },
                                  "intro": {
                                    "type": "object",
                                    "properties": {
                                      "amount": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 10000000000
                                      },
                                      "periods": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 100
                                      }
                                    },
                                    "required": [
                                      "amount",
                                      "periods"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "interval"
                                ],
                                "additionalProperties": false
                              },
                              "deposit": {
                                "type": "object",
                                "properties": {
                                  "percentBps": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 10000
                                  }
                                },
                                "required": [
                                  "percentBps"
                                ],
                                "additionalProperties": false
                              },
                              "milestones": {
                                "type": "array",
                                "maxItems": 6,
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "label": {
                                      "type": "string",
                                      "maxLength": 60
                                    },
                                    "percentBps": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 10000
                                    }
                                  },
                                  "required": [
                                    "label",
                                    "percentBps"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "installments": {
                                "type": "object",
                                "properties": {
                                  "count": {
                                    "type": "integer",
                                    "minimum": 2,
                                    "maximum": 60
                                  },
                                  "interval": {
                                    "type": "string",
                                    "enum": [
                                      "week",
                                      "month",
                                      "year"
                                    ]
                                  },
                                  "intervalCount": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 12
                                  }
                                },
                                "required": [
                                  "count",
                                  "interval"
                                ],
                                "additionalProperties": false
                              },
                              "retired": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "currency",
                              "mode"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "stock": {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "enum": [
                                "none",
                                "single",
                                "counted"
                              ]
                            },
                            "available": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 1000000
                            },
                            "perBuyerLimit": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1000000
                            }
                          },
                          "required": [
                            "mode"
                          ],
                          "additionalProperties": false
                        },
                        "benefitIds": {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "data": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "type": [
                              "string",
                              "number",
                              "boolean",
                              "null",
                              "array",
                              "object"
                            ],
                            "maxLength": 20000,
                            "maxItems": 100
                          }
                        },
                        "terms": {
                          "type": "string",
                          "maxLength": 5000
                        },
                        "salesWindow": {
                          "type": "object",
                          "properties": {
                            "startsAt": {
                              "type": "string",
                              "maxLength": 40
                            },
                            "endsAt": {
                              "type": "string",
                              "maxLength": 40
                            }
                          },
                          "additionalProperties": false
                        },
                        "quantity": {
                          "type": "object",
                          "properties": {
                            "min": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1000000
                            },
                            "max": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1000000
                            }
                          },
                          "additionalProperties": false
                        },
                        "grantsPerUnit": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100
                        },
                        "releasesAt": {
                          "type": "string",
                          "maxLength": 40
                        },
                        "bookingSlots": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "weightGrams": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000000
                        },
                        "dimsMm": {
                          "type": "object",
                          "properties": {
                            "length": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 5000
                            },
                            "width": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 5000
                            },
                            "height": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 5000
                            }
                          },
                          "required": [
                            "length",
                            "width",
                            "height"
                          ],
                          "additionalProperties": false
                        },
                        "customs": {
                          "type": "object",
                          "properties": {
                            "hsCode": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 20
                            },
                            "originCountry": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 2
                            },
                            "description": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 50
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "id",
                        "prices",
                        "stock"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "data": {
                    "type": "object",
                    "maxProperties": 100,
                    "additionalProperties": {
                      "type": [
                        "string",
                        "number",
                        "boolean",
                        "null",
                        "array",
                        "object"
                      ],
                      "maxLength": 20000,
                      "maxItems": 100
                    }
                  },
                  "benefits": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "file",
                            "link",
                            "message",
                            "license_key",
                            "access",
                            "manual",
                            "webhook_only",
                            "transfer",
                            "item"
                          ]
                        },
                        "title": {
                          "type": "string",
                          "maxLength": 120
                        },
                        "afterDays": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 3650
                        },
                        "availableAt": {
                          "type": "string",
                          "maxLength": 40
                        },
                        "uses": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        },
                        "seriesId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "updatePolicy": {
                          "type": "string",
                          "enum": [
                            "latest",
                            "purchased",
                            "until"
                          ]
                        },
                        "updateMonths": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 120
                        },
                        "downloadLimit": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        },
                        "url": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "durationDays": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 36500
                        },
                        "text": {
                          "type": "string",
                          "maxLength": 5000
                        },
                        "activationLimit": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        },
                        "expiresInDays": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 36500
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "generated",
                            "seller_list"
                          ]
                        },
                        "resourceType": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "resourceId": {
                          "type": "string",
                          "maxLength": 128
                        },
                        "instructions": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "itemId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "variantId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100
                        }
                      },
                      "required": [
                        "id",
                        "kind"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "resourceRef": {
                    "type": "string",
                    "maxLength": 128
                  },
                  "refundPolicy": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "addOns": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "label": {
                          "type": "string",
                          "maxLength": 60
                        },
                        "prices": {
                          "type": "array",
                          "maxItems": 40,
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[a-z]{3}$"
                              },
                              "mode": {
                                "type": "string",
                                "enum": [
                                  "fixed",
                                  "free",
                                  "pwyw"
                                ]
                              },
                              "amount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "compareAtAmount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "minimum": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "suggested": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "maximum": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "recurring": {
                                "type": "object",
                                "properties": {
                                  "interval": {
                                    "type": "string",
                                    "enum": [
                                      "day",
                                      "week",
                                      "month",
                                      "year"
                                    ]
                                  },
                                  "intervalCount": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 365
                                  },
                                  "trialDays": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 730
                                  },
                                  "endAfterPayments": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 1000
                                  },
                                  "intro": {
                                    "type": "object",
                                    "properties": {
                                      "amount": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 10000000000
                                      },
                                      "periods": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 100
                                      }
                                    },
                                    "required": [
                                      "amount",
                                      "periods"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "interval"
                                ],
                                "additionalProperties": false
                              },
                              "deposit": {
                                "type": "object",
                                "properties": {
                                  "percentBps": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 10000
                                  }
                                },
                                "required": [
                                  "percentBps"
                                ],
                                "additionalProperties": false
                              },
                              "milestones": {
                                "type": "array",
                                "maxItems": 6,
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "label": {
                                      "type": "string",
                                      "maxLength": 60
                                    },
                                    "percentBps": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 10000
                                    }
                                  },
                                  "required": [
                                    "label",
                                    "percentBps"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "installments": {
                                "type": "object",
                                "properties": {
                                  "count": {
                                    "type": "integer",
                                    "minimum": 2,
                                    "maximum": 60
                                  },
                                  "interval": {
                                    "type": "string",
                                    "enum": [
                                      "week",
                                      "month",
                                      "year"
                                    ]
                                  },
                                  "intervalCount": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 12
                                  }
                                },
                                "required": [
                                  "count",
                                  "interval"
                                ],
                                "additionalProperties": false
                              },
                              "retired": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "currency",
                              "mode"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "maxQuantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000
                        },
                        "benefitIds": {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "type": "string",
                            "maxLength": 64
                          }
                        }
                      },
                      "required": [
                        "id",
                        "label",
                        "prices"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "payees": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "properties": {
                        "sellerId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "shareBps": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 10000
                        }
                      },
                      "required": [
                        "sellerId",
                        "shareBps"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "eligibility": {
                    "type": "object",
                    "properties": {
                      "requiresItemId": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "minRank": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "buyerIds": {
                        "type": "array",
                        "maxItems": 100,
                        "items": {
                          "type": "string",
                          "maxLength": 254
                        }
                      }
                    },
                    "additionalProperties": false
                  },
                  "capacity": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "questions": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "object",
                      "properties": {
                        "slug": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "title": {
                          "type": "string",
                          "maxLength": 120
                        },
                        "helpText": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "type": {
                          "type": "string",
                          "maxLength": 20
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "defaultValue": {
                          "type": [
                            "string",
                            "number",
                            "boolean",
                            "null"
                          ],
                          "maxLength": 1000
                        },
                        "options": {
                          "type": "array",
                          "maxItems": 200,
                          "items": {
                            "type": "object",
                            "properties": {
                              "value": {
                                "type": "string",
                                "maxLength": 120
                              },
                              "label": {
                                "type": "string",
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "value",
                              "label"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "min": {
                          "type": "number"
                        },
                        "max": {
                          "type": "number"
                        },
                        "pattern": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[a-z]{3}$"
                        },
                        "visibility": {
                          "type": "string",
                          "enum": [
                            "public",
                            "after_purchase",
                            "seller_only",
                            "app_only"
                          ]
                        },
                        "filterable": {
                          "type": "boolean"
                        },
                        "sortable": {
                          "type": "boolean"
                        },
                        "uniquePerOwner": {
                          "type": "boolean"
                        },
                        "maxMb": {
                          "type": "number",
                          "minimum": 0.1,
                          "maximum": 100
                        },
                        "maxFiles": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10
                        },
                        "per": {
                          "type": "string",
                          "enum": [
                            "order",
                            "unit"
                          ]
                        },
                        "variantIds": {
                          "type": "array",
                          "maxItems": 250,
                          "items": {
                            "type": "string",
                            "maxLength": 64
                          }
                        }
                      },
                      "required": [
                        "slug",
                        "title",
                        "type"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "shipping": {
                    "type": "object",
                    "properties": {
                      "countries": {
                        "type": "array",
                        "maxItems": 250,
                        "items": {
                          "type": "string",
                          "maxLength": 2
                        }
                      },
                      "regions": {
                        "type": "array",
                        "maxItems": 500,
                        "items": {
                          "type": "string",
                          "maxLength": 10
                        }
                      },
                      "flatRate": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000000000
                      },
                      "additionalRate": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000000000
                      },
                      "packagingGrams": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000000
                      },
                      "pickup": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "countries"
                    ],
                    "additionalProperties": false
                  },
                  "taxCode": {
                    "type": "string",
                    "maxLength": 20
                  },
                  "buyerCountries": {
                    "type": "array",
                    "maxItems": 250,
                    "items": {
                      "type": "string",
                      "maxLength": 2
                    }
                  },
                  "customs": {
                    "type": "object",
                    "properties": {
                      "hsCode": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 20
                      },
                      "originCountry": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 2
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 50
                      }
                    },
                    "additionalProperties": false
                  },
                  "options": {
                    "type": "array",
                    "maxItems": 3,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 16
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 40
                        },
                        "values": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 16
                              },
                              "label": {
                                "type": "string",
                                "maxLength": 40
                              },
                              "retired": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "label"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "values"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "booking": {
                    "type": "object",
                    "properties": {
                      "calendarId": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{24}$"
                      },
                      "timeZone": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "slotMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 720
                      },
                      "bufferMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 240
                      },
                      "bufferBeforeMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 240
                      },
                      "seatsPerSlot": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "weekly": {
                        "type": "object",
                        "properties": {
                          "mon": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "tue": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "wed": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "thu": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "fri": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "sat": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "sun": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "additionalProperties": false
                      },
                      "exceptions": {
                        "type": "array",
                        "maxItems": 200,
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "maxLength": 10
                            },
                            "windows": {
                              "type": "array",
                              "maxItems": 6,
                              "items": {
                                "type": "object",
                                "properties": {
                                  "from": {
                                    "type": "string",
                                    "maxLength": 5
                                  },
                                  "to": {
                                    "type": "string",
                                    "maxLength": 5
                                  }
                                },
                                "required": [
                                  "from",
                                  "to"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "date",
                            "windows"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "minNoticeMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 43200
                      },
                      "maxDaysAhead": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 365
                      },
                      "buyerCancel": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "minutesBefore": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 43200
                          },
                          "refund": {
                            "type": "string",
                            "enum": [
                              "full",
                              "none"
                            ]
                          }
                        },
                        "required": [
                          "minutesBefore",
                          "refund"
                        ],
                        "additionalProperties": false
                      },
                      "buyerReschedule": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "minutesBefore": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 43200
                          },
                          "maxTimes": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 10
                          }
                        },
                        "required": [
                          "minutesBefore",
                          "maxTimes"
                        ],
                        "additionalProperties": false
                      },
                      "seatsPerUnit": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100
                      },
                      "seatsCap": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "bookingLimits": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "perDay": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "maximum": 1000
                          },
                          "perWeek": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "maximum": 1000
                          }
                        },
                        "additionalProperties": false
                      },
                      "reminders": {
                        "type": "array",
                        "maxItems": 3,
                        "items": {
                          "type": "object",
                          "properties": {
                            "minutesBefore": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 10080
                            }
                          },
                          "required": [
                            "minutesBefore"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "typeKey",
                  "title",
                  "slug",
                  "variants"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/items.ts",
        "x-events": [
          "item.created"
        ]
      }
    },
    "/api/v1/public/me/items/{id}": {
      "get": {
        "operationId": "me.items.get",
        "summary": "Get one item the signed-in user sells",
        "description": "Another seller's item is not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/items.ts"
      },
      "put": {
        "operationId": "me.items.update",
        "summary": "Save the whole content of an item the signed-in user sells",
        "description": "Replaces the item's content under the item type's live version; a live item stays live unless the type re-reviews edits, and must still meet what going live needs. Refused with 409 when the slug is taken or the item changed meanwhile, and 422 when the content does not meet the type.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "slug": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "summary": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 20000
                  },
                  "media": {
                    "type": "array",
                    "maxItems": 8,
                    "items": {
                      "type": "string",
                      "maxLength": 64
                    }
                  },
                  "ctaText": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "variants": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 250,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "label": {
                          "type": "string",
                          "maxLength": 126
                        },
                        "optionValues": {
                          "type": "object",
                          "maxProperties": 3,
                          "propertyNames": {
                            "maxLength": 16
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 16
                          }
                        },
                        "rank": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 1000
                        },
                        "prices": {
                          "type": "array",
                          "maxItems": 40,
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[a-z]{3}$"
                              },
                              "mode": {
                                "type": "string",
                                "enum": [
                                  "fixed",
                                  "free",
                                  "pwyw"
                                ]
                              },
                              "amount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "compareAtAmount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "minimum": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "suggested": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "maximum": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "recurring": {
                                "type": "object",
                                "properties": {
                                  "interval": {
                                    "type": "string",
                                    "enum": [
                                      "day",
                                      "week",
                                      "month",
                                      "year"
                                    ]
                                  },
                                  "intervalCount": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 365
                                  },
                                  "trialDays": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 730
                                  },
                                  "endAfterPayments": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 1000
                                  },
                                  "intro": {
                                    "type": "object",
                                    "properties": {
                                      "amount": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 10000000000
                                      },
                                      "periods": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 100
                                      }
                                    },
                                    "required": [
                                      "amount",
                                      "periods"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "interval"
                                ],
                                "additionalProperties": false
                              },
                              "deposit": {
                                "type": "object",
                                "properties": {
                                  "percentBps": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 10000
                                  }
                                },
                                "required": [
                                  "percentBps"
                                ],
                                "additionalProperties": false
                              },
                              "milestones": {
                                "type": "array",
                                "maxItems": 6,
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "label": {
                                      "type": "string",
                                      "maxLength": 60
                                    },
                                    "percentBps": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 10000
                                    }
                                  },
                                  "required": [
                                    "label",
                                    "percentBps"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "installments": {
                                "type": "object",
                                "properties": {
                                  "count": {
                                    "type": "integer",
                                    "minimum": 2,
                                    "maximum": 60
                                  },
                                  "interval": {
                                    "type": "string",
                                    "enum": [
                                      "week",
                                      "month",
                                      "year"
                                    ]
                                  },
                                  "intervalCount": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 12
                                  }
                                },
                                "required": [
                                  "count",
                                  "interval"
                                ],
                                "additionalProperties": false
                              },
                              "retired": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "currency",
                              "mode"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "stock": {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "enum": [
                                "none",
                                "single",
                                "counted"
                              ]
                            },
                            "available": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 1000000
                            },
                            "perBuyerLimit": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1000000
                            }
                          },
                          "required": [
                            "mode"
                          ],
                          "additionalProperties": false
                        },
                        "benefitIds": {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "data": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "type": [
                              "string",
                              "number",
                              "boolean",
                              "null",
                              "array",
                              "object"
                            ],
                            "maxLength": 20000,
                            "maxItems": 100
                          }
                        },
                        "terms": {
                          "type": "string",
                          "maxLength": 5000
                        },
                        "salesWindow": {
                          "type": "object",
                          "properties": {
                            "startsAt": {
                              "type": "string",
                              "maxLength": 40
                            },
                            "endsAt": {
                              "type": "string",
                              "maxLength": 40
                            }
                          },
                          "additionalProperties": false
                        },
                        "quantity": {
                          "type": "object",
                          "properties": {
                            "min": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1000000
                            },
                            "max": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1000000
                            }
                          },
                          "additionalProperties": false
                        },
                        "grantsPerUnit": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100
                        },
                        "releasesAt": {
                          "type": "string",
                          "maxLength": 40
                        },
                        "bookingSlots": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "weightGrams": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000000
                        },
                        "dimsMm": {
                          "type": "object",
                          "properties": {
                            "length": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 5000
                            },
                            "width": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 5000
                            },
                            "height": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 5000
                            }
                          },
                          "required": [
                            "length",
                            "width",
                            "height"
                          ],
                          "additionalProperties": false
                        },
                        "customs": {
                          "type": "object",
                          "properties": {
                            "hsCode": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 20
                            },
                            "originCountry": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 2
                            },
                            "description": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 50
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "id",
                        "prices",
                        "stock"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "data": {
                    "type": "object",
                    "maxProperties": 100,
                    "additionalProperties": {
                      "type": [
                        "string",
                        "number",
                        "boolean",
                        "null",
                        "array",
                        "object"
                      ],
                      "maxLength": 20000,
                      "maxItems": 100
                    }
                  },
                  "benefits": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "file",
                            "link",
                            "message",
                            "license_key",
                            "access",
                            "manual",
                            "webhook_only",
                            "transfer",
                            "item"
                          ]
                        },
                        "title": {
                          "type": "string",
                          "maxLength": 120
                        },
                        "afterDays": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 3650
                        },
                        "availableAt": {
                          "type": "string",
                          "maxLength": 40
                        },
                        "uses": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        },
                        "seriesId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "updatePolicy": {
                          "type": "string",
                          "enum": [
                            "latest",
                            "purchased",
                            "until"
                          ]
                        },
                        "updateMonths": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 120
                        },
                        "downloadLimit": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        },
                        "url": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "durationDays": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 36500
                        },
                        "text": {
                          "type": "string",
                          "maxLength": 5000
                        },
                        "activationLimit": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        },
                        "expiresInDays": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 36500
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "generated",
                            "seller_list"
                          ]
                        },
                        "resourceType": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "resourceId": {
                          "type": "string",
                          "maxLength": 128
                        },
                        "instructions": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "itemId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "variantId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100
                        }
                      },
                      "required": [
                        "id",
                        "kind"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "resourceRef": {
                    "type": "string",
                    "maxLength": 128
                  },
                  "refundPolicy": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "addOns": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "label": {
                          "type": "string",
                          "maxLength": 60
                        },
                        "prices": {
                          "type": "array",
                          "maxItems": 40,
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[a-z]{3}$"
                              },
                              "mode": {
                                "type": "string",
                                "enum": [
                                  "fixed",
                                  "free",
                                  "pwyw"
                                ]
                              },
                              "amount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "compareAtAmount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "minimum": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "suggested": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "maximum": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "recurring": {
                                "type": "object",
                                "properties": {
                                  "interval": {
                                    "type": "string",
                                    "enum": [
                                      "day",
                                      "week",
                                      "month",
                                      "year"
                                    ]
                                  },
                                  "intervalCount": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 365
                                  },
                                  "trialDays": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 730
                                  },
                                  "endAfterPayments": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 1000
                                  },
                                  "intro": {
                                    "type": "object",
                                    "properties": {
                                      "amount": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 10000000000
                                      },
                                      "periods": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 100
                                      }
                                    },
                                    "required": [
                                      "amount",
                                      "periods"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "interval"
                                ],
                                "additionalProperties": false
                              },
                              "deposit": {
                                "type": "object",
                                "properties": {
                                  "percentBps": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 10000
                                  }
                                },
                                "required": [
                                  "percentBps"
                                ],
                                "additionalProperties": false
                              },
                              "milestones": {
                                "type": "array",
                                "maxItems": 6,
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "label": {
                                      "type": "string",
                                      "maxLength": 60
                                    },
                                    "percentBps": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 10000
                                    }
                                  },
                                  "required": [
                                    "label",
                                    "percentBps"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "installments": {
                                "type": "object",
                                "properties": {
                                  "count": {
                                    "type": "integer",
                                    "minimum": 2,
                                    "maximum": 60
                                  },
                                  "interval": {
                                    "type": "string",
                                    "enum": [
                                      "week",
                                      "month",
                                      "year"
                                    ]
                                  },
                                  "intervalCount": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 12
                                  }
                                },
                                "required": [
                                  "count",
                                  "interval"
                                ],
                                "additionalProperties": false
                              },
                              "retired": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "currency",
                              "mode"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "maxQuantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000
                        },
                        "benefitIds": {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "type": "string",
                            "maxLength": 64
                          }
                        }
                      },
                      "required": [
                        "id",
                        "label",
                        "prices"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "payees": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "properties": {
                        "sellerId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "shareBps": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 10000
                        }
                      },
                      "required": [
                        "sellerId",
                        "shareBps"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "eligibility": {
                    "type": "object",
                    "properties": {
                      "requiresItemId": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "minRank": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "buyerIds": {
                        "type": "array",
                        "maxItems": 100,
                        "items": {
                          "type": "string",
                          "maxLength": 254
                        }
                      }
                    },
                    "additionalProperties": false
                  },
                  "capacity": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "questions": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "object",
                      "properties": {
                        "slug": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "title": {
                          "type": "string",
                          "maxLength": 120
                        },
                        "helpText": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "type": {
                          "type": "string",
                          "maxLength": 20
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "defaultValue": {
                          "type": [
                            "string",
                            "number",
                            "boolean",
                            "null"
                          ],
                          "maxLength": 1000
                        },
                        "options": {
                          "type": "array",
                          "maxItems": 200,
                          "items": {
                            "type": "object",
                            "properties": {
                              "value": {
                                "type": "string",
                                "maxLength": 120
                              },
                              "label": {
                                "type": "string",
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "value",
                              "label"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "min": {
                          "type": "number"
                        },
                        "max": {
                          "type": "number"
                        },
                        "pattern": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[a-z]{3}$"
                        },
                        "visibility": {
                          "type": "string",
                          "enum": [
                            "public",
                            "after_purchase",
                            "seller_only",
                            "app_only"
                          ]
                        },
                        "filterable": {
                          "type": "boolean"
                        },
                        "sortable": {
                          "type": "boolean"
                        },
                        "uniquePerOwner": {
                          "type": "boolean"
                        },
                        "maxMb": {
                          "type": "number",
                          "minimum": 0.1,
                          "maximum": 100
                        },
                        "maxFiles": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10
                        },
                        "per": {
                          "type": "string",
                          "enum": [
                            "order",
                            "unit"
                          ]
                        },
                        "variantIds": {
                          "type": "array",
                          "maxItems": 250,
                          "items": {
                            "type": "string",
                            "maxLength": 64
                          }
                        }
                      },
                      "required": [
                        "slug",
                        "title",
                        "type"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "shipping": {
                    "type": "object",
                    "properties": {
                      "countries": {
                        "type": "array",
                        "maxItems": 250,
                        "items": {
                          "type": "string",
                          "maxLength": 2
                        }
                      },
                      "regions": {
                        "type": "array",
                        "maxItems": 500,
                        "items": {
                          "type": "string",
                          "maxLength": 10
                        }
                      },
                      "flatRate": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000000000
                      },
                      "additionalRate": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000000000
                      },
                      "packagingGrams": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000000
                      },
                      "pickup": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "countries"
                    ],
                    "additionalProperties": false
                  },
                  "taxCode": {
                    "type": "string",
                    "maxLength": 20
                  },
                  "buyerCountries": {
                    "type": "array",
                    "maxItems": 250,
                    "items": {
                      "type": "string",
                      "maxLength": 2
                    }
                  },
                  "customs": {
                    "type": "object",
                    "properties": {
                      "hsCode": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 20
                      },
                      "originCountry": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 2
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 50
                      }
                    },
                    "additionalProperties": false
                  },
                  "options": {
                    "type": "array",
                    "maxItems": 3,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 16
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 40
                        },
                        "values": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 16
                              },
                              "label": {
                                "type": "string",
                                "maxLength": 40
                              },
                              "retired": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "label"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "values"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "booking": {
                    "type": "object",
                    "properties": {
                      "calendarId": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{24}$"
                      },
                      "timeZone": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "slotMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 720
                      },
                      "bufferMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 240
                      },
                      "bufferBeforeMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 240
                      },
                      "seatsPerSlot": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "weekly": {
                        "type": "object",
                        "properties": {
                          "mon": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "tue": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "wed": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "thu": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "fri": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "sat": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "sun": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "additionalProperties": false
                      },
                      "exceptions": {
                        "type": "array",
                        "maxItems": 200,
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "maxLength": 10
                            },
                            "windows": {
                              "type": "array",
                              "maxItems": 6,
                              "items": {
                                "type": "object",
                                "properties": {
                                  "from": {
                                    "type": "string",
                                    "maxLength": 5
                                  },
                                  "to": {
                                    "type": "string",
                                    "maxLength": 5
                                  }
                                },
                                "required": [
                                  "from",
                                  "to"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "date",
                            "windows"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "minNoticeMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 43200
                      },
                      "maxDaysAhead": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 365
                      },
                      "buyerCancel": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "minutesBefore": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 43200
                          },
                          "refund": {
                            "type": "string",
                            "enum": [
                              "full",
                              "none"
                            ]
                          }
                        },
                        "required": [
                          "minutesBefore",
                          "refund"
                        ],
                        "additionalProperties": false
                      },
                      "buyerReschedule": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "minutesBefore": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 43200
                          },
                          "maxTimes": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 10
                          }
                        },
                        "required": [
                          "minutesBefore",
                          "maxTimes"
                        ],
                        "additionalProperties": false
                      },
                      "seatsPerUnit": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100
                      },
                      "seatsCap": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "bookingLimits": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "perDay": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "maximum": 1000
                          },
                          "perWeek": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "maximum": 1000
                          }
                        },
                        "additionalProperties": false
                      },
                      "reminders": {
                        "type": "array",
                        "maxItems": 3,
                        "items": {
                          "type": "object",
                          "properties": {
                            "minutesBefore": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 10080
                            }
                          },
                          "required": [
                            "minutesBefore"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "title",
                  "slug",
                  "variants"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/items.ts",
        "x-events": [
          "item.updated"
        ]
      },
      "delete": {
        "operationId": "me.items.delete",
        "summary": "Delete a never-listed item the signed-in user sells",
        "description": "Deletes an item that never went live and never sold, freeing its slug, and answers 204. An item that has been listed or sold is refused with 409 `ITEM_STATE_CONFLICT`; archive it instead.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/items.ts"
      }
    },
    "/api/v1/public/me/items/{id}/archive": {
      "post": {
        "operationId": "me.items.archive.create",
        "summary": "Archive an item the signed-in user sells",
        "description": "Sets the item's status to archived, taking it off sale; live bundles that include it are flagged. Refused with 409 `ITEM_STATE_CONFLICT` when the item's status cannot be archived or it changed meanwhile.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/items.ts",
        "x-events": [
          "item.archived"
        ]
      }
    },
    "/api/v1/public/me/items/{id}/booking/calendar-move": {
      "post": {
        "operationId": "me.items.booking.calendarMove.create",
        "summary": "Move an item's bookings onto another of the signed-in user's calendars",
        "description": "Moves the item's upcoming bookings onto `calendarId` and books the item on it; a move to the same calendar already running is resumed. Refused with 409 `CALENDAR_MOVE_CONFLICTS`, naming each booking, when the preview would not run, and 409 `BOOKING_CALENDAR_MOVING` while a move to another calendar runs.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "calendarId": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  }
                },
                "required": [
                  "calendarId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/items.ts",
        "x-events": [
          "booking.updated"
        ]
      }
    },
    "/api/v1/public/me/items/{id}/booking/calendar-move/preview": {
      "post": {
        "operationId": "me.items.booking.calendarMove.preview.create",
        "summary": "Preview moving an item's bookings onto another of the user's calendars",
        "description": "Answers, booking by booking, what moving the item's upcoming bookings onto `calendarId` would do. Reads only. Refused with 422 `CALENDAR_REFUSED` when the item is already on that calendar.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "calendarId": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  }
                },
                "required": [
                  "calendarId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/items.ts"
      }
    },
    "/api/v1/public/me/items/{id}/publish": {
      "post": {
        "operationId": "me.items.publish.create",
        "summary": "Publish an item the signed-in user sells",
        "description": "Puts the item on sale, or sends it to the app owner's review when its type reviews items. Refused with 402 `ITEM_LISTING_LIMIT` past the plan's listing limit, 409 `ITEM_STATE_CONFLICT` when its status cannot be published, 422 when the item or its type cannot sell, and 503 while the app has selling off.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/items.ts",
        "x-events": [
          "item.published",
          "item.updated"
        ]
      }
    },
    "/api/v1/public/me/items/{id}/unlist": {
      "post": {
        "operationId": "me.items.unlist.create",
        "summary": "Unlist an item the signed-in user sells",
        "description": "Sets a published item's status to unlisted; live bundles that include it are flagged. Refused with 409 `ITEM_STATE_CONFLICT` when its status cannot be unlisted.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/items.ts",
        "x-events": [
          "item.updated"
        ]
      }
    },
    "/api/v1/public/me/limits/{slug}": {
      "get": {
        "operationId": "me.limits.get",
        "summary": "Get one of the signed-in user's limits and how much is claimed",
        "description": "`limit` is null with `unlimited` true when there is no ceiling, and absent when the user's plan does not name the slug. `claimed` and `remaining` count the user's active claims, in `partitionKey` when given. The owned-workspaces limit also answers `capabilities`.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/index.ts"
      }
    },
    "/api/v1/public/me/limits/{slug}/claim": {
      "post": {
        "operationId": "me.limits.claim.create",
        "summary": "Claim a resource against one of the signed-in user's limits",
        "description": "Answers 201 with the new claim, or 200 when the resource was already claimed. Answers 402 at the plan's ceiling, 429 `CLAIM_CAP_REACHED` past the per-limit claim cap, 409 when another module claims this limit itself, and 404 when no limit with that slug is declared.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "resourceId": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  },
                  "partitionKey": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  },
                  "metadata": {
                    "type": "object",
                    "maxProperties": 20
                  }
                },
                "required": [
                  "resourceId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "entitlement-claims",
            "windowMs": 60000,
            "max": 120,
            "per": "claimLimiterKey"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/index.ts"
      }
    },
    "/api/v1/public/me/limits/{slug}/claims": {
      "get": {
        "operationId": "me.limits.claims.list",
        "summary": "List the signed-in user's claims on one limit",
        "description": "Active claims by default; `status` takes `active`, `released` or `all`, with `partitionKey`, `$page` and `$limit` to narrow and page.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/index.ts"
      }
    },
    "/api/v1/public/me/limits/{slug}/release": {
      "post": {
        "operationId": "me.limits.release.create",
        "summary": "Release a claimed resource from one of the signed-in user's limits",
        "description": "Answers the released claim and the count still claimed. Answers 409 `RELEASE_BUDGET_EXHAUSTED` when the limit's releases for the period are used up, 409 when another module claims this limit itself, and 404 when no active claim holds the resource.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "resourceId": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  },
                  "partitionKey": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  }
                },
                "required": [
                  "resourceId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "entitlement-claims",
            "windowMs": 60000,
            "max": 120,
            "per": "claimLimiterKey"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/index.ts"
      }
    },
    "/api/v1/public/me/orders": {
      "get": {
        "operationId": "me.orders.list",
        "summary": "List the signed-in user's orders as a buyer",
        "description": "Lists the person's own orders a page at a time, without the fee split. Orders bought as a guest under the person's verified email are attached to the account first.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/orders.ts"
      }
    },
    "/api/v1/public/me/orders/{id}": {
      "get": {
        "operationId": "me.orders.get",
        "summary": "Get one of the signed-in user's orders as a buyer",
        "description": "Answers the order with its payments, as the page Stripe returns the buyer to reads it. Another person's order is not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/orders.ts"
      }
    },
    "/api/v1/public/me/orders/{id}/parts/{index}/pay": {
      "post": {
        "operationId": "me.orders.parts.pay.create",
        "summary": "Pay one part of the signed-in user's order sold in parts",
        "description": "Charges part `index` on the card saved with the order, for example to approve a milestone, and answers `{ order, url }`. A part whose card was refused answers Stripe's page to pay it on in `url`. Refused with 409 `PART_REFUSED` when the part cannot be paid now, 422 when no card was saved, and 502 when the payment could not be taken. Accepts an `Idempotency-Key`.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "index",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 35
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/orders.ts",
        "x-events": [
          "order.part_paid",
          "order.part_failed",
          "order.paid"
        ]
      }
    },
    "/api/v1/public/me/orders/{id}/returns": {
      "get": {
        "operationId": "me.orders.returns.list",
        "summary": "List the returns of one of the signed-in user's orders",
        "description": "Another person's order is not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/orders.ts"
      },
      "post": {
        "operationId": "me.orders.returns.create",
        "summary": "Ask to return units of one of the signed-in user's orders",
        "description": "Requests a return of the named delivered units, or every unit free to return when none are named, and answers 201 with the return and the order. Refused with 409 `RETURN_REFUSED` when the order is not paid, the seller's return window is closed, or a line is already in a return, and 422 for units that cannot be returned.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lines": {
                    "type": "array",
                    "maxItems": 100,
                    "items": {
                      "type": "object",
                      "properties": {
                        "lineKey": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000
                        }
                      },
                      "required": [
                        "lineKey",
                        "quantity"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/orders.ts",
        "x-events": [
          "return.requested"
        ]
      }
    },
    "/api/v1/public/me/quotas/{slug}": {
      "get": {
        "operationId": "me.quotas.get",
        "summary": "Get one of the signed-in user's quotas and its usage this period",
        "description": "Reads the user's own counter; with `partitionKey`, also what that partition has used.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/index.ts"
      },
      "patch": {
        "operationId": "me.quotas.update",
        "summary": "Set the signed-in user's spend cap and alert thresholds on a quota",
        "description": "`maxOverageUnits` caps overage past the allowance (null removes it) and `notifyAtPercent` sets the alert thresholds; fields left out keep their value. Moves no money, so no email verification is required. Answers the cap as it now stands.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "maxOverageUnits": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notifyAtPercent": {
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 100
                    },
                    "uniqueItems": true,
                    "maxItems": 5
                  }
                },
                "minProperties": 1,
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/index.ts"
      }
    },
    "/api/v1/public/me/releases": {
      "get": {
        "operationId": "me.releases.list",
        "summary": "List the signed-in seller's releases",
        "description": "Filter by `seriesId` or `status`. Answers 404 `SELLER_NOT_FOUND` when the user has not started selling.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "seriesId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "published"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/releases.ts"
      },
      "post": {
        "operationId": "me.releases.create",
        "summary": "Create a draft release in a series as the signed-in seller",
        "description": "The files named in `fileIds` must be the seller's own and not fail the malware scan (422 `RELEASE_REFUSED`). Answers 409 `RELEASE_VERSION_TAKEN` when the series already has that version.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "seriesId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "version": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "fileIds": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  }
                },
                "required": [
                  "seriesId",
                  "version"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/releases.ts"
      }
    },
    "/api/v1/public/me/releases/{id}": {
      "get": {
        "operationId": "me.releases.get",
        "summary": "Get one of the signed-in seller's releases with its files",
        "description": "Another seller's release answers 404.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/releases.ts"
      },
      "delete": {
        "operationId": "me.releases.delete",
        "summary": "Delete one of the signed-in seller's draft releases",
        "description": "A published release cannot be deleted, since buyers may hold it (422 `RELEASE_REFUSED`).",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/releases.ts"
      },
      "patch": {
        "operationId": "me.releases.update",
        "summary": "Update one of the signed-in seller's releases",
        "description": "A draft takes a new version, notes and files; a published release takes notes only (422 `RELEASE_REFUSED` otherwise). Answers 409 `RELEASE_VERSION_TAKEN` for a version the series already has, and 409 when the release changed meanwhile.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "fileIds": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/releases.ts"
      }
    },
    "/api/v1/public/me/releases/{id}/publish": {
      "post": {
        "operationId": "me.releases.publish.create",
        "summary": "Publish one of the signed-in seller's draft releases",
        "description": "Every file must have passed the malware scan where the scan is required. Answers 422 `RELEASE_REFUSED` when a file blocks publishing or the release is already published.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/releases.ts"
      }
    },
    "/api/v1/public/me/sales": {
      "get": {
        "operationId": "me.sales.list",
        "summary": "List the orders of items the signed-in user sells, a page at a time",
        "description": "Returns the user's own sales as a seller, filtered by `paymentStatus`, including split sales they are paid a share of, where each shows only their own share. Answers 503 when selling is turned off in this app.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "paymentStatus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "unpaid",
                "partially_paid",
                "paid",
                "partially_refunded",
                "refunded"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/sales.ts"
      }
    },
    "/api/v1/public/me/sales/bookings": {
      "get": {
        "operationId": "me.sales.bookings.list",
        "summary": "List the bookings made on items the signed-in user sells",
        "description": "Filters by status, item, shared calendar and a `from`/`to` range, sorted by start (`start` soonest first by default, `-start` latest first). A `from` or `to` that is not a date and time is refused with 400 naming the field.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "calendarId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40
            }
          },
          {
            "name": "itemId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "start",
                "-start"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "held",
                "confirmed",
                "cancelled",
                "expired"
              ]
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/sales.ts"
      }
    },
    "/api/v1/public/me/sales/bookings/{id}": {
      "get": {
        "operationId": "me.sales.bookings.get",
        "summary": "Get one booking made on an item the signed-in user sells",
        "description": "A booking on another seller's item answers 404.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/sales.ts"
      }
    },
    "/api/v1/public/me/sales/bookings/{id}/attendance": {
      "put": {
        "operationId": "me.sales.bookings.attendance.update",
        "summary": "Mark whether the buyer came to a booking on the user's item",
        "description": "Sets `attendance` on a confirmed booking, or clears it with null. Answers 422 when attendance cannot be marked yet for this booking and 409 when the booking changed meanwhile. Emits `booking.updated` only when the value changed.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "attendance": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "attended",
                      "no_show",
                      null
                    ]
                  }
                },
                "required": [
                  "attendance"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/sales.ts",
        "x-events": [
          "booking.updated"
        ]
      }
    },
    "/api/v1/public/me/sales/bookings/{id}/cancel": {
      "post": {
        "operationId": "me.sales.bookings.cancel.create",
        "summary": "Cancel a booking on an item the signed-in user sells",
        "description": "Cancels the confirmed booking, gives its seats back and refunds what is left on its order line in full. In the marketplace shape the app owner cancels, and the seller is refused with 422 (`cancel_needs_app_owner`); 409 when the booking changed meanwhile. If Stripe refuses the refund, the booking stays cancelled and the answer says the refund failed.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/sales.ts",
        "x-events": [
          "booking.cancelled"
        ]
      }
    },
    "/api/v1/public/me/sales/bookings/{id}/reschedule": {
      "post": {
        "operationId": "me.sales.bookings.reschedule.create",
        "summary": "Move a booking on the user's item to another slot",
        "description": "Moves the booking to `slotStart`, keeping its length in slots. Answers 422 when the move is not allowed or the item no longer takes bookings, and 409 when the slot was just taken, has reached its limit, or the item's bookings are being moved to another calendar.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slotStart": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  }
                },
                "required": [
                  "slotStart"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/sales.ts",
        "x-events": [
          "booking.rescheduled"
        ]
      }
    },
    "/api/v1/public/me/sales/export": {
      "get": {
        "operationId": "me.sales.export.list",
        "summary": "Download the signed-in user's paid sales as a CSV file",
        "description": "Exports orders paid between `from` and `to` (a date alone means that whole day), including split sales they are paid a share of. Answers 422 for a malformed date, a start after the end, or a range longer than the export allows. The `X-Export-Rows` header gives the row count and `X-Export-Capped: true` marks a capped file.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}",
              "maxLength": 30
            }
          },
          {
            "name": "paymentStatus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "unpaid",
                "partially_paid",
                "paid",
                "partially_refunded",
                "refunded"
              ]
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}",
              "maxLength": 30
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/sales.ts"
      }
    },
    "/api/v1/public/me/sales/subscriptions": {
      "get": {
        "operationId": "me.sales.subscriptions.list",
        "summary": "List the subscriptions sold by the signed-in user, a page at a time",
        "description": "Filters by status, item and billing group. Each subscription is shown in the seller's view, without the buyer's invoice pages.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "groupId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "itemId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "incomplete",
                "trialing",
                "active",
                "past_due",
                "ended"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/sales.ts"
      }
    },
    "/api/v1/public/me/sales/subscriptions/{id}": {
      "get": {
        "operationId": "me.sales.subscriptions.get",
        "summary": "Get one subscription the signed-in user sold",
        "description": "Returned in the seller's view. A subscription another seller sold answers 404.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/sales.ts"
      }
    },
    "/api/v1/public/me/sales/subscriptions/{id}/cancel": {
      "post": {
        "operationId": "me.sales.subscriptions.cancel.create",
        "summary": "Cancel a subscription the signed-in user sold",
        "description": "Cancels at the period's end (`mode: at_period_end`, the default) or now (`mode: now`). Answers 409 when the subscription cannot be cancelled in its state or changed meanwhile, and 502 when Stripe would not cancel it. Accepts an `Idempotency-Key`.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "at_period_end",
                      "now"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/sales.ts",
        "x-events": [
          "item_subscription.canceled"
        ]
      }
    },
    "/api/v1/public/me/sales/{id}": {
      "get": {
        "operationId": "me.sales.get",
        "summary": "Get one order of an item the signed-in user sells",
        "description": "Readable by the order's seller and by a co-seller paid a share of it, who sees only their own share. Any other order answers 404.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/sales.ts"
      }
    },
    "/api/v1/public/me/sales/{id}/lines/{lineKey}/fulfil": {
      "post": {
        "operationId": "me.sales.lines.fulfil.create",
        "summary": "Mark a line of the user's sale in progress or fulfilled",
        "description": "Sets the line's fulfilment to `in_progress` or `fulfilled` (the default), with an optional note. Only the order's own seller may call it. Answers 409 when the order is not paid or the line cannot move to that status. Emits `order.fulfilled` when the line is marked fulfilled.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "lineKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,16}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "in_progress",
                      "fulfilled"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/sales.ts",
        "x-events": [
          "order.fulfilled"
        ]
      }
    },
    "/api/v1/public/me/sales/{id}/parts/{index}/charge": {
      "post": {
        "operationId": "me.sales.parts.charge.create",
        "summary": "Charge the balance of a deposit order the signed-in user sold",
        "description": "Charges part `index` of an order paid in parts to the buyer's saved card. A seller may charge only a deposit's balance; milestones and instalments are refused with 409, as is a part already paid, charging, stopped or out of order. Answers 422 when no card was saved or tax cannot be worked out, and 502 when the payment could not be taken. Accepts an `Idempotency-Key`.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "index",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 35
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/sales.ts",
        "x-events": [
          "order.part_paid",
          "order.part_failed"
        ]
      }
    },
    "/api/v1/public/me/sales/{id}/refund": {
      "post": {
        "operationId": "me.sales.refund.create",
        "summary": "Refund all or part of an order the signed-in user sold",
        "description": "Refunds by line or by amount, or the whole remainder when neither is sent. Only the order's own seller may call it, and only in the storefront shape; in the marketplace shape the app owner refunds (403). Answers 422 when the refund is not possible and 502 when Stripe did not make it; with an `Idempotency-Key` a retry returns the same refund.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lines": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 50,
                    "items": {
                      "type": "object",
                      "properties": {
                        "lineKey": {
                          "type": "string",
                          "maxLength": 16
                        },
                        "amount": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 99999999
                        }
                      },
                      "required": [
                        "lineKey",
                        "amount"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "amount": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 99999999
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "paymentId": {
                    "type": "string",
                    "maxLength": 24
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/sales.ts",
        "x-events": [
          "order.refunded"
        ]
      }
    },
    "/api/v1/public/me/sales/{id}/returns": {
      "get": {
        "operationId": "me.sales.returns.list",
        "summary": "List the returns of an order the signed-in user sold",
        "description": "Returns every return requested on the order. Another seller's order is not found. Answers 503 while selling is turned off on the server.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/shipping.ts"
      }
    },
    "/api/v1/public/me/sales/{id}/returns/{returnId}/approve": {
      "post": {
        "operationId": "me.sales.returns.approve.create",
        "summary": "Approve a return on an order the signed-in user sold",
        "description": "Approves a requested return and makes its shipment back, a label bought from the app's label provider or the seller's own details by hand. A return no longer requested answers 409; a refused label puts the return back to requested and passes on the provider's refusal.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "returnId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "provider": {
                    "type": "string",
                    "enum": [
                      "manual",
                      "easypost",
                      "shippo"
                    ]
                  },
                  "carrier": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 50
                  },
                  "trackingNumber": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 64
                  },
                  "labelFileId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-f0-9]{24}$"
                  },
                  "to": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      },
                      "line1": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "line2": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 200
                      },
                      "city": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      },
                      "state": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 50
                      },
                      "postalCode": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 20
                      },
                      "country": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 2
                      },
                      "phone": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 30
                      }
                    },
                    "required": [
                      "name",
                      "line1",
                      "city",
                      "postalCode",
                      "country"
                    ],
                    "additionalProperties": false
                  },
                  "parcel": {
                    "type": "object",
                    "properties": {
                      "weightOz": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 2400
                      },
                      "lengthIn": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 200
                      },
                      "widthIn": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 200
                      },
                      "heightIn": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 200
                      }
                    },
                    "required": [
                      "weightOz"
                    ],
                    "additionalProperties": false
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/shipping.ts",
        "x-events": [
          "return.updated"
        ]
      }
    },
    "/api/v1/public/me/sales/{id}/returns/{returnId}/refund": {
      "post": {
        "operationId": "me.sales.returns.refund.create",
        "summary": "Refund a return on an order the signed-in user sold",
        "description": "Refunds the returned units' share of their lines, less the return label when the buyer pays it, and marks the return refunded; a return already refunded is answered as it is. Answers 409 when the return cannot move to refunded or another refund of it is in progress, and 403 when in this app the app owner refunds sales, not the seller.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "returnId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/shipping.ts",
        "x-events": [
          "return.updated",
          "order.refunded"
        ]
      }
    },
    "/api/v1/public/me/sales/{id}/returns/{returnId}/reject": {
      "post": {
        "operationId": "me.sales.returns.reject.create",
        "summary": "Reject a return on an order the signed-in user sold",
        "description": "Rejects a requested return with an optional note; its units may be asked for again. A return no longer requested answers 409.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "returnId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/shipping.ts",
        "x-events": [
          "return.updated"
        ]
      }
    },
    "/api/v1/public/me/sales/{id}/shipments": {
      "get": {
        "operationId": "me.sales.shipments.list",
        "summary": "List the shipments of an order the signed-in user sold",
        "description": "Returns the order's parcels, outbound and return, with their tracking and status. Another seller's order is not found. Answers 503 while selling is turned off on the server.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/shipping.ts"
      },
      "post": {
        "operationId": "me.sales.shipments.create",
        "summary": "Ship units of an order the signed-in user sold",
        "description": "Records a shipment by hand (carrier, tracking number, a PDF label the seller uploaded) or buys a label from the app's label provider; with no lines named it carries every unit left. Answers 409 when the order is not paid, is picked up, was refused for its address, has an address held for confirmation (send `confirmAddress: true`) or has another shipment being made; 422 when the lines, tracking or label are not valid; 503 when the app has not connected its label provider.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lines": {
                    "type": "array",
                    "maxItems": 100,
                    "items": {
                      "type": "object",
                      "properties": {
                        "lineKey": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000
                        }
                      },
                      "required": [
                        "lineKey",
                        "quantity"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "provider": {
                    "type": "string",
                    "enum": [
                      "manual",
                      "easypost",
                      "shippo"
                    ]
                  },
                  "carrier": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 50
                  },
                  "service": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 80
                  },
                  "trackingNumber": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 64
                  },
                  "trackingUrl": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500
                  },
                  "labelFileId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-f0-9]{24}$"
                  },
                  "from": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      },
                      "line1": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "line2": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 200
                      },
                      "city": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      },
                      "state": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 50
                      },
                      "postalCode": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 20
                      },
                      "country": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 2
                      },
                      "phone": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 30
                      }
                    },
                    "required": [
                      "name",
                      "line1",
                      "city",
                      "postalCode",
                      "country"
                    ],
                    "additionalProperties": false
                  },
                  "parcel": {
                    "type": "object",
                    "properties": {
                      "weightOz": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 2400
                      },
                      "lengthIn": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 200
                      },
                      "widthIn": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 200
                      },
                      "heightIn": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 200
                      }
                    },
                    "required": [
                      "weightOz"
                    ],
                    "additionalProperties": false
                  },
                  "contentsType": {
                    "type": "string",
                    "enum": [
                      "merchandise",
                      "gift",
                      "documents",
                      "sample",
                      "returned_goods",
                      "other"
                    ]
                  },
                  "confirmAddress": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/shipping.ts",
        "x-events": [
          "order.shipped"
        ]
      }
    },
    "/api/v1/public/me/sales/{id}/shipments/{shipmentId}/label": {
      "get": {
        "operationId": "me.sales.shipments.label.list",
        "summary": "Download the label of a shipment on an order the signed-in user sold",
        "description": "Streams the seller's PDF label, or redirects (302) to the provider's label link. A shipment with no label answers 404, as does another seller's order.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "shipmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/shipping.ts"
      }
    },
    "/api/v1/public/me/sales/{id}/shipments/{shipmentId}/status": {
      "post": {
        "operationId": "me.sales.shipments.status.create",
        "summary": "Set the status of a shipment on an order the signed-in user sold",
        "description": "Moves a hand-made shipment to a new status with an optional message; a shipment bought from a provider moves with its tracking and may only be cancelled, which asks the provider to refund its label. A move the status does not allow answers 422, and a shipment changed meanwhile 409; the order follows its shipments to shipped and fulfilled.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "shipmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "label_created",
                      "in_transit",
                      "out_for_delivery",
                      "delivered",
                      "returned",
                      "failure",
                      "cancelled"
                    ]
                  },
                  "message": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 300
                  }
                },
                "required": [
                  "status"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/shipping.ts",
        "x-events": [
          "shipment.updated",
          "order.shipped",
          "order.fulfilled"
        ]
      }
    },
    "/api/v1/public/me/selling": {
      "get": {
        "operationId": "me.selling.list",
        "summary": "Get the signed-in user's seller account and the app's selling settings",
        "description": "Returns `seller` (null when the user has not started selling) and `selling`, what the start selling screen shows.",
        "tags": [
          "Me"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/selling.ts"
      },
      "post": {
        "operationId": "me.selling.create",
        "summary": "Start selling as the signed-in user",
        "description": "Creates the user's seller account and its Stripe connected account, answering 201; answers 200 with the existing account when one already exists. Answers 409 when this app lets only workspaces sell or the account was closed, 400 when the country is not allowed, and 503 when selling is not open in this app or Stripe is not ready.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "displayName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "contactEmail": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  }
                },
                "required": [
                  "country",
                  "displayName"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/selling.ts"
      }
    },
    "/api/v1/public/me/selling/co-sellers": {
      "get": {
        "operationId": "me.selling.coSellers.list",
        "summary": "List co-seller invitations the user's seller account received or sent",
        "description": "`direction` is `received` (the default) or `sent`, newest first. Answers 404 when the user has not started selling.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "direction",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "received",
                "sent"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/selling.ts"
      },
      "post": {
        "operationId": "me.selling.coSellers.create",
        "summary": "Invite another seller to share the sales of one of the user's items",
        "description": "Offers the invited seller `shareBps` of each sale, taken from the user's own share; nothing changes on the item until they accept. Answers 201. Refused with 403 unless the app owner lets sellers invite co-sellers, 409 outside the marketplace shape or when that seller already has an open invitation, and 422 when the share cannot be given or the seller cannot be invited.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "itemId": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  },
                  "sellerId": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  },
                  "shareBps": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9999
                  }
                },
                "required": [
                  "itemId",
                  "sellerId",
                  "shareBps"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/selling.ts"
      }
    },
    "/api/v1/public/me/selling/co-sellers/{invitationId}/accept": {
      "post": {
        "operationId": "me.selling.coSellers.accept.create",
        "summary": "Accept a co-seller invitation sent to the signed-in user",
        "description": "Requires `consent: true`. Adds the user as a payee of the item, their share taken from the inviting seller's, and records the consent. Answers 403 unless the app owner lets sellers invite, and 409 when the invitation was already answered, has expired, or the item's split changed.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "invitationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "consent": {
                    "type": "boolean",
                    "const": true
                  }
                },
                "required": [
                  "consent"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/selling.ts"
      }
    },
    "/api/v1/public/me/selling/co-sellers/{invitationId}/decline": {
      "post": {
        "operationId": "me.selling.coSellers.decline.create",
        "summary": "Decline a co-seller invitation sent to the signed-in user",
        "description": "Nothing on the item changes. Answers 409 when the invitation was already answered.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "invitationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/selling.ts"
      }
    },
    "/api/v1/public/me/selling/co-sellers/{invitationId}/withdraw": {
      "post": {
        "operationId": "me.selling.coSellers.withdraw.create",
        "summary": "Withdraw an open co-seller invitation the signed-in user sent",
        "description": "Only the inviting seller may withdraw. Answers 409 when the invitation was already answered.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "invitationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/selling.ts"
      }
    },
    "/api/v1/public/me/selling/debit-terms/accept": {
      "post": {
        "operationId": "me.selling.debitTerms.accept.create",
        "summary": "Accept the app owner's account debit terms as the signed-in seller",
        "description": "Records acceptance of the `version` the seller was shown and returns the seller account. Answers 409 when there are no debit terms or the version is no longer current.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  }
                },
                "required": [
                  "version"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/selling.ts"
      }
    },
    "/api/v1/public/me/selling/session": {
      "post": {
        "operationId": "me.selling.session.create",
        "summary": "Create a session for Stripe's embedded seller components",
        "description": "Returns a short-lived client secret for the requested `sections` (onboarding, management, payouts, payments, documents, tax). Answers 404 when the user has not started selling and 409 when the seller account is closed.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sections": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 6,
                    "items": {
                      "type": "string",
                      "enum": [
                        "onboarding",
                        "management",
                        "payouts",
                        "payments",
                        "documents",
                        "tax"
                      ]
                    }
                  }
                },
                "required": [
                  "sections"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/selling.ts"
      }
    },
    "/api/v1/public/me/selling/shipping": {
      "get": {
        "operationId": "me.selling.shipping.list",
        "summary": "Get the shipping settings of the signed-in user's seller account",
        "description": "How their items' own rates combine, returns, customs and the address mismatch rule, with defaults filled in. Answers 404 when the user has not started selling.",
        "tags": [
          "Me"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/selling.ts"
      },
      "put": {
        "operationId": "me.selling.shipping.update",
        "summary": "Update the shipping settings of the signed-in user's seller account",
        "description": "Merges the parts sent onto the stored settings and returns the result. Answers 422 when the settings are not valid and 404 when the user has not started selling.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "combine": {
                    "type": "string",
                    "enum": [
                      "sum",
                      "highest_plus_additional",
                      "flat_per_order"
                    ]
                  },
                  "addressMismatch": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "flag_hold",
                      "requote",
                      "ignore",
                      null
                    ]
                  },
                  "returns": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "windowDays": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 365
                      },
                      "labelPaidBy": {
                        "type": "string",
                        "enum": [
                          "seller",
                          "buyer"
                        ]
                      },
                      "autoRefundOn": {
                        "type": "string",
                        "enum": [
                          "none",
                          "delivered"
                        ]
                      }
                    },
                    "additionalProperties": false
                  },
                  "customs": {
                    "type": "object",
                    "properties": {
                      "contentsType": {
                        "type": "string",
                        "enum": [
                          "merchandise",
                          "gift",
                          "documents",
                          "sample",
                          "returned_goods",
                          "other"
                        ]
                      },
                      "incoterm": {
                        "type": "string",
                        "enum": [
                          "DAP",
                          "DDP"
                        ]
                      },
                      "nonDelivery": {
                        "type": "string",
                        "enum": [
                          "return",
                          "abandon"
                        ]
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/selling.ts"
      }
    },
    "/api/v1/public/me/selling/sync": {
      "post": {
        "operationId": "me.selling.sync.create",
        "summary": "Refresh the signed-in user's seller account from Stripe",
        "description": "Reads the Stripe connected account now, for use after the seller leaves Stripe's onboarding, and returns the updated seller account. Answers 404 when the user has not started selling. Emits `seller.status_changed` when the shown status changes.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/selling.ts",
        "x-events": [
          "seller.status_changed"
        ]
      }
    },
    "/api/v1/public/me/selling/tax": {
      "get": {
        "operationId": "me.selling.tax.list",
        "summary": "Get the signed-in user's own tax choice as a seller",
        "description": "Returns `appTaxMode` (the app owner's mode), `canChoose` (true only when the app's mode is `seller_choice` and both the app and this seller use the storefront shape), `taxMode` (the seller's choice, `off` until they choose), `effective` (what their sales run under now) and `stripeTax` (`active`, `pending` or `unknown` on their Stripe account, or null when it does not matter). Answers 404 `SELLER_NOT_FOUND` when the user has not started selling.",
        "tags": [
          "Me"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/selling.ts"
      },
      "put": {
        "operationId": "me.selling.tax.update",
        "summary": "Choose whether Stripe Tax works out the tax on the user's own sales",
        "description": "Takes `taxMode`: `off` or `stripe_tax`, and returns the settings as the read does. Refused with 409 `SELLER_TAX_REFUSED` (problem `not_seller_choice`) unless the app leaves tax to sellers, and with 422 `SELLER_TAX_REFUSED` (problem `stripe_tax_inactive`) when `stripe_tax` is chosen before Stripe Tax is active on the seller's Stripe account. `off` is always taken while the seller may choose. Answers 404 `SELLER_NOT_FOUND` when the user has not started selling.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "taxMode": {
                    "type": "string",
                    "enum": [
                      "off",
                      "stripe_tax"
                    ]
                  }
                },
                "required": [
                  "taxMode"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/selling.ts"
      }
    },
    "/api/v1/public/me/shipping-rates": {
      "get": {
        "operationId": "me.shippingRates.list",
        "summary": "List the signed-in user's shipping rates as a seller",
        "description": "Returns every shipping rate the seller keeps. Answers 404 when the user has not started selling, and 503 while selling is turned off on the server.",
        "tags": [
          "Me"
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/shipping.ts"
      },
      "post": {
        "operationId": "me.shippingRates.create",
        "summary": "Create a shipping rate for the signed-in user as a seller",
        "description": "Saves a rate: its name, amount and currency, the countries it ships to, and how it is worked out (flat, brackets, per item or a carrier quote). Answers 404 when the user has not started selling, and 422 when the rate is not valid or the seller already keeps the most rates allowed (5).",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 50
                  },
                  "amount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  "currency": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 3
                  },
                  "countries": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 60,
                    "items": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 2
                    }
                  },
                  "minDays": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 365
                  },
                  "maxDays": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 365
                  },
                  "freeOver": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  "pickup": {
                    "type": "boolean"
                  },
                  "basis": {
                    "type": "string",
                    "enum": [
                      "flat",
                      "weight",
                      "subtotal",
                      "items",
                      "carrier"
                    ]
                  },
                  "brackets": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "properties": {
                        "upTo": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "amount": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 10000000
                        }
                      },
                      "required": [
                        "upTo",
                        "amount"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "perItem": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  "carrier": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "carriers": {
                        "type": "array",
                        "maxItems": 10,
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 50
                        }
                      },
                      "services": {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        }
                      },
                      "markupBps": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000
                      },
                      "markupFixed": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000000
                      },
                      "fallbackAmount": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "maximum": 10000000
                      },
                      "origin": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "line1": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "line2": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 200
                          },
                          "city": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "state": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 50
                          },
                          "postalCode": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 20
                          },
                          "country": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 2
                          },
                          "phone": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 30
                          }
                        },
                        "required": [
                          "name",
                          "line1",
                          "city",
                          "postalCode",
                          "country"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "carriers",
                      "services",
                      "markupBps",
                      "markupFixed",
                      "origin"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "name",
                  "amount",
                  "currency",
                  "countries"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/shipping.ts"
      }
    },
    "/api/v1/public/me/shipping-rates/{id}": {
      "get": {
        "operationId": "me.shippingRates.get",
        "summary": "Get one of the signed-in user's shipping rates",
        "description": "Returns the rate. Another seller's rate is not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/shipping.ts"
      },
      "put": {
        "operationId": "me.shippingRates.update",
        "summary": "Replace one of the signed-in user's shipping rates",
        "description": "Saves the rate whole; orders already sold keep the copy they were sold with. A rate that is not valid answers 422, and another seller's rate is not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 50
                  },
                  "amount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  "currency": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 3
                  },
                  "countries": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 60,
                    "items": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 2
                    }
                  },
                  "minDays": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 365
                  },
                  "maxDays": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 365
                  },
                  "freeOver": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  "pickup": {
                    "type": "boolean"
                  },
                  "basis": {
                    "type": "string",
                    "enum": [
                      "flat",
                      "weight",
                      "subtotal",
                      "items",
                      "carrier"
                    ]
                  },
                  "brackets": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "properties": {
                        "upTo": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "amount": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 10000000
                        }
                      },
                      "required": [
                        "upTo",
                        "amount"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "perItem": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  "carrier": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "carriers": {
                        "type": "array",
                        "maxItems": 10,
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 50
                        }
                      },
                      "services": {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        }
                      },
                      "markupBps": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000
                      },
                      "markupFixed": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000000
                      },
                      "fallbackAmount": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "maximum": 10000000
                      },
                      "origin": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "line1": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "line2": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 200
                          },
                          "city": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "state": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 50
                          },
                          "postalCode": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 20
                          },
                          "country": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 2
                          },
                          "phone": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 30
                          }
                        },
                        "required": [
                          "name",
                          "line1",
                          "city",
                          "postalCode",
                          "country"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "carriers",
                      "services",
                      "markupBps",
                      "markupFixed",
                      "origin"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "name",
                  "amount",
                  "currency",
                  "countries"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/shipping.ts"
      },
      "delete": {
        "operationId": "me.shippingRates.delete",
        "summary": "Delete one of the signed-in user's shipping rates",
        "description": "Deletes the rate; orders already sold keep their copy of it. Another seller's rate is not found.",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/shipping.ts"
      }
    },
    "/api/v1/public/me/subscription": {
      "get": {
        "operationId": "me.subscription.list",
        "summary": "Get the signed-in user's own subscription, standing and entitlement",
        "description": "Answers the public view of the user's subscription (null when they have none), the plan billed now and any earlier plan still held to the period end, the billing currency, scheduled plan and add-on changes, stored discounts, and what the org lets the user do to it (pause, cancel now, switch interval). Answers 503 when the server's cache is unavailable.",
        "tags": [
          "Me"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/index.ts"
      },
      "patch": {
        "operationId": "me.subscription.update",
        "summary": "Change the signed-in user's own plan, or start a checkout for it",
        "description": "With a Stripe subscription, changes it to `planVersionId` prorated (optionally at the preview's `prorationDate`) and may answer `paymentRequired` with the invoice to pay; with none yet, answers a checkout session instead. Answers 403 when the org turned the interval switch off, 409 when another change is pending or being made, Stripe ended the subscription instead (`SUBSCRIPTION_ENDED_ON_PLAN_CHANGE`), the app has no Stripe account or the idempotency key was reused, and 503 when the tax setting could not be read. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "planVersionId": {
                    "type": "string",
                    "format": "ObjectID"
                  },
                  "billingInterval": {
                    "type": "string",
                    "enum": [
                      "monthly",
                      "yearly",
                      "quarterly"
                    ]
                  },
                  "currency": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 3
                  },
                  "successUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "cancelUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "promotionCode": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "prorationDate": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "uiMode": {
                    "type": "string",
                    "enum": [
                      "hosted",
                      "embedded"
                    ]
                  },
                  "returnUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "locale": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 35,
                    "pattern": "^[A-Za-z]{2,3}([-_][A-Za-z0-9]{1,8})*$"
                  }
                },
                "required": [
                  "planVersionId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/money.ts",
        "x-events": [
          "subscription.upgraded",
          "subscription.downgraded"
        ]
      }
    },
    "/api/v1/public/me/subscription/billing-portal": {
      "post": {
        "operationId": "me.subscription.billingPortal.create",
        "summary": "Open the Stripe billing portal on the signed-in user's own customer",
        "description": "Answers the portal URL, creating the Stripe customer on first use; `flow` opens it on a given form, such as the card form, and `returnUrl` must be an allowed return URL. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "returnUrl": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "flow": {
                    "type": "string",
                    "maxLength": 64
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/money.ts"
      }
    },
    "/api/v1/public/me/subscription/cancel-at-period-end": {
      "post": {
        "operationId": "me.subscription.cancelAtPeriodEnd.create",
        "summary": "Cancel the signed-in user's own plan at the end of the billing period",
        "description": "Optionally records the user's feedback, a comment and a declined retention offer. Refused with 400 where the subscription's state does not allow a cancel, and 409 when a change is waiting on its payment or another is being made. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "feedback": {
                    "type": "string",
                    "enum": [
                      "customer_service",
                      "low_quality",
                      "missing_features",
                      "other",
                      "switched_service",
                      "too_complex",
                      "too_expensive",
                      "unused"
                    ]
                  },
                  "comment": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "retention": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "offerId",
                      "outcome"
                    ],
                    "properties": {
                      "offerId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      },
                      "outcome": {
                        "type": "string",
                        "enum": [
                          "declined"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/money.ts",
        "x-events": [
          "subscription.cancel_scheduled"
        ]
      }
    },
    "/api/v1/public/me/subscription/cancel-now": {
      "post": {
        "operationId": "me.subscription.cancelNow.create",
        "summary": "End the signed-in user's own plan now, with the app's refund",
        "description": "Only when the app lets customers end a plan immediately; otherwise 403 `CANCEL_NOW_OFF`. Takes the same optional feedback body as the cancel at period end, refuses with 400 while an invoice is unpaid, and with 409 when a change is pending or the app has no Stripe account. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "feedback": {
                    "type": "string",
                    "enum": [
                      "customer_service",
                      "low_quality",
                      "missing_features",
                      "other",
                      "switched_service",
                      "too_complex",
                      "too_expensive",
                      "unused"
                    ]
                  },
                  "comment": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "retention": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "offerId",
                      "outcome"
                    ],
                    "properties": {
                      "offerId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      },
                      "outcome": {
                        "type": "string",
                        "enum": [
                          "declined"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/money.ts"
      }
    },
    "/api/v1/public/me/subscription/checkout": {
      "post": {
        "operationId": "me.subscription.checkout.create",
        "summary": "Start a Stripe checkout for a plan on the signed-in user's own account",
        "description": "Creates a checkout for `planVersionId` and `billingInterval` (monthly by default), hosted or embedded, with an optional promotion code, and answers its URL or client secret. Refused with 400 when the user already has a live subscription or the plan is not published or not sold to people; 409 when a payer rule refuses it, the app has no Stripe account, prices are still syncing or the idempotency key was reused; 503 when the tax setting could not be read. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "planVersionId": {
                    "type": "string",
                    "format": "ObjectID"
                  },
                  "billingInterval": {
                    "type": "string",
                    "enum": [
                      "monthly",
                      "yearly",
                      "quarterly"
                    ]
                  },
                  "currency": {
                    "type": "string",
                    "minLength": 2
                  },
                  "successUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "cancelUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "uiMode": {
                    "type": "string",
                    "enum": [
                      "hosted",
                      "embedded"
                    ]
                  },
                  "returnUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "payer": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "workspace",
                          "user"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "format": "ObjectID"
                      }
                    },
                    "required": [
                      "type",
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  "locale": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 35,
                    "pattern": "^[A-Za-z]{2,3}([-_][A-Za-z0-9]{1,8})*$"
                  },
                  "stripeOptions": {
                    "type": "object",
                    "properties": {
                      "metadata": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string"
                        }
                      },
                      "clientReferenceId": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "subscriptionMetadata": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string"
                        }
                      },
                      "promotionCode": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "planVersionId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/money.ts"
      }
    },
    "/api/v1/public/me/subscription/convert-to-paid": {
      "post": {
        "operationId": "me.subscription.convertToPaid.create",
        "summary": "End the signed-in user's trial now and start paying for the plan",
        "description": "Charges the card on file; if the payment is declined or needs authentication the trial keeps running and the answer carries `paymentUrl` or `paymentAction`. Accepts an `Idempotency-Key` header. Answers 409 when another change is in progress or there is no card that can pay now, and, in the management tenant, 403 `EMAIL_NOT_VERIFIED` until the email is verified.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prorationDate": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 64
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/index.ts"
      }
    },
    "/api/v1/public/me/subscription/entitlement": {
      "get": {
        "operationId": "me.subscription.entitlement.list",
        "summary": "Get the signed-in user's resolved entitlement",
        "description": "The features, limits and quotas the user's own plan and grants give them. Answers 503 when the server's cache is unavailable.",
        "tags": [
          "Me"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/index.ts"
      }
    },
    "/api/v1/public/me/subscription/invoices": {
      "get": {
        "operationId": "me.subscription.invoices.list",
        "summary": "List the invoices on the signed-in user's own Stripe customer",
        "description": "Paginated with `limit` (10 by default) and Stripe's `starting_after` cursor, answering `has_more`. An app with no Stripe account answers an empty list. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/money.ts"
      }
    },
    "/api/v1/public/me/subscription/invoices/{invoiceId}": {
      "get": {
        "operationId": "me.subscription.invoices.get",
        "summary": "Get one invoice of the signed-in user's own Stripe customer",
        "description": "An invoice that belongs to another customer answers 404. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/money.ts"
      }
    },
    "/api/v1/public/me/subscription/invoices/{invoiceId}/pay": {
      "post": {
        "operationId": "me.subscription.invoices.pay.create",
        "summary": "Pay an open invoice of the signed-in user's own subscription now",
        "description": "Charges the saved default card, or `paymentMethodId`, and answers the outcome, including a 3-D Secure action when the bank asks for one. Answers 400 for a declined card, 409 when the invoice is not open or the change it was for expired, and 404 for an unknown invoice or card. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "paymentMethodId": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 255,
                    "pattern": "^pm_[A-Za-z0-9]+$"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "payment-method",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/money.ts"
      }
    },
    "/api/v1/public/me/subscription/pause": {
      "post": {
        "operationId": "me.subscription.pause.create",
        "summary": "Pause the signed-in user's own monthly plan after the paid period",
        "description": "Pauses for `months` billing cycles once the current period ends; resume ends it early. Answers 403 `PAUSE_NOT_ENABLED` when the app does not let customers pause, and 400 for more months than the app's cap or a subscription that cannot be paused. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "months"
                ],
                "properties": {
                  "months": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/money.ts"
      }
    },
    "/api/v1/public/me/subscription/plan-group": {
      "get": {
        "operationId": "me.subscription.planGroup.list",
        "summary": "Get the plan group the signed-in user picks personal plans from",
        "description": "The user's current group, else the user-payer group named by `slug`, else the org's default user-payer group, else its only published one, with plans in the org's order and `migration` when a newer group version exists. Answers 404 when there is none to offer; with `ifNone=empty` and no `slug`, answers 200 with an empty group and `code: NO_PLANS_AVAILABLE` instead.",
        "tags": [
          "Me"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/index.ts"
      }
    },
    "/api/v1/public/me/subscription/preview": {
      "post": {
        "operationId": "me.subscription.preview.create",
        "summary": "Preview what changing the signed-in user's own plan will cost",
        "description": "Answers what is due today and on the next invoice for `planVersionId`, an estimate of a checkout when the user has no Stripe subscription yet, or with `trialEnd: 'now'` what ending the trial now costs; the subscription is not changed. Refuses where the plan change would: 403 when the interval switch is off, 409 when a change is pending or being made. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "planVersionId": {
                    "type": "string",
                    "format": "ObjectID"
                  },
                  "billingInterval": {
                    "type": "string",
                    "enum": [
                      "monthly",
                      "yearly",
                      "quarterly"
                    ]
                  },
                  "currency": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 3
                  },
                  "trialEnd": {
                    "type": "string",
                    "enum": [
                      "now"
                    ]
                  },
                  "promotionCode": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "oneOf": [
                  {
                    "required": [
                      "planVersionId"
                    ]
                  },
                  {
                    "required": [
                      "trialEnd"
                    ],
                    "not": {
                      "anyOf": [
                        {
                          "required": [
                            "billingInterval"
                          ]
                        },
                        {
                          "required": [
                            "currency"
                          ]
                        },
                        {
                          "required": [
                            "promotionCode"
                          ]
                        }
                      ]
                    }
                  }
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "subscription-preview",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/money.ts"
      }
    },
    "/api/v1/public/me/subscription/resume": {
      "post": {
        "operationId": "me.subscription.resume.create",
        "summary": "Resume the signed-in user's own plan, undoing a pause or cancel",
        "description": "Ends a scheduled or running pause and clears a cancel at period end. Refused with 400 where the subscription's state does not allow it, and 409 when another change is being made. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/money.ts",
        "x-events": [
          "subscription.resumed"
        ]
      }
    },
    "/api/v1/public/me/subscription/retention-offer": {
      "get": {
        "operationId": "me.subscription.retentionOffer.list",
        "summary": "Get the cancel dialog's context for the signed-in user's own plan",
        "description": "Answers whether to ask why the user is leaving, the one retention offer the subscription may still take (null for none) and the plan the user lands on after cancelling. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/money.ts"
      }
    },
    "/api/v1/public/me/subscription/retention-offer/accept": {
      "post": {
        "operationId": "me.subscription.retentionOffer.accept.create",
        "summary": "Accept the retention offer instead of cancelling the user's own plan",
        "description": "Applies the offer's discount or pause to the subscription, once per subscription. Answers 409 `RETENTION_ALREADY_USED` for a second accept or when a change is waiting on its payment, and 400 `RETENTION_OFFER_CHANGED` when the offer changed since it was shown. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "offerId"
                ],
                "properties": {
                  "offerId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "feedback": {
                    "type": "string",
                    "enum": [
                      "customer_service",
                      "low_quality",
                      "missing_features",
                      "other",
                      "switched_service",
                      "too_complex",
                      "too_expensive",
                      "unused"
                    ]
                  },
                  "comment": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/money.ts",
        "x-events": [
          "subscription.retention_accepted"
        ]
      }
    },
    "/api/v1/public/me/subscription/select-free-plan": {
      "post": {
        "operationId": "me.subscription.selectFreePlan.create",
        "summary": "Put the signed-in user on a free plan",
        "description": "Needs no email verification. Answers `alreadyAssigned` when the user is already on it. Answers 409 `CHECKOUT_IN_FLIGHT` while a paid checkout is completing, and 409 when the user's plan ended for a failed payment and the org holds it until they subscribe again.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "planVersionId": {
                    "type": "string",
                    "format": "ObjectID"
                  }
                },
                "required": [
                  "planVersionId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/index.ts",
        "x-events": [
          "subscription.created"
        ]
      }
    },
    "/api/v1/public/me/subscription/trial-eligibility": {
      "get": {
        "operationId": "me.subscription.trialEligibility.list",
        "summary": "Check whether the signed-in user would get a trial on each personal plan",
        "description": "Answers `eligible`, `reason`, `usedAt` and a per-plan answer for the plans in the user's group. Only trials of personal plans count; a workspace's trial does not.",
        "tags": [
          "Me"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/index.ts"
      }
    },
    "/api/v1/public/me/subscription/upcoming-invoice": {
      "get": {
        "operationId": "me.subscription.upcomingInvoice.list",
        "summary": "Get the next invoice of the signed-in user's own subscription",
        "description": "Answers the invoice as it stands, `kind: 'paused'` with `resumesAt` while a pause holds it, or `kind: 'none'` when the user has no Stripe subscription. Behind the money gate (403 `EMAIL_NOT_VERIFIED` in the management tenant).",
        "tags": [
          "Me"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "subscription-preview",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/money.ts"
      }
    },
    "/api/v1/public/me/subscription/usage": {
      "post": {
        "operationId": "me.subscription.usage.create",
        "summary": "Record usage against one of the signed-in user's quotas",
        "description": "Counts on the user's own counter, with an optional `idempotencyKey` and `partitionKey`. Answers 402 when the quota refuses the usage. Emits `quota.limit_exceeded` on first crossing into overage and `quota.threshold_reached` once per alert threshold per period.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "quotaSlug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000000
                  },
                  "metadata": {
                    "type": "object"
                  },
                  "source": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "partitionKey": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$",
                    "not": {
                      "anyOf": [
                        {
                          "const": "pool"
                        },
                        {
                          "pattern": "^member:"
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "quotaSlug",
                  "quantity"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "usage",
            "windowMs": 60000,
            "max": 60,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/index.ts",
        "x-events": [
          "quota.limit_exceeded",
          "quota.threshold_reached"
        ]
      }
    },
    "/api/v1/public/me/subscription/usage/batch": {
      "post": {
        "operationId": "me.subscription.usage.batch.create",
        "summary": "Record several usage items against the signed-in user's quotas",
        "description": "Items are recorded one at a time on the user's counter, and each answers its own success or error, so the request answers 200 even when some items fail. The quota events are the same as for a single usage record.",
        "tags": [
          "Me"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "quotaSlug": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000000
                        },
                        "metadata": {
                          "type": "object"
                        },
                        "source": {
                          "type": "string",
                          "maxLength": 100
                        },
                        "idempotencyKey": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "partitionKey": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9._:-]{1,128}$",
                          "not": {
                            "anyOf": [
                              {
                                "const": "pool"
                              },
                              {
                                "pattern": "^member:"
                              }
                            ]
                          }
                        }
                      },
                      "required": [
                        "quotaSlug",
                        "quantity"
                      ],
                      "additionalProperties": false
                    },
                    "minItems": 1,
                    "maxItems": 100
                  }
                },
                "required": [
                  "items"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "usage",
            "windowMs": 60000,
            "max": 60,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/me/index.ts",
        "x-events": [
          "quota.limit_exceeded",
          "quota.threshold_reached"
        ]
      }
    },
    "/api/v1/public/mfa": {
      "get": {
        "operationId": "mfa.list",
        "summary": "Get the signed-in person's two-step sign-in status",
        "description": "Answers whether an authenticator app is set up, the org's enforcement and allowed factors, and the text-message factor's status.",
        "tags": [
          "MFA"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "allowedFactors": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "backupCodesRemaining": {
                      "type": "integer"
                    },
                    "confirmedAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "enforcement": {
                      "type": "string"
                    },
                    "lastUsedAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "sms": {
                      "properties": {
                        "allowed": {
                          "type": "boolean"
                        },
                        "enrolled": {
                          "type": "boolean"
                        },
                        "phone": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "allowedFactors": [
                    "totp"
                  ],
                  "backupCodesRemaining": 10,
                  "confirmedAt": "2026-01-01T00:00:00.000Z",
                  "enabled": true,
                  "enforcement": "optional",
                  "lastUsedAt": "2026-01-01T00:00:00.000Z",
                  "sms": {
                    "allowed": false,
                    "enrolled": false
                  }
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/mfa.ts"
      }
    },
    "/api/v1/public/mfa/backup-codes/regenerate": {
      "post": {
        "operationId": "mfa.backupCodes.regenerate.create",
        "summary": "Replace the backup codes for the authenticator app",
        "description": "Needs a current authenticator or backup code; the old backup codes stop working and the new ones are in this answer only. Answers 404 with no app set up and 429 when locked after wrong codes.",
        "tags": [
          "MFA"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 20
                  }
                },
                "required": [
                  "code"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "backupCodes": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "backupCodes": [
                      "4mg9d-zve47",
                      "yezye-yf4qk",
                      "mdqyu-k4z8f",
                      "vttnu-dztmk",
                      "6rx63-gnnkg",
                      "mewzz-w8rjn",
                      "4vjt7-pxhbc",
                      "52fju-44puk",
                      "ek426-wfcac",
                      "hhnxr-bzd6q"
                    ]
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/mfa.ts"
      }
    },
    "/api/v1/public/mfa/sms/disable": {
      "post": {
        "operationId": "mfa.sms.disable.create",
        "summary": "Turn off text-message codes as a second step",
        "description": "Needs a recent sign-in (403 `reauth_required`). Refused with 403 while the org requires a second step and this is the person's only one.",
        "tags": [
          "MFA"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/mfa.ts",
        "x-events": [
          "user.mfa_disabled"
        ]
      }
    },
    "/api/v1/public/mfa/sms/enroll": {
      "post": {
        "operationId": "mfa.sms.enroll.create",
        "summary": "Send the code that turns on text-message codes as a second step",
        "description": "Texts a code to the person's verified phone. Answers 409 for a guest account.",
        "tags": [
          "MFA"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "retryAfter": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "retryAfter": 30
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/mfa.ts"
      }
    },
    "/api/v1/public/mfa/sms/enroll/confirm": {
      "post": {
        "operationId": "mfa.sms.enroll.confirm.create",
        "summary": "Confirm text-message codes as a second step with the texted code",
        "description": "Answers 400 for a wrong code, 410 for an expired one, and 503 when codes cannot be checked.",
        "tags": [
          "MFA"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 10
                  }
                },
                "required": [
                  "code"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "enrolled": {
                          "type": "boolean"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "enrolled": true
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/mfa.ts",
        "x-events": [
          "user.mfa_enrolled"
        ]
      }
    },
    "/api/v1/public/mfa/totp/confirm": {
      "post": {
        "operationId": "mfa.totp.confirm.create",
        "summary": "Confirm an authenticator app with its first code",
        "description": "Turns the app on and issues backup codes, which are in this answer only. Answers 409 when no set-up is pending and 400 for a wrong code.",
        "tags": [
          "MFA"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 6
                  }
                },
                "required": [
                  "code"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "backupCodes": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "backupCodes": [
                      "22p62-juh6p",
                      "6e27w-e36zt",
                      "pzftj-e3y3k",
                      "9z5sz-fmp5g",
                      "g7gcy-8xerj",
                      "2kbtf-9wpgq",
                      "2a74z-uc9mp",
                      "52scg-p2ty5",
                      "cmxbq-j6duv",
                      "sdn3r-a6u96"
                    ]
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/mfa.ts",
        "x-events": [
          "user.mfa_enrolled"
        ]
      }
    },
    "/api/v1/public/mfa/totp/disable": {
      "post": {
        "operationId": "mfa.totp.disable.create",
        "summary": "Remove the authenticator app",
        "description": "Needs a current authenticator or backup code. Forgets every device's remembered second step and retires login tokens already issued. Refused with 403 while the org requires a second step.",
        "tags": [
          "MFA"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 20
                  }
                },
                "required": [
                  "code"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/mfa.ts",
        "x-events": [
          "user.mfa_disabled"
        ]
      }
    },
    "/api/v1/public/mfa/totp/enroll": {
      "post": {
        "operationId": "mfa.totp.enroll.create",
        "summary": "Start setting up an authenticator app",
        "description": "Answers the secret, its otpauth URL and a QR code. Answers 403 when two-step sign-in is off for the app, 409 when an app is already set up or for a guest account.",
        "tags": [
          "MFA"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "otpauthUrl": {
                          "type": "string"
                        },
                        "qrSvg": {
                          "type": "string"
                        },
                        "secret": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "otpauthUrl": "otpauth://totp/Updated%20Auth%20Config:e2e-session-1767225600000-uname-twostep-1767225600000%40test.example.com?secret=[REDACTED]&issuer=Updated%20Auth%20Config",
                    "qrSvg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 55 55\" shape-rendering=\"crispEdges\"><path fill=\"#ffffff\" d=\"M0 0h55v55H0z\"/><path stroke=\"#000000\" d=\"M1 1.5h7m1 0h1m3 0h1m2 0h6m3 0h1m3 0h1m6 0h2m5 0h1m3 0h7M1 2.5h1m5 0h1m1 0h1m1 0h1m1 0h2m1 0h2m1 0h1m1 0h1m4 0h2m3 0h2m1 0h3m6 0h2m2 0h1m5 0h1M1 3.5h1m1 0h3m1 0h1m2 0h2m3 0h1m2 0h5m3 0h1m1 0h3m2 0h2m1 0h3m1 0h3m1 0h1m2 0h1m1 0h3m1 0h1M1 4.5h1m1 0h3m1 0h1m1 0h1m2 0h1m1 0h1m1 0h1m4 0h1m4 0h1m1 0h3m5 0h2m5 0h1m1 0h1m1 0h1m1 0h3m1 0h1M1 5.5h1m1 0h",
                    "secret": "[REDACTED]"
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/mfa.ts"
      }
    },
    "/api/v1/public/notifications": {
      "get": {
        "operationId": "notifications.list",
        "summary": "List the signed-in user's notifications",
        "description": "Returns a page of the caller's own inbox, optionally filtered to one workspace or to account notices (`workspaceId=none`), going back only as far as the plan keeps email history. Items of a workspace whose rules refuse this session are left out, or answered 403 when filtered to that workspace; 503 `policy_unavailable` when that cannot be decided.",
        "tags": [
          "Notifications"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "hasNextPage": {
                      "type": "boolean"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "notifications": {
                      "items": {
                        "properties": {
                          "archivedAt": {
                            "format": "date-time",
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "body": {
                            "type": "string"
                          },
                          "channels": {
                            "properties": {
                              "email": {
                                "properties": {
                                  "clickedAt": {},
                                  "openedAt": {},
                                  "status": {
                                    "type": "string"
                                  }
                                },
                                "type": "object"
                              },
                              "push": {
                                "properties": {
                                  "clickedAt": {},
                                  "status": {
                                    "type": "string"
                                  }
                                },
                                "type": "object"
                              }
                            },
                            "type": "object"
                          },
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "event": {
                            "type": "string"
                          },
                          "icon": {},
                          "id": {
                            "type": "string"
                          },
                          "link": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "readAt": {
                            "format": "date-time",
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "readVia": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "seenAt": {
                            "format": "date-time",
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "source": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "url": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "workspaceId": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "page": {
                      "type": "integer"
                    },
                    "total": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "hasNextPage": false,
                  "limit": 20,
                  "notifications": [
                    {
                      "archivedAt": null,
                      "body": "Registered by its first send from the SDK.",
                      "channels": {
                        "email": {
                          "clickedAt": null,
                          "openedAt": null,
                          "status": "none"
                        },
                        "push": {
                          "clickedAt": null,
                          "status": "none"
                        }
                      },
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "event": "m22_workspace_note",
                      "icon": null,
                      "id": "000000000000000000000001",
                      "link": null,
                      "readAt": null,
                      "readVia": null,
                      "seenAt": null,
                      "source": "custom",
                      "title": "A note in Globex design 1767225600000",
                      "url": null,
                      "workspaceId": "000000000000000000000002"
                    },
                    {
                      "archivedAt": null,
                      "body": "Registered by its first send from the SDK.",
                      "channels": {
                        "email": {
                          "clickedAt": null,
                          "openedAt": null,
                          "status": "none"
                        },
                        "push": {
                          "clickedAt": null,
                          "status": "none"
                        }
                      },
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "event": "m22_workspace_note",
                      "icon": null,
                      "id": "000000000000000000000003",
                      "link": null,
                      "readAt": null,
                      "readVia": null,
                      "seenAt": null,
                      "source": "custom",
                      "title": "A note in Globex finance 1767225600000",
                      "url": null,
                      "workspaceId": "000000000000000000000004"
                    },
                    {
                      "archivedAt": null,
                      "body": "Your account signed in from a new device. If this wasn't you, secure your account.",
                      "channels": {
                        "email": {
                          "clickedAt": null,
                          "openedAt": null,
                          "status": "sent"
                        },
                        "push": {
                          "clickedAt": null,
                          "status": "none"
                        }
                      },
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "event": "user.new_device_login",
                      "icon": null,
                      "id": "000000000000000000000005",
                      "link": null,
                      "readAt": null,
                      "readVia": null,
                      "seenAt": null,
                      "source": "system",
                      "title": "New device signed in",
                      "url": null,
                      "workspaceId": null
                    },
                    {
                      "archivedAt": null,
                      "body": "Your account was just signed in.",
                      "channels": {
                        "email": {
                          "clickedAt": null,
                          "openedAt": null,
                          "status": "none"
                        },
                        "push": {
                          "clickedAt": null,
                          "status": "none"
                        }
                      },
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "event": "user.logged_in",
                      "icon": null,
                      "id": "000000000000000000000006",
                      "link": null,
                      "readAt": null,
                      "readVia": null,
                      "seenAt": null,
                      "source": "system",
                      "title": "New sign-in",
                      "url": null,
                      "workspaceId": null
                    },
                    {
                      "archivedAt": null,
                      "body": "Your account signed in from a new device. If this wasn't you, secure your account.",
                      "channels": {
                        "email": {
                          "clickedAt": null,
                          "openedAt": null,
                          "status": "sent"
                        },
                        "push": {
                          "clickedAt": null,
                          "status": "none"
                        }
                      },
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "event": "user.new_device_login",
                      "icon": null,
                      "id": "000000000000000000000007",
                      "link": null,
                      "readAt": null,
                      "readVia": null,
                      "seenAt": null,
                      "source": "system",
                      "title": "New device signed in",
                      "url": null,
                      "workspaceId": null
                    },
                    {
                      "archivedAt": null,
                      "body": "Your account was just signed in.",
                      "channels": {
                        "email": {
                          "clickedAt": null,
                          "openedAt": null,
                          "status": "none"
                        },
                        "push": {
                          "clickedAt": null,
                          "status": "none"
                        }
                      },
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "event": "user.logged_in",
                      "icon": null,
                      "id": "000000000000000000000008",
                      "link": null,
                      "readAt": null,
                      "readVia": null,
                      "seenAt": null,
                      "source": "system",
                      "title": "New sign-in",
                      "url": null,
                      "workspaceId": null
                    },
                    {
                      "archivedAt": null,
                      "body": "Session User wsgate-owner added you to Globex finance 1767225600000 as viewer.",
                      "channels": {
                        "email": {
                          "clickedAt": null,
                          "openedAt": null,
                          "status": "sent"
                        },
                        "push": {
                          "clickedAt": null,
                          "status": "none"
                        }
                      },
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "event": "workspace.member_added",
                      "icon": null,
                      "id": "000000000000000000000009",
                      "link": null,
                      "readAt": null,
                      "readVia": null,
                      "seenAt": null,
                      "source": "system",
                      "title": "Workspace Invitation",
                      "url": null,
                      "workspaceId": "000000000000000000000004"
                    },
                    {
                      "archivedAt": null,
                      "body": "Session User wsgate-owner added you to Globex support 1767225600000 as viewer.",
                      "channels": {
                        "email": {
                          "clickedAt": null,
                          "openedAt": null,
                          "status": "sent"
                        },
                        "push": {
                          "clickedAt": null,
                          "status": "none"
                        }
                      },
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "event": "workspace.member_added",
                      "icon": null,
                      "id": "000000000000000000000010",
                      "link": null,
                      "readAt": null,
                      "readVia": null,
                      "seenAt": null,
                      "source": "system",
                      "title": "Workspace Invitation",
                      "url": null,
                      "workspaceId": "000000000000000000000011"
                    },
                    {
                      "archivedAt": null,
                      "body": "Session User wsgate-owner added you to wsgate 1767225600000 as viewer.",
                      "channels": {
                        "email": {
                          "clickedAt": null,
                          "openedAt": null,
                          "status": "sent"
                        },
                        "push": {
                          "clickedAt": null,
                          "status": "none"
                        }
                      },
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "event": "workspace.member_added",
                      "icon": null,
                      "id": "000000000000000000000012",
                      "link": null,
                      "readAt": null,
                      "readVia": null,
                      "seenAt": null,
                      "source": "system",
                      "title": "Workspace Invitation",
                      "url": null,
                      "workspaceId": "000000000000000000000002"
                    },
                    {
                      "archivedAt": null,
                      "body": "Your account signed in from a new device. If this wasn't you, secure your account.",
                      "channels": {
                        "email": {
                          "clickedAt": null,
                          "openedAt": null,
                          "status": "sent"
                        },
                        "push": {
                          "clickedAt": null,
                          "status": "none"
                        }
                      },
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "event": "user.new_device_login",
                      "icon": null,
                      "id": "000000000000000000000013",
                      "link": null,
                      "readAt": null,
                      "readVia": null,
                      "seenAt": null,
                      "source": "system",
                      "title": "New device signed in",
                      "url": null,
                      "workspaceId": null
                    }
                  ],
                  "page": 1,
                  "total": 12
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/notifications.ts"
      }
    },
    "/api/v1/public/notifications/read-all": {
      "post": {
        "operationId": "notifications.readAll.create",
        "summary": "Mark all of the signed-in user's notifications as read",
        "description": "Applies to the whole inbox or to the scope named by `workspaceId`, and tells the user's other open tabs and devices to refresh.",
        "tags": [
          "Notifications"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "workspaceId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 64
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/notifications.ts"
      }
    },
    "/api/v1/public/notifications/seen": {
      "post": {
        "operationId": "notifications.seen.create",
        "summary": "Mark the signed-in user's notifications as seen",
        "description": "Clears the \"new\" badge for the inbox or the given scope without marking any item read, and tells the user's other open tabs and devices to refresh.",
        "tags": [
          "Notifications"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "workspaceId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 64
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/notifications.ts"
      }
    },
    "/api/v1/public/notifications/unread-count": {
      "get": {
        "operationId": "notifications.unreadCount.list",
        "summary": "Get the signed-in user's unread notification counts",
        "description": "Counts within the plan's email history window, for the whole inbox or the scope named by `workspaceId`.",
        "tags": [
          "Notifications"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "unread": {
                      "type": "integer"
                    },
                    "unseen": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "unread": 4,
                  "unseen": 0
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/notifications.ts"
      }
    },
    "/api/v1/public/notifications/{id}/archive": {
      "post": {
        "operationId": "notifications.archive.create",
        "summary": "Archive one of the signed-in user's notifications",
        "description": "Returns the updated notification. Answers 404 for an id that does not exist, belongs to someone else, or belongs to a workspace whose rules refuse this session.",
        "tags": [
          "Notifications"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "ObjectID"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "archivedAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "body": {
                      "type": "string"
                    },
                    "channels": {
                      "properties": {
                        "email": {
                          "properties": {
                            "clickedAt": {},
                            "openedAt": {},
                            "status": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "push": {
                          "properties": {
                            "clickedAt": {},
                            "status": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "event": {
                      "type": "string"
                    },
                    "icon": {},
                    "id": {
                      "type": "string"
                    },
                    "link": {},
                    "readAt": {},
                    "readVia": {},
                    "seenAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "source": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "url": {},
                    "workspaceId": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "archivedAt": "2026-01-01T00:00:00.000Z",
                  "body": "All green",
                  "channels": {
                    "email": {
                      "clickedAt": null,
                      "openedAt": null,
                      "status": "sent"
                    },
                    "push": {
                      "clickedAt": null,
                      "status": "none"
                    }
                  },
                  "createdAt": "2026-01-01T00:00:00.000Z",
                  "event": "e2einbox1767225600000",
                  "icon": null,
                  "id": "000000000000000000000001",
                  "link": null,
                  "readAt": null,
                  "readVia": null,
                  "seenAt": "2026-01-01T00:00:00.000Z",
                  "source": "custom",
                  "title": "Build finished",
                  "url": null,
                  "workspaceId": "000000000000000000000002"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/notifications.ts"
      },
      "delete": {
        "operationId": "notifications.archive.delete",
        "summary": "Unarchive one of the signed-in user's notifications",
        "description": "Returns the updated notification. Answers 404 for an id that does not exist, belongs to someone else, or belongs to a workspace whose rules refuse this session.",
        "tags": [
          "Notifications"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "ObjectID"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/notifications.ts"
      }
    },
    "/api/v1/public/notifications/{id}/read": {
      "post": {
        "operationId": "notifications.read.create",
        "summary": "Mark one of the signed-in user's notifications as read",
        "description": "Returns the updated notification. Answers 404 for an id that does not exist, belongs to someone else, or belongs to a workspace whose rules refuse this session.",
        "tags": [
          "Notifications"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "ObjectID"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "archivedAt": {},
                    "body": {
                      "type": "string"
                    },
                    "channels": {
                      "properties": {
                        "email": {
                          "properties": {
                            "clickedAt": {},
                            "openedAt": {},
                            "status": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "push": {
                          "properties": {
                            "clickedAt": {},
                            "status": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "event": {
                      "type": "string"
                    },
                    "icon": {},
                    "id": {
                      "type": "string"
                    },
                    "link": {},
                    "readAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "readVia": {
                      "type": "string"
                    },
                    "seenAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "source": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "url": {},
                    "workspaceId": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "archivedAt": null,
                  "body": "All green",
                  "channels": {
                    "email": {
                      "clickedAt": null,
                      "openedAt": null,
                      "status": "sent"
                    },
                    "push": {
                      "clickedAt": null,
                      "status": "none"
                    }
                  },
                  "createdAt": "2026-01-01T00:00:00.000Z",
                  "event": "e2einbox1767225600000",
                  "icon": null,
                  "id": "000000000000000000000001",
                  "link": null,
                  "readAt": "2026-01-01T00:00:00.000Z",
                  "readVia": "inbox",
                  "seenAt": "2026-01-01T00:00:00.000Z",
                  "source": "custom",
                  "title": "Build finished",
                  "url": null,
                  "workspaceId": "000000000000000000000002"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/notifications.ts"
      }
    },
    "/api/v1/public/notifications/{id}/unread": {
      "post": {
        "operationId": "notifications.unread.create",
        "summary": "Mark one of the signed-in user's notifications as unread",
        "description": "Returns the updated notification. Answers 404 for an id that does not exist, belongs to someone else, or belongs to a workspace whose rules refuse this session.",
        "tags": [
          "Notifications"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "ObjectID"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "archivedAt": {},
                    "body": {
                      "type": "string"
                    },
                    "channels": {
                      "properties": {
                        "email": {
                          "properties": {
                            "clickedAt": {},
                            "openedAt": {},
                            "status": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "push": {
                          "properties": {
                            "clickedAt": {},
                            "status": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "event": {
                      "type": "string"
                    },
                    "icon": {},
                    "id": {
                      "type": "string"
                    },
                    "link": {},
                    "readAt": {},
                    "readVia": {},
                    "seenAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "source": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "url": {},
                    "workspaceId": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "archivedAt": null,
                  "body": "All green",
                  "channels": {
                    "email": {
                      "clickedAt": null,
                      "openedAt": null,
                      "status": "sent"
                    },
                    "push": {
                      "clickedAt": null,
                      "status": "none"
                    }
                  },
                  "createdAt": "2026-01-01T00:00:00.000Z",
                  "event": "e2einbox1767225600000",
                  "icon": null,
                  "id": "000000000000000000000001",
                  "link": null,
                  "readAt": null,
                  "readVia": null,
                  "seenAt": "2026-01-01T00:00:00.000Z",
                  "source": "custom",
                  "title": "Build finished",
                  "url": null,
                  "workspaceId": "000000000000000000000002"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/notifications.ts"
      }
    },
    "/api/v1/public/passkeys": {
      "get": {
        "operationId": "passkeys.list",
        "summary": "List the signed-in person's passkeys",
        "tags": [
          "Passkeys"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "passkeys": {
                      "items": {
                        "properties": {
                          "active": {
                            "type": "boolean"
                          },
                          "backedUp": {
                            "type": "boolean"
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "deviceType": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "lastUsedAt": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "rpId": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "passkeys": [
                    {
                      "active": true,
                      "backedUp": false,
                      "createdAt": "[REDACTED]",
                      "deviceType": "[REDACTED]",
                      "id": "[REDACTED]",
                      "name": "[REDACTED]",
                      "rpId": "[REDACTED]"
                    },
                    {
                      "active": true,
                      "backedUp": false,
                      "createdAt": "[REDACTED]",
                      "deviceType": "[REDACTED]",
                      "id": "[REDACTED]",
                      "lastUsedAt": "[REDACTED]",
                      "name": "[REDACTED]",
                      "rpId": "[REDACTED]"
                    }
                  ]
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/passkeys.ts"
      }
    },
    "/api/v1/public/passkeys/{id}": {
      "delete": {
        "operationId": "passkeys.delete",
        "summary": "Remove one of the signed-in person's passkeys",
        "description": "Answers 404 for a passkey that is not the person's and 409 when it is their only way to sign in or the last passkey their company requires. Where a company governs the person, a recent passkey proof is needed first.",
        "tags": [
          "Passkeys"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/passkeys.ts"
      },
      "patch": {
        "operationId": "passkeys.update",
        "summary": "Rename one of the signed-in person's passkeys",
        "description": "Answers 404 for a passkey that is not the person's.",
        "tags": [
          "Passkeys"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 100
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "active": {
                          "type": "boolean"
                        },
                        "backedUp": {
                          "type": "boolean"
                        },
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "deviceType": {
                          "type": "string"
                        },
                        "id": {
                          "type": "string"
                        },
                        "lastUsedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "rpId": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "active": true,
                    "backedUp": false,
                    "createdAt": "2026-01-01T00:00:00.000Z",
                    "deviceType": "singleDevice",
                    "id": "000000000000000000000001",
                    "lastUsedAt": "2026-01-01T00:00:00.000Z",
                    "name": "Old phone",
                    "rpId": "localhost"
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/passkeys.ts"
      }
    },
    "/api/v1/public/profile": {
      "get": {
        "operationId": "profile.list",
        "summary": "Get the signed-in user's profile",
        "description": "Returns the caller's profile together with per-session facts: whether the email can be changed, how and when this session last proved who it is, and whether there is a password to change. Answers 404 when the user no longer exists.",
        "tags": [
          "Profile"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "amr": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "authTime": {
                      "format": "date-time",
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "canChangeEmail": {
                      "type": "boolean"
                    },
                    "claims": {
                      "properties": {
                        "plan": {
                          "type": "string"
                        },
                        "seats": {
                          "type": "string"
                        },
                        "tenant": {
                          "properties": {
                            "id": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "country": {
                      "type": "string"
                    },
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "deleteAfter": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "emailVerified": {
                      "type": "boolean"
                    },
                    "firstAuthAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "image": {
                      "type": "string"
                    },
                    "impersonation": {
                      "properties": {
                        "actorName": {
                          "type": "string"
                        },
                        "expiresAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "readOnly": {
                          "type": "boolean"
                        }
                      },
                      "type": "object"
                    },
                    "isAnonymous": {
                      "type": "boolean"
                    },
                    "language": {
                      "type": "string"
                    },
                    "mfaEnabled": {
                      "type": "boolean"
                    },
                    "name": {
                      "type": "string"
                    },
                    "passwordSet": {
                      "type": "boolean"
                    },
                    "passwordSignIn": {
                      "type": "boolean"
                    },
                    "phone": {
                      "type": "string"
                    },
                    "phoneVerified": {
                      "type": "boolean"
                    },
                    "role": {
                      "type": "string"
                    },
                    "timezone": {
                      "type": "string"
                    },
                    "username": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "amr": [
                    "pwd"
                  ],
                  "authTime": "2026-01-01T00:00:00.000Z",
                  "canChangeEmail": true,
                  "claims": {},
                  "country": "",
                  "createdAt": "2026-01-01T00:00:00.000Z",
                  "currency": "",
                  "email": "user@example.com",
                  "emailVerified": true,
                  "firstAuthAt": "2026-01-01T00:00:00.000Z",
                  "id": "000000000000000000000001",
                  "image": "http://localhost:4443/buildbase-local-assets/orgs/000000000000000000000002/assets/file-000000000000000000000003.png",
                  "isAnonymous": false,
                  "language": "",
                  "mfaEnabled": false,
                  "name": "Session User uploads-1767225600000",
                  "passwordSet": true,
                  "passwordSignIn": false,
                  "phone": "",
                  "phoneVerified": false,
                  "role": "user",
                  "timezone": "",
                  "username": ""
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/profile/index.ts"
      },
      "patch": {
        "operationId": "profile.update",
        "summary": "Update the signed-in user's profile",
        "description": "Writes the given profile fields, records a user activity entry and returns the updated user with the organization's private attributes left out. Answers 403 when `defaultWorkspaceId` names a workspace the caller is not a member of; on success a new default workspace also applies to the current session.",
        "tags": [
          "Profile"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 200
                  },
                  "country": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "language": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "currency": {
                    "type": "string",
                    "maxLength": 16
                  },
                  "timezone": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "defaultWorkspaceId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[a-fA-F0-9]{24}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "image": {
                    "type": "string",
                    "format": "an image URL of at most 2048 characters"
                  }
                },
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "_id": {
                      "type": "string"
                    },
                    "attributes": {
                      "properties": {},
                      "type": "object"
                    },
                    "blocked": {
                      "type": "boolean"
                    },
                    "blockedReason": {
                      "type": "string"
                    },
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "credentialsChangedAt": {},
                    "currency": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean"
                    },
                    "email": {
                      "type": "string"
                    },
                    "emailVerified": {
                      "type": "boolean"
                    },
                    "firstAuthAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "image": {
                      "type": "string"
                    },
                    "isAgent": {
                      "type": "boolean"
                    },
                    "kind": {
                      "type": "string"
                    },
                    "language": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "orgMembershipId": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string"
                    },
                    "stripeId": {
                      "type": "string"
                    },
                    "systemTags": {
                      "type": "array"
                    },
                    "tags": {
                      "type": "array"
                    },
                    "timezone": {
                      "type": "string"
                    },
                    "updatedAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "workflowsDisabled": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "_id": "000000000000000000000001",
                  "attributes": {},
                  "blocked": false,
                  "blockedReason": "",
                  "createdAt": "2026-01-01T00:00:00.000Z",
                  "credentialsChangedAt": null,
                  "currency": "",
                  "deleted": false,
                  "email": "user@example.com",
                  "emailVerified": true,
                  "firstAuthAt": "2026-01-01T00:00:00.000Z",
                  "id": "000000000000000000000001",
                  "image": "http://localhost:4443/buildbase-local-assets/orgs/000000000000000000000002/assets/file-000000000000000000000003.png",
                  "isAgent": false,
                  "kind": "human",
                  "language": "",
                  "name": "Session User uploads-1767225600000",
                  "orgMembershipId": "",
                  "role": "user",
                  "stripeId": "",
                  "systemTags": [],
                  "tags": [],
                  "timezone": "",
                  "updatedAt": "2026-01-01T00:00:00.000Z",
                  "workflowsDisabled": false
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/profile/index.ts",
        "x-events": [
          "user.profile_updated"
        ]
      }
    },
    "/api/v1/public/profile/email": {
      "post": {
        "operationId": "profile.email.create",
        "summary": "Send a code to confirm a new email address",
        "description": "Emails a confirmation code to the new address; the account's address does not change until the code is confirmed. Needs a recent sign-in (403 `reauth_required`) unless the caller is a guest, who is refused with 409 `guest_account`. Answers 409 when the address is taken or unchanged, 400 for a disposable address, 429 during the resend cooldown or recipient limit, and 503 when no code could be sent.",
        "tags": [
          "Profile"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "newEmail": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 320
                  }
                },
                "required": [
                  "newEmail"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/profile/index.ts"
      }
    },
    "/api/v1/public/profile/email/confirm": {
      "post": {
        "operationId": "profile.email.confirm.create",
        "summary": "Confirm an email change with the emailed code",
        "description": "Changes the account's email to the confirmed address, marks it verified, and emails a notice to the old address; existing sessions stay signed in. Needs a recent sign-in unless the caller is a guest. Answers 400 for a wrong code, 410 for an expired code and 409 when the address was taken meanwhile.",
        "tags": [
          "Profile"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 12
                  }
                },
                "required": [
                  "code"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/profile/index.ts",
        "x-events": [
          "user.email_changed"
        ]
      }
    },
    "/api/v1/public/profile/password": {
      "post": {
        "operationId": "profile.password.create",
        "summary": "Change the signed-in user's password",
        "description": "Checks the current password, which counts toward the per-account sign-in lockout, then stores the new one, ends every other session of the user and retires outstanding login tokens; the calling session stays. Answers 400 for a wrong current password or a breached new one, 429 when the account is locked, and 409 `password_not_set` for an account that signs in without a password.",
        "tags": [
          "Profile"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "currentPassword": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256
                  },
                  "newPassword": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 256
                  }
                },
                "required": [
                  "currentPassword",
                  "newPassword"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "message": "Password updated successfully.",
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/profile/index.ts",
        "x-events": [
          "user.password_changed"
        ]
      }
    },
    "/api/v1/public/profile/phone": {
      "post": {
        "operationId": "profile.phone.create",
        "summary": "Send a code to confirm a phone number to add",
        "description": "Sends a verification code by SMS, WhatsApp or voice to the number; the account changes only once the code is confirmed. Needs a recent sign-in unless the caller is a guest. Answers 400 for an invalid number or a channel not offered, 409 when the number belongs to another account or text codes are the user's second sign-in step, and 503 when SMS is not configured.",
        "tags": [
          "Profile"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "phone": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32
                  },
                  "channel": {
                    "type": "string",
                    "enum": [
                      "sms",
                      "whatsapp",
                      "voice"
                    ]
                  }
                },
                "required": [
                  "phone"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "retryAfter": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "retryAfter": 30
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/profile/index.ts"
      },
      "delete": {
        "operationId": "profile.phone.delete",
        "summary": "Remove the phone number from the signed-in user's account",
        "description": "Needs a recent sign-in (403 `reauth_required`). Answers 404 when there is no phone, and 409 while text-message codes are the user's second sign-in step or when the phone is the last way to sign in.",
        "tags": [
          "Profile"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/profile/index.ts",
        "x-events": [
          "user.phone_removed"
        ]
      }
    },
    "/api/v1/public/profile/phone/confirm": {
      "post": {
        "operationId": "profile.phone.confirm.create",
        "summary": "Confirm a phone number with the sent code",
        "description": "Puts the number on the account as verified. Needs a recent sign-in unless the caller is a guest. Answers 400 for a wrong code, 410 for an expired code, and 409 when the number was taken meanwhile or text codes are the user's second sign-in step.",
        "tags": [
          "Profile"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 10
                  }
                },
                "required": [
                  "code"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "phone": {
                          "type": "string"
                        },
                        "phoneVerified": {
                          "type": "boolean"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "phone": "+14155555122",
                    "phoneVerified": true
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "otp",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/profile/index.ts",
        "x-events": [
          "user.phone_added",
          "user.phone_verified"
        ]
      }
    },
    "/api/v1/public/profile/username": {
      "put": {
        "operationId": "profile.username.update",
        "summary": "Set or change the signed-in user's username",
        "description": "Answers 400 `usernames_off` when the organization has usernames turned off, 400 for an invalid username and 409 when it is taken by another user.",
        "tags": [
          "Profile"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "username": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "required": [
                  "username"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "username": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "data": {
                    "username": "blocked-80636061"
                  },
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/profile/index.ts"
      },
      "delete": {
        "operationId": "profile.username.delete",
        "summary": "Remove the signed-in user's username",
        "description": "Answers 409 `username_required` when the organization requires a username. Succeeds without change when the user has none.",
        "tags": [
          "Profile"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/profile/index.ts"
      }
    },
    "/api/v1/public/push/subscribe": {
      "post": {
        "operationId": "push.subscribe.create",
        "summary": "Register a web push subscription for the signed-in user",
        "description": "Stores or refreshes the browser subscription by endpoint; an endpoint held by another user is moved to the caller as a new subscription. A newly created subscription gets a welcome notification when the organization's push is on. Answers 400 for an endpoint host that is not accepted, and 503 when the organization's subscriber ceiling refuses a new subscription.",
        "tags": [
          "Push"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "endpoint": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024,
                    "pattern": "^https://"
                  },
                  "keys": {
                    "type": "object",
                    "properties": {
                      "p256dh": {
                        "type": "string",
                        "minLength": 80,
                        "maxLength": 128,
                        "pattern": "^[A-Za-z0-9_-]+={0,2}$"
                      },
                      "auth": {
                        "type": "string",
                        "minLength": 16,
                        "maxLength": 64,
                        "pattern": "^[A-Za-z0-9_-]+={0,2}$"
                      }
                    },
                    "required": [
                      "p256dh",
                      "auth"
                    ],
                    "additionalProperties": false
                  },
                  "userAgent": {
                    "type": "string",
                    "maxLength": 512
                  },
                  "expirationTime": {
                    "type": [
                      "number",
                      "null"
                    ]
                  }
                },
                "required": [
                  "endpoint",
                  "keys"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/push/index.ts"
      }
    },
    "/api/v1/public/push/subscriptions": {
      "get": {
        "operationId": "push.subscriptions.list",
        "summary": "List the signed-in user's push subscriptions",
        "tags": [
          "Push"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/push/index.ts"
      }
    },
    "/api/v1/public/push/unsubscribe": {
      "delete": {
        "operationId": "push.unsubscribe.delete",
        "summary": "Remove a push subscription by endpoint",
        "description": "Answers 400 when no endpoint is given and 403 when the endpoint belongs to another user.",
        "tags": [
          "Push"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "endpoint": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 1024
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/push/index.ts"
      }
    },
    "/api/v1/public/push/vapid-public-key": {
      "get": {
        "operationId": "push.vapidPublicKey.list",
        "summary": "Get the organization's VAPID public key for web push",
        "description": "Creates the organization's VAPID key pair on first request when the plan does not exclude push; an existing key is always served. Answers 503 when no key exists and the plan excludes push.",
        "tags": [
          "Push"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/push/index.ts"
      }
    },
    "/api/v1/public/session": {
      "get": {
        "operationId": "session.list",
        "summary": "Get how the current session began and was last confirmed",
        "tags": [
          "Session"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "amr": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "authTime": {
                      "format": "date-time",
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "reverifiable": {
                      "type": "boolean"
                    },
                    "signInMethod": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "amr": [
                    "federated",
                    "sso"
                  ],
                  "authTime": "2026-01-01T00:00:00.000Z",
                  "reverifiable": true,
                  "signInMethod": "sso"
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/session.ts"
      }
    },
    "/api/v1/public/session/reverify": {
      "post": {
        "operationId": "session.reverify.create",
        "summary": "Start re-confirming who the signed-in person is",
        "description": "Answers a hosted sign-in URL bound to this session; no new session is made. A company step-up (any of `codeChallenge`, `workspaceId`, `methods` or `purpose`) needs a valid S256 code challenge, else 400 `invalid_request`.",
        "tags": [
          "Session"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "returnUrl": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048
                  },
                  "codeChallenge": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{43,128}$",
                    "maxLength": 128
                  },
                  "workspaceId": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$",
                    "maxLength": 24
                  },
                  "methods": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 2,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "enum": [
                        "sso",
                        "passkey"
                      ],
                      "maxLength": 16
                    }
                  },
                  "purpose": {
                    "type": "string",
                    "enum": [
                      "settings",
                      "workspace"
                    ]
                  },
                  "factors": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "mfa"
                      ],
                      "maxLength": 16
                    },
                    "maxItems": 1,
                    "uniqueItems": true
                  }
                },
                "required": [
                  "returnUrl"
                ],
                "if": {
                  "properties": {
                    "purpose": {
                      "const": "workspace"
                    }
                  },
                  "required": [
                    "purpose"
                  ]
                },
                "then": {
                  "required": [
                    "workspaceId"
                  ]
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "success": true,
                  "url": "http://localhost:4103/v1/login?state=[REDACTED]&intent=reverify"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/session.ts"
      }
    },
    "/api/v1/public/session/reverify/complete": {
      "post": {
        "operationId": "session.reverify.complete.create",
        "summary": "Complete a step-up re-confirmation with its code and verifier",
        "description": "Writes the proof beside this session only when the code was made for it and the verifier matches the start's challenge. The code is single-use; any refusal answers 400 `invalid_reverify_code`.",
        "tags": [
          "Session"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "codeVerifier": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  }
                },
                "required": [
                  "code",
                  "codeVerifier"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/session.ts"
      }
    },
    "/api/v1/public/sessions": {
      "get": {
        "operationId": "sessions.list",
        "summary": "List the signed-in person's active sessions",
        "tags": [
          "Sessions"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "sessions": {
                      "items": {
                        "properties": {
                          "clientId": {
                            "type": "string"
                          },
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "current": {
                            "type": "boolean"
                          },
                          "device": {
                            "properties": {
                              "name": {
                                "type": "string"
                              }
                            },
                            "type": [
                              "null",
                              "object"
                            ]
                          },
                          "deviceId": {
                            "type": "string"
                          },
                          "expiresAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "ip": {
                            "type": "string"
                          },
                          "ipInfo": {
                            "properties": {
                              "ip": {
                                "type": "string"
                              }
                            },
                            "type": [
                              "null",
                              "object"
                            ]
                          },
                          "issuedBy": {
                            "properties": {
                              "appKeyName": {
                                "type": "string"
                              },
                              "kind": {
                                "type": "string"
                              }
                            },
                            "type": [
                              "null",
                              "object"
                            ]
                          },
                          "lastActiveAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "method": {
                            "type": "string"
                          },
                          "origin": {
                            "type": "string"
                          },
                          "userAgent": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "sessions": [
                    {
                      "clientId": "Ibu9DY7diz1Voakp3WtCJBJ88o3V6HxHyCXiZ3qn",
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "current": true,
                      "device": {
                        "name": "Unknown device"
                      },
                      "deviceId": "dv_18f33f53aead81b8d8f10109a231c321",
                      "expiresAt": "2026-01-01T00:00:00.000Z",
                      "id": "000000000000000000000001",
                      "ip": "127.0.0.1",
                      "ipInfo": {
                        "ip": "127.0.0.1"
                      },
                      "issuedBy": null,
                      "lastActiveAt": "2026-01-01T00:00:00.000Z",
                      "method": "password",
                      "origin": "",
                      "userAgent": "undefined"
                    },
                    {
                      "clientId": "Ibu9DY7diz1Voakp3WtCJBJ88o3V6HxHyCXiZ3qn",
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "current": false,
                      "device": {
                        "name": "Unknown device"
                      },
                      "deviceId": "dv_18f33f53aead81b8d8f10109a231c321",
                      "expiresAt": "2026-01-01T00:00:00.000Z",
                      "id": "000000000000000000000002",
                      "ip": "127.0.0.1",
                      "ipInfo": {
                        "ip": "127.0.0.1"
                      },
                      "issuedBy": null,
                      "lastActiveAt": "2026-01-01T00:00:00.000Z",
                      "method": "password",
                      "origin": "",
                      "userAgent": "undefined"
                    }
                  ]
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/sessions.ts"
      }
    },
    "/api/v1/public/sessions/{id}": {
      "delete": {
        "operationId": "sessions.delete",
        "summary": "Sign out one of the signed-in person's sessions",
        "description": "Revokes the session by its public id. Answers 404 for a session that is not the person's.",
        "tags": [
          "Sessions"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/sessions.ts"
      }
    },
    "/api/v1/public/token/exchange": {
      "post": {
        "operationId": "token.exchange.create",
        "summary": "Exchange an org API token for a session id",
        "description": "No session: the API token is the credential. Creates a session for the token's user, or for `userId`, which only an owner or admin key may name (403 otherwise); `workspaceId` must be a workspace the user belongs to. Answers 403 when the org's API keys are suspended or the person's company refuses app-team sessions.",
        "tags": [
          "Token"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string",
                    "minLength": 3
                  },
                  "userId": {
                    "type": "string"
                  },
                  "workspaceId": {
                    "type": "string"
                  },
                  "expiresIn": {
                    "type": "number",
                    "minimum": 60,
                    "maximum": 2592000
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 200
                  }
                },
                "required": [
                  "token"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "expiresIn": {
                      "type": "integer"
                    },
                    "orgId": {
                      "type": "string"
                    },
                    "sessionId": {
                      "type": "string"
                    },
                    "userId": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "expiresIn": 2592000,
                  "orgId": "000000000000000000000001",
                  "sessionId": "3dECcGbWlgffaUwhk4tzxXmLF829m45t1lH",
                  "userId": "000000000000000000000002"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "token-exchange",
            "windowMs": 60000,
            "max": 120,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/index.ts",
        "x-events": [
          "enterprise.app_team_session"
        ]
      }
    },
    "/api/v1/public/uploads": {
      "post": {
        "operationId": "uploads.create",
        "summary": "Start a direct upload for a workspace or profile image",
        "description": "Reserves the organization's storage and returns a signed URL to PUT the file to; the file is public once completed. Answers 400 for a purpose other than `workspace-image` or `profile-image`, 403 when the organization has end-user uploads off or the file would take the user past their storage limit, 429 when too many uploads were started, and 503 when the organization's plan refuses it.",
        "tags": [
          "Uploads"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 1024
                  },
                  "size": {
                    "type": "number"
                  },
                  "contentType": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "purpose": {
                    "type": "string",
                    "maxLength": 64
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "expiresAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "headers": {
                      "properties": {
                        "Content-Type": {
                          "type": "string"
                        },
                        "x-goog-content-length-range": {
                          "type": "string"
                        },
                        "x-goog-if-generation-match": {
                          "type": "string"
                        },
                        "x-goog-meta-org-id": {
                          "type": "string"
                        },
                        "x-goog-meta-upload-id": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "maxBytes": {
                      "type": "integer"
                    },
                    "method": {
                      "type": "string"
                    },
                    "mode": {
                      "type": "string"
                    },
                    "uploadId": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "expiresAt": "2026-01-01T00:00:00.000Z",
                  "headers": {
                    "Content-Type": "image/png",
                    "x-goog-content-length-range": "0,12000",
                    "x-goog-if-generation-match": "0",
                    "x-goog-meta-org-id": "000000000000000000000001",
                    "x-goog-meta-upload-id": "000000000000000000000002"
                  },
                  "maxBytes": 12000,
                  "method": "PUT",
                  "mode": "direct",
                  "uploadId": "000000000000000000000002",
                  "url": "http://localhost:4443/buildbase-local-staging/000000000000000000000001/000000000000000000000002?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=[REDACTED]&X-Goog-Date=20261111T070815Z&X-Goog-Expires=900&X-Goog-SignedHeaders=content-type%3Bhost%3Bx-goog-content-length-range%3Bx-goog-if-generation-match%3Bx-goog-meta-org-id%3Bx-goog-meta-upload-id&X-Goog-Signature=[REDACTED]"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/uploads.ts"
      }
    },
    "/api/v1/public/uploads/{id}/complete": {
      "post": {
        "operationId": "uploads.complete.create",
        "summary": "Complete a direct upload and get the stored file",
        "description": "Checks the uploaded file and returns its id, public URL and image dimensions. Only the end user who started the upload can complete it. Answers 409 when the file has not arrived yet or is still being checked, and 404 for an unknown upload.",
        "tags": [
          "Uploads"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "height": {
                      "type": "integer"
                    },
                    "id": {
                      "type": "string"
                    },
                    "mimeType": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "size": {
                      "type": "integer"
                    },
                    "url": {
                      "type": "string"
                    },
                    "width": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "height": 1,
                  "id": "000000000000000000000001",
                  "mimeType": "image/png",
                  "name": "logo.png",
                  "size": 12000,
                  "url": "http://localhost:4443/buildbase-local-assets/orgs/000000000000000000000002/assets/file-000000000000000000000001.png",
                  "width": 1
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/uploads.ts"
      }
    },
    "/api/v1/public/users/attributes": {
      "get": {
        "operationId": "users.attributes.list",
        "summary": "Get the signed-in user's attribute values",
        "description": "Returns every attribute the organization makes publicly viewable, with the user's value or the attribute's default, plus any undeclared attributes the user holds. Attributes the organization keeps private are left out.",
        "tags": [
          "Users"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {},
                  "type": "object"
                },
                "example": {},
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/users/index.ts"
      },
      "patch": {
        "operationId": "users.attributes.update",
        "summary": "Update several of the signed-in user's attributes",
        "description": "Merges the given values into the user's attributes and records the change history. Declared attributes that do not allow public edit, and reserved keys, are skipped; undeclared keys are stored as sent, so never treat an attribute as an authorization signal. Answers 400 for a value of the wrong type or when the resulting attribute set exceeds its limits.",
        "tags": [
          "Users"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "attributes": {
                    "type": "object",
                    "maxProperties": 100,
                    "propertyNames": {
                      "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$"
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 1024
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "attributes"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "_id": {
                      "type": "string"
                    },
                    "attributes": {
                      "properties": {},
                      "type": "object"
                    },
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "emailVerified": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    },
                    "image": {
                      "type": "string"
                    },
                    "language": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string"
                    },
                    "timezone": {
                      "type": "string"
                    },
                    "updatedAt": {
                      "format": "date-time",
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "_id": "000000000000000000000001",
                  "attributes": {},
                  "createdAt": "2026-01-01T00:00:00.000Z",
                  "currency": "",
                  "email": "user@example.com",
                  "emailVerified": true,
                  "id": "000000000000000000000001",
                  "image": "",
                  "language": "",
                  "name": "Session User exposure-old-attrs",
                  "role": "user",
                  "timezone": "",
                  "updatedAt": "2026-01-01T00:00:00.000Z"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/users/index.ts",
        "x-events": [
          "user.profile_updated"
        ]
      }
    },
    "/api/v1/public/users/attributes/{attributeKey}": {
      "patch": {
        "operationId": "users.attributes.byAttributeKey.update",
        "summary": "Update one of the signed-in user's attributes",
        "description": "Answers 403 for a reserved key or a declared attribute that does not allow public edit, and 400 for a value of the wrong type or when the resulting attribute set exceeds its limits.",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "name": "attributeKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1024
                      },
                      {
                        "type": "number"
                      },
                      {
                        "type": "boolean"
                      }
                    ]
                  }
                },
                "required": [
                  "value"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/users/index.ts",
        "x-events": [
          "user.profile_updated"
        ]
      }
    },
    "/api/v1/public/users/by-email": {
      "post": {
        "operationId": "users.byEmail.create",
        "summary": "Look up a user in the organization by email",
        "description": "Returns the user's id, email and name. Only a session from the API key token exchange, or the organization's owner or an admin, may call it (403 otherwise); answers 404 when no user has the address. Rate limited.",
        "tags": [
          "Users"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 320
                  }
                },
                "required": [
                  "email"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "_id": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "_id": "000000000000000000000001",
                  "email": "user@example.com",
                  "name": "Session User exposure-backend"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "user-lookup",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/users/index.ts"
      }
    },
    "/api/v1/public/users/features": {
      "get": {
        "operationId": "users.features.list",
        "summary": "Get the feature flags enabled for the signed-in user",
        "description": "Returns a map of feature id to `true` for each enabled flag that is on for this user.",
        "tags": [
          "Users"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/users/features/index.ts"
      }
    },
    "/api/v1/public/workspaces": {
      "get": {
        "operationId": "workspaces.list",
        "summary": "List the workspaces the signed-in user belongs to",
        "description": "Starts any workspace that never held a plan on the org's onboarding plan, and hides workspaces a company keeps the caller out of. When the user has none and the org auto-creates a first workspace, this call creates it (subject to the same caps as a create) and returns it; a refused auto-create returns an empty list.",
        "tags": [
          "Workspaces"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/index.ts",
        "x-events": [
          "workspace.created"
        ]
      },
      "post": {
        "operationId": "workspaces.create",
        "summary": "Create a workspace owned by the signed-in user",
        "description": "The caller becomes its admin and the workspace starts on the org's onboarding plan. Refused with 403 when the org disables creation or with 402 `PLAN_LIMIT_REACHED` at a plan ceiling, 409 `BUSY` while another create runs for the same user, and 409 when the user already has a workspace with that `name`.",
        "tags": [
          "Workspaces"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 200,
                    "pattern": "\\S"
                  },
                  "image": {
                    "type": "string",
                    "format": "an image URL of at most 2048 characters"
                  },
                  "trackingAttribution": {
                    "type": "object",
                    "properties": {
                      "params": {
                        "type": "object",
                        "maxProperties": 30,
                        "propertyNames": {
                          "pattern": "^[a-z_]{2,32}$"
                        },
                        "additionalProperties": {
                          "type": "string",
                          "pattern": "^[\\w.~-]{1,200}$"
                        }
                      },
                      "capturedAt": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "landingUrl": {
                        "type": "string",
                        "maxLength": 500
                      }
                    },
                    "required": [],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "_id": {
                      "type": "string"
                    },
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "createdBy": {
                      "type": "string"
                    },
                    "creditBalance": {
                      "type": "integer"
                    },
                    "deleted": {
                      "type": "boolean"
                    },
                    "features": {
                      "properties": {},
                      "type": "object"
                    },
                    "image": {
                      "type": "string"
                    },
                    "limits": {
                      "properties": {},
                      "type": "object"
                    },
                    "name": {
                      "type": "string"
                    },
                    "quotas": {
                      "properties": {},
                      "type": "object"
                    },
                    "roles": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "updatedAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "users": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "workflowsDisabled": {
                      "type": "boolean"
                    },
                    "workspaceId": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "_id": "000000000000000000000001",
                  "createdAt": "2026-01-01T00:00:00.000Z",
                  "createdBy": "000000000000000000000002",
                  "creditBalance": 0,
                  "deleted": false,
                  "features": {},
                  "image": "http://localhost:4443/buildbase-local-assets/orgs/000000000000000000000003/assets/file-000000000000000000000004.png",
                  "limits": {},
                  "name": "Uploads 1767225600000",
                  "quotas": {},
                  "roles": [
                    "admin",
                    "editor",
                    "viewer"
                  ],
                  "updatedAt": "2026-01-01T00:00:00.000Z",
                  "users": [
                    "000000000000000000000002"
                  ],
                  "workflowsDisabled": false,
                  "workspaceId": "PkImO1Hc0R7DL1h"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/index.ts",
        "x-events": [
          "workspace.created"
        ]
      }
    },
    "/api/v1/public/workspaces/features": {
      "get": {
        "operationId": "workspaces.features.list",
        "summary": "List the workspace features members can toggle",
        "description": "Returns the org's enabled features that are user-managed and not controlled by the subscription plan, with their defaults and categories.",
        "tags": [
          "Workspaces"
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/index.ts"
      }
    },
    "/api/v1/public/workspaces/settings": {
      "patch": {
        "operationId": "workspaces.settings.update",
        "summary": "Refuses a change to the organization's workspace settings",
        "description": "The organization's workspace settings (the default permissions of every workspace) are changed by the app owner in the console, never from an app. This route always answers 403 `WORKSPACE_SETTINGS_ORG_WIDE` and changes nothing; it exists so the SDK's `updateWorkspaceSettings(data)` gets that answer instead of a 404. To change one workspace's permissions, call `PATCH /api/v1/public/workspaces/{workspaceId}/permissions` (`updateWorkspacePermissions`).",
        "tags": [
          "Workspaces"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}": {
      "get": {
        "operationId": "workspaces.get",
        "summary": "Get one workspace the signed-in user belongs to",
        "description": "Returns 404 when the caller is not a member. A workspace that never held a plan is started on the org's onboarding plan first.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/index.ts"
      },
      "put": {
        "operationId": "workspaces.update",
        "summary": "Update a workspace's name or image",
        "description": "Needs `workspace:settings:edit`. A new `name` is also copied to the workspace's Stripe customer. Refused with 402 `PLAN_LIMIT_REACHED` while the workspace's plan is read-only after a payment lapse.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 200,
                    "pattern": "\\S"
                  },
                  "image": {
                    "type": "string",
                    "format": "an image URL of at most 2048 characters"
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/index.ts",
        "x-events": [
          "workspace.updated"
        ]
      },
      "delete": {
        "operationId": "workspaces.delete",
        "summary": "Delete a workspace",
        "description": "Only the workspace owner (its creator) may delete it; other members get 403. Refused with 403 while it has an active subscription or when it is the user's only workspace in a single-workspace org, and with 409 `PAID_GRANTS_PRESENT` when the org blocks deleting a workspace that still holds paid add-ons or credits.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/index.ts",
        "x-events": [
          "workspace.deleted"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/affiliate-programs": {
      "get": {
        "operationId": "workspaces.affiliatePrograms.list",
        "summary": "List the workspace's affiliate programs",
        "description": "Needs `workspace:selling:view`. Lists only programs the workspace runs as a seller. A workspace that has not started selling gets 404 `SELLER_NOT_FOUND`, and 503 `SELLING_UNAVAILABLE` when selling is off on the server.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "sellerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/affiliate-programs/index.ts"
      },
      "post": {
        "operationId": "workspaces.affiliatePrograms.create",
        "summary": "Create an affiliate program for the workspace's items",
        "description": "Needs `workspace:selling:manage`. Refused with 409 `AFFILIATE_REFUSED` when the app does not let sellers run affiliate programs, and with 422 `AFFILIATE_REFUSED` when the workspace already has as many programs as allowed.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 1000
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "percent",
                      "fixed"
                    ]
                  },
                  "percentBps": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "fixedAmount": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 99999999
                  },
                  "currency": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-zA-Z]{3}$"
                  },
                  "recurrence": {
                    "type": "string",
                    "enum": [
                      "first",
                      "all",
                      "count"
                    ]
                  },
                  "recurringPayments": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 36
                  },
                  "windowDays": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 365
                  },
                  "holdDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 120
                  },
                  "join": {
                    "type": "string",
                    "enum": [
                      "open",
                      "approval",
                      "invite"
                    ]
                  },
                  "payoutMethod": {
                    "type": "string",
                    "enum": [
                      "transfer",
                      "manual",
                      "paypal",
                      "wise_export"
                    ]
                  },
                  "minPayout": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 99999999
                  },
                  "itemIds": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  },
                  "active": {
                    "type": "boolean"
                  },
                  "payoutMethods": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 4,
                    "items": {
                      "type": "string",
                      "enum": [
                        "transfer",
                        "manual",
                        "paypal",
                        "wise_export"
                      ]
                    }
                  },
                  "tiers": {
                    "type": "array",
                    "maxItems": 5,
                    "items": {
                      "type": "object",
                      "properties": {
                        "threshold": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 999999999
                        },
                        "percentBps": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 10000
                        },
                        "fixedAmount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 99999999
                        }
                      },
                      "required": [
                        "threshold"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "tierMetric": {
                    "type": "string",
                    "enum": [
                      "paid_referrals",
                      "revenue"
                    ]
                  },
                  "tierCurrency": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-zA-Z]{3}$"
                  },
                  "tierPeriod": {
                    "type": "string",
                    "enum": [
                      "lifetime",
                      "calendar_month",
                      "calendar_quarter",
                      "rolling_30d"
                    ]
                  },
                  "tierApply": {
                    "type": "string",
                    "enum": [
                      "forward",
                      "retroactive"
                    ]
                  },
                  "codeAttribution": {
                    "type": "string",
                    "enum": [
                      "coupon_wins",
                      "link_wins"
                    ]
                  },
                  "couponRateBps": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "codeOnlyAttribution": {
                    "type": "boolean"
                  },
                  "levels": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 2
                  },
                  "levelBps": {
                    "type": "array",
                    "maxItems": 2,
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 10000
                    }
                  },
                  "levelBasis": {
                    "type": "string",
                    "enum": [
                      "commission",
                      "net"
                    ]
                  },
                  "levelsAcknowledged": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name",
                  "kind"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/affiliate-programs/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/affiliate-programs/affiliates/{id}/approve": {
      "post": {
        "operationId": "workspaces.affiliatePrograms.affiliates.approve.create",
        "summary": "Approve a pending affiliate of one of the workspace's programs",
        "description": "Needs `workspace:selling:manage`. Moves a `pending` affiliate to `active` and stores the optional `note`. Any other status, an affiliate whose account was deleted, or a concurrent change answers 409 `AFFILIATE_REFUSED`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/affiliate-programs/index.ts",
        "x-events": [
          "affiliate.status_changed",
          "affiliate.approved"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/affiliate-programs/affiliates/{id}/ban": {
      "post": {
        "operationId": "workspaces.affiliatePrograms.affiliates.ban.create",
        "summary": "Ban an affiliate of one of the workspace's programs",
        "description": "Needs `workspace:selling:manage`. Works on a `pending`, `active` or `paused` affiliate (409 `AFFILIATE_REFUSED` otherwise) and voids their pending and approved commissions that are not yet in a payout.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/affiliate-programs/index.ts",
        "x-events": [
          "affiliate.status_changed",
          "commission.reversed"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/affiliate-programs/affiliates/{id}/pause": {
      "post": {
        "operationId": "workspaces.affiliatePrograms.affiliates.pause.create",
        "summary": "Pause an active affiliate of one of the workspace's programs",
        "description": "Needs `workspace:selling:manage`. Moves an `active` affiliate to `paused`; any other status answers 409 `AFFILIATE_REFUSED`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/affiliate-programs/index.ts",
        "x-events": [
          "affiliate.status_changed"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/affiliate-programs/affiliates/{id}/resume": {
      "post": {
        "operationId": "workspaces.affiliatePrograms.affiliates.resume.create",
        "summary": "Resume a paused affiliate of one of the workspace's programs",
        "description": "Needs `workspace:selling:manage`. Moves a `paused` affiliate back to `active`. Any other status, or an affiliate whose account was deleted, answers 409 `AFFILIATE_REFUSED`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/affiliate-programs/index.ts",
        "x-events": [
          "affiliate.status_changed",
          "affiliate.approved"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/affiliate-programs/payouts/wise.csv": {
      "get": {
        "operationId": "workspaces.byWorkspaceId.affiliatePrograms.payouts.wiseCsv.list",
        "summary": "Download the Wise batch file of the workspace's pending Wise payouts",
        "description": "Needs `workspace:selling:manage`, since the CSV carries affiliates' bank details; each download is audited. Payouts already in an earlier file are left out unless `again=true` (counted in `X-Already-Exported`), and payouts whose affiliate gave no bank details are named in `X-Missing-Bank-Details`. Included payouts are stamped as exported, except for a read-only session.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "again",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "programId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/affiliate-programs/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/affiliate-programs/payouts/{id}/mark-paid": {
      "post": {
        "operationId": "workspaces.affiliatePrograms.payouts.markPaid.create",
        "summary": "Mark a manual or Wise payout as paid",
        "description": "Needs `workspace:selling:manage`; idempotent with an idempotency key. Records the `reference` and marks the payout's commissions paid. A payout that is not pending, or is sent by PayPal or transfer, answers 409 `AFFILIATE_REFUSED`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reference": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "reference"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/affiliate-programs/index.ts",
        "x-events": [
          "commission.paid"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/affiliate-programs/payouts/{id}/wise.csv": {
      "get": {
        "operationId": "workspaces.byWorkspaceId.affiliatePrograms.payouts.byId.wiseCsv.list",
        "summary": "Download the Wise batch file of one pending Wise payout",
        "description": "Needs `workspace:selling:manage`; each download is audited. A payout already in a downloaded file answers 409 `PAYOUT_ALREADY_EXPORTED` unless `again=true`. The payout is stamped as exported, except for a read-only session.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "again",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "programId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/affiliate-programs/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/affiliate-programs/{id}": {
      "get": {
        "operationId": "workspaces.affiliatePrograms.get",
        "summary": "Get one of the workspace's affiliate programs",
        "description": "Needs `workspace:selling:view`. Another owner's program answers 404.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/affiliate-programs/index.ts"
      },
      "delete": {
        "operationId": "workspaces.affiliatePrograms.delete",
        "summary": "Delete one of the workspace's affiliate programs",
        "description": "Needs `workspace:selling:manage`. No new click, join or sale counts for the program afterwards; commissions already earned stay and are paid out as before.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/affiliate-programs/index.ts"
      },
      "patch": {
        "operationId": "workspaces.affiliatePrograms.update",
        "summary": "Update one of the workspace's affiliate programs",
        "description": "Needs `workspace:selling:manage`. A partial change to the rate, tiers or levels is checked together with the stored values.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 1000
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "percent",
                      "fixed"
                    ]
                  },
                  "percentBps": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "fixedAmount": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 99999999
                  },
                  "currency": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-zA-Z]{3}$"
                  },
                  "recurrence": {
                    "type": "string",
                    "enum": [
                      "first",
                      "all",
                      "count"
                    ]
                  },
                  "recurringPayments": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 36
                  },
                  "windowDays": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 365
                  },
                  "holdDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 120
                  },
                  "join": {
                    "type": "string",
                    "enum": [
                      "open",
                      "approval",
                      "invite"
                    ]
                  },
                  "payoutMethod": {
                    "type": "string",
                    "enum": [
                      "transfer",
                      "manual",
                      "paypal",
                      "wise_export"
                    ]
                  },
                  "minPayout": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 99999999
                  },
                  "itemIds": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  },
                  "active": {
                    "type": "boolean"
                  },
                  "payoutMethods": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 4,
                    "items": {
                      "type": "string",
                      "enum": [
                        "transfer",
                        "manual",
                        "paypal",
                        "wise_export"
                      ]
                    }
                  },
                  "tiers": {
                    "type": "array",
                    "maxItems": 5,
                    "items": {
                      "type": "object",
                      "properties": {
                        "threshold": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 999999999
                        },
                        "percentBps": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 10000
                        },
                        "fixedAmount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 99999999
                        }
                      },
                      "required": [
                        "threshold"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "tierMetric": {
                    "type": "string",
                    "enum": [
                      "paid_referrals",
                      "revenue"
                    ]
                  },
                  "tierCurrency": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-zA-Z]{3}$"
                  },
                  "tierPeriod": {
                    "type": "string",
                    "enum": [
                      "lifetime",
                      "calendar_month",
                      "calendar_quarter",
                      "rolling_30d"
                    ]
                  },
                  "tierApply": {
                    "type": "string",
                    "enum": [
                      "forward",
                      "retroactive"
                    ]
                  },
                  "codeAttribution": {
                    "type": "string",
                    "enum": [
                      "coupon_wins",
                      "link_wins"
                    ]
                  },
                  "couponRateBps": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "codeOnlyAttribution": {
                    "type": "boolean"
                  },
                  "levels": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 2
                  },
                  "levelBps": {
                    "type": "array",
                    "maxItems": 2,
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 10000
                    }
                  },
                  "levelBasis": {
                    "type": "string",
                    "enum": [
                      "commission",
                      "net"
                    ]
                  },
                  "levelsAcknowledged": {
                    "type": "boolean"
                  }
                },
                "minProperties": 1,
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/affiliate-programs/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/affiliate-programs/{id}/affiliates": {
      "get": {
        "operationId": "workspaces.affiliatePrograms.affiliates.list",
        "summary": "List the affiliates of one of the workspace's programs",
        "description": "Needs `workspace:selling:view`. Filterable by `status`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "programId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "active",
                "paused",
                "banned"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/affiliate-programs/index.ts"
      },
      "post": {
        "operationId": "workspaces.affiliatePrograms.affiliates.create",
        "summary": "Add a person to an affiliate program directly (refused for workspaces)",
        "description": "Never succeeds. Needs `workspace:selling:manage`, then answers 403 `AFFILIATE_INVITE_NOT_ALLOWED` (a seller cannot add a person directly), or 404 `SELLER_NOT_FOUND` when the workspace has not started selling. Invite the person with `POST /api/v1/public/workspaces/{workspaceId}/affiliate-programs/{id}/invitations` instead (`workspaces.affiliatePrograms.invitations.create`); they join once they accept.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "userId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "required": [
                  "userId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/affiliate-programs/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/affiliate-programs/{id}/commissions": {
      "get": {
        "operationId": "workspaces.affiliatePrograms.commissions.list",
        "summary": "List the commissions of one of the workspace's programs",
        "description": "Needs `workspace:selling:view`. Filterable by `affiliateId`, `orderId` and `status`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "affiliateId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "orderId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "programId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "approved",
                "paid",
                "reversed",
                "void"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/affiliate-programs/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/affiliate-programs/{id}/invitations": {
      "post": {
        "operationId": "workspaces.affiliatePrograms.invitations.create",
        "summary": "Invite a person to one of the workspace's affiliate programs",
        "description": "Needs `workspace:selling:manage`. Takes an `email` or a `userId` and always answers 202 `{ invited: true }`, whoever is named; the person accepts from their own invitations. A program that is off answers 409 `AFFILIATE_REFUSED`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "userId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "email": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 254,
                    "pattern": "^[^@\\s]+@[^@\\s]+$"
                  }
                },
                "oneOf": [
                  {
                    "required": [
                      "userId"
                    ]
                  },
                  {
                    "required": [
                      "email"
                    ]
                  }
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/affiliate-programs/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/affiliate-programs/{id}/payouts": {
      "get": {
        "operationId": "workspaces.affiliatePrograms.payouts.list",
        "summary": "List the payouts of one of the workspace's programs",
        "description": "Needs `workspace:selling:view`. Filterable by `affiliateId`, `status` and `method`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "affiliateId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "method",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "transfer",
                "manual",
                "paypal",
                "wise_export"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "programId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "paid",
                "failed"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/affiliate-programs/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/billing/add-ons/{grantId}/cancel": {
      "post": {
        "operationId": "workspaces.billing.addOns.cancel.create",
        "summary": "Remove a recurring add-on from the workspace subscription",
        "description": "Needs `workspace:billing:manage`. Takes the add-on's item off the subscription now with no proration; what was paid applies until `removeAt`, the period end, and asking again answers the removal already made. An optional `expectedQuantity` that no longer matches is refused 409 `QUANTITY_CHANGED`; an optional `Idempotency-Key` sent again answers the first request.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedQuantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000000
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "addon-purchase",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/billing/index.ts",
        "x-events": [
          "addon.revoked"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/billing/add-ons/{grantId}/cancel/preview": {
      "post": {
        "operationId": "workspaces.billing.addOns.cancel.preview.create",
        "summary": "Preview removing a recurring add-on",
        "description": "Needs `workspace:billing:manage`. Answers the next invoice before and after, `removeAt` and the `entitlementChanges` from then, with the same refusals as the cancel. Writes nothing.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "subscription-preview",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/billing/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/billing/add-ons/{grantId}/decrease": {
      "post": {
        "operationId": "workspaces.billing.addOns.decrease.create",
        "summary": "Lower the quantity of a recurring add-on",
        "description": "Needs `workspace:billing:manage`. Takes `quantity` units off the subscription item now with no proration; the units taken off apply until the period end, and taking all of them removes the add-on. An optional `expectedQuantity` that no longer matches is refused 409 `QUANTITY_CHANGED`; an optional `Idempotency-Key` sent again answers the first decrease.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  },
                  "expectedQuantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000000
                  }
                },
                "required": [
                  "quantity"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "addon-purchase",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/billing/index.ts",
        "x-events": [
          "addon.changed",
          "addon.revoked"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/billing/add-ons/{grantId}/decrease/preview": {
      "post": {
        "operationId": "workspaces.billing.addOns.decrease.preview.create",
        "summary": "Preview lowering the quantity of a recurring add-on",
        "description": "Needs `workspace:billing:manage`. Answers the next invoice before and after, when the units taken off stop applying and what the workspace loses then. Same refusals as the decrease; writes nothing.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  }
                },
                "required": [
                  "quantity"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "subscription-preview",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/billing/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/billing/add-ons/{grantId}/future-versions": {
      "post": {
        "operationId": "workspaces.billing.addOns.futureVersions.create",
        "summary": "Opt a lifetime add-on out of or back into future versions",
        "description": "Needs `workspace:billing:manage`. `optOut: true` keeps what the licence holds and takes no later version; `optOut: false` brings it at once to the version other licences were given. Moves no money; refused 409 with `future_versions_not_included` or `not_held`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "optOut": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "optOut"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "addon-purchase",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/billing/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/billing/add-ons/{grantId}/upgrade": {
      "get": {
        "operationId": "workspaces.billing.addOns.upgrade.list",
        "summary": "Quote upgrading a one-time or lifetime add-on to its current version",
        "description": "Needs `workspace:billing:manage`. Answers the versions, the full price, the credit for what was paid, the amount due and what changes. Writes nothing.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "subscription-preview",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/billing/index.ts"
      },
      "post": {
        "operationId": "workspaces.billing.addOns.upgrade.create",
        "summary": "Upgrade a one-time or lifetime add-on to its current version",
        "description": "Needs `workspace:billing:manage`. Opens a Checkout session for the amount due, or with nothing due makes the upgrade now (`kind: 'upgraded'`). Keyed on the body's `requestId`, so a retry answers what the first made; a reused `requestId` is 409 `IDEMPOTENCY_KEY_REUSED`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "requestId": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 100,
                    "pattern": "^[A-Za-z0-9._:-]+$"
                  },
                  "successUrl": {
                    "type": "string",
                    "format": "uri",
                    "maxLength": 2000
                  },
                  "cancelUrl": {
                    "type": "string",
                    "format": "uri",
                    "maxLength": 2000
                  },
                  "uiMode": {
                    "type": "string",
                    "enum": [
                      "hosted",
                      "embedded"
                    ]
                  },
                  "returnUrl": {
                    "type": "string",
                    "format": "uri",
                    "maxLength": 2000
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "maxProperties": 20
                  }
                },
                "required": [
                  "requestId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "addon-purchase",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/billing/index.ts",
        "x-events": [
          "addon.purchased"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/billing/checkout": {
      "post": {
        "operationId": "workspaces.billing.checkout.create",
        "summary": "Buy an add-on for the workspace",
        "description": "Needs `workspace:billing:manage`. A recurring add-on is added to the workspace's own subscription (`added` or `payment_required`); any other add-on gets a Stripe Checkout session. Refused 404 for an unknown offer, 409 when the plan does not sell it or the per-workspace cap is reached, and 409 `STRIPE_NOT_CONNECTED` when the org has no Stripe.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "offerSlug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  },
                  "currency": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 3
                  },
                  "promotionCode": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "successUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "cancelUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "uiMode": {
                    "type": "string",
                    "enum": [
                      "hosted",
                      "embedded"
                    ]
                  },
                  "returnUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "prorationDate": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "maxProperties": 20
                  }
                },
                "required": [
                  "offerSlug"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "addon-purchase",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/billing/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/billing/checkout/preview": {
      "post": {
        "operationId": "workspaces.billing.checkout.preview.create",
        "summary": "Preview the cost of buying a recurring add-on",
        "description": "Needs `workspace:billing:manage`. Answers what is due today, the next invoice and a `prorationDate` to send back on the purchase. Refused 404 when no recurring add-on with that `offerSlug` is on sale; writes nothing.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "offerSlug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  }
                },
                "required": [
                  "offerSlug"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "subscription-preview",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/billing/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/billing/offers": {
      "get": {
        "operationId": "workspaces.billing.offers.list",
        "summary": "List the add-ons on sale to the workspace",
        "description": "Open to any workspace member. Each offer is priced in the workspace's currency (or `currency` from the query), with the rows the workspace holds from it and whether it can be bought now.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/billing/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/billing/payment-method/default": {
      "post": {
        "operationId": "workspaces.billing.paymentMethod.default.create",
        "summary": "Make a saved card the workspace's default payment method",
        "description": "Needs `workspace:billing:manage`. Takes the `setupIntentId` of a confirmed SetupIntent and sets its card on the workspace's subscription and automatic top-up, and on the Stripe customer only when no other subject is billed on it.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "setupIntentId": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 255,
                    "pattern": "^seti_[A-Za-z0-9]+$"
                  }
                },
                "required": [
                  "setupIntentId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "payment-method",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/billing/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/billing/payment-method/setup": {
      "post": {
        "operationId": "workspaces.billing.paymentMethod.setup.create",
        "summary": "Start a card setup for the workspace",
        "description": "Needs `workspace:billing:manage`. Creates a Stripe SetupIntent for a card and answers its client secret and the org's publishable key, for the SDK to confirm with Stripe.js. Accepts an `Idempotency-Key`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "payment-method",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/billing/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/calendars": {
      "get": {
        "operationId": "workspaces.calendars.list",
        "summary": "List the workspace's shared booking calendars",
        "description": "Needs `workspace:selling:view`. A workspace that has not started selling gets 404 `SELLER_NOT_FOUND`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/calendars/index.ts"
      },
      "post": {
        "operationId": "workspaces.calendars.create",
        "summary": "Create a shared booking calendar for the workspace",
        "description": "Needs `workspace:selling:manage`. An invalid grid, or a seller already at the calendar limit, answers 422 `CALENDAR_REFUSED`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "timeZone": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "slotMinutes": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 720
                  },
                  "bufferMinutes": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 240
                  },
                  "bufferBeforeMinutes": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 240
                  },
                  "seatsPerSlot": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000
                  },
                  "weekly": {
                    "type": "object",
                    "properties": {
                      "mon": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "tue": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "wed": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "thu": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "fri": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "sat": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "sun": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "additionalProperties": false
                  },
                  "exceptions": {
                    "type": "array",
                    "maxItems": 200,
                    "items": {
                      "type": "object",
                      "properties": {
                        "date": {
                          "type": "string",
                          "maxLength": 10
                        },
                        "windows": {
                          "type": "array",
                          "maxItems": 6,
                          "items": {
                            "type": "object",
                            "properties": {
                              "from": {
                                "type": "string",
                                "maxLength": 5
                              },
                              "to": {
                                "type": "string",
                                "maxLength": 5
                              }
                            },
                            "required": [
                              "from",
                              "to"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "date",
                        "windows"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "capacityModel": {
                    "type": "string",
                    "enum": [
                      "shared_pool",
                      "item_caps",
                      "exclusive"
                    ]
                  },
                  "moveConflicts": {
                    "type": "string",
                    "enum": [
                      "refuse",
                      "overbook"
                    ]
                  },
                  "bookingLimits": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "perDay": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "perWeek": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "maximum": 1000
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "name",
                  "timeZone",
                  "slotMinutes",
                  "weekly"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/calendars/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/calendars/{id}": {
      "get": {
        "operationId": "workspaces.calendars.get",
        "summary": "Get one of the workspace's calendars with the items booked on it",
        "description": "Needs `workspace:selling:view`. Another seller's calendar answers 404 `CALENDAR_NOT_FOUND`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/calendars/index.ts"
      },
      "put": {
        "operationId": "workspaces.calendars.update",
        "summary": "Replace a calendar's name, grid and settings",
        "description": "Needs `workspace:selling:manage`. Changing the zone, slot length or buffer while a booking has not ended, or cutting seats below those taken, answers 422 `CALENDAR_REFUSED`; a concurrent change answers 409 `ORDER_STATE_CONFLICT`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "timeZone": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "slotMinutes": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 720
                  },
                  "bufferMinutes": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 240
                  },
                  "bufferBeforeMinutes": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 240
                  },
                  "seatsPerSlot": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000
                  },
                  "weekly": {
                    "type": "object",
                    "properties": {
                      "mon": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "tue": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "wed": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "thu": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "fri": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "sat": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "sun": {
                        "type": "array",
                        "maxItems": 6,
                        "items": {
                          "type": "object",
                          "properties": {
                            "from": {
                              "type": "string",
                              "maxLength": 5
                            },
                            "to": {
                              "type": "string",
                              "maxLength": 5
                            }
                          },
                          "required": [
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "additionalProperties": false
                  },
                  "exceptions": {
                    "type": "array",
                    "maxItems": 200,
                    "items": {
                      "type": "object",
                      "properties": {
                        "date": {
                          "type": "string",
                          "maxLength": 10
                        },
                        "windows": {
                          "type": "array",
                          "maxItems": 6,
                          "items": {
                            "type": "object",
                            "properties": {
                              "from": {
                                "type": "string",
                                "maxLength": 5
                              },
                              "to": {
                                "type": "string",
                                "maxLength": 5
                              }
                            },
                            "required": [
                              "from",
                              "to"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "date",
                        "windows"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "capacityModel": {
                    "type": "string",
                    "enum": [
                      "shared_pool",
                      "item_caps",
                      "exclusive"
                    ]
                  },
                  "moveConflicts": {
                    "type": "string",
                    "enum": [
                      "refuse",
                      "overbook"
                    ]
                  },
                  "bookingLimits": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "perDay": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "perWeek": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "maximum": 1000
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "name",
                  "timeZone",
                  "slotMinutes",
                  "weekly"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/calendars/index.ts"
      },
      "delete": {
        "operationId": "workspaces.calendars.delete",
        "summary": "Delete a calendar that no item is booked on",
        "description": "Needs `workspace:selling:manage`. A calendar with items booked on it answers 422 `CALENDAR_REFUSED`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/calendars/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/coupons": {
      "get": {
        "operationId": "workspaces.coupons.list",
        "summary": "List the workspace's coupons",
        "description": "Needs `workspace:selling:view`. Lists only coupons the workspace owns as a seller.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/coupons/index.ts"
      },
      "post": {
        "operationId": "workspaces.coupons.create",
        "summary": "Create a coupon for the workspace's items",
        "description": "Needs `workspace:selling:manage`. Invalid terms answer 422 `COUPON_INVALID`; a code another coupon has answers 409 `COUPON_CODE_TAKEN`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 32
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "percent",
                      "amount"
                    ]
                  },
                  "percentBps": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "amount": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 99999999
                  },
                  "currency": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-zA-Z]{3}$"
                  },
                  "duration": {
                    "type": "string",
                    "enum": [
                      "once",
                      "repeating",
                      "forever"
                    ]
                  },
                  "durationPeriods": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 36
                  },
                  "maxRedemptions": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 1000000
                  },
                  "perBuyerOnce": {
                    "type": "boolean"
                  },
                  "startsAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 40
                  },
                  "endsAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 40
                  },
                  "minSubtotal": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 99999999
                  },
                  "itemIds": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  },
                  "active": {
                    "type": "boolean"
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200
                  },
                  "affiliateId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-f0-9]{24}$"
                  }
                },
                "required": [
                  "code",
                  "kind"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/coupons/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/coupons/{id}": {
      "get": {
        "operationId": "workspaces.coupons.get",
        "summary": "Get one of the workspace's coupons",
        "description": "Needs `workspace:selling:view`. Another owner's coupon answers 404 `COUPON_NOT_FOUND`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/coupons/index.ts"
      },
      "delete": {
        "operationId": "workspaces.coupons.delete",
        "summary": "Delete one of the workspace's coupons",
        "description": "Needs `workspace:selling:manage`. No new checkout can use it; checkouts already holding it keep their discount, and its code is free again.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/coupons/index.ts"
      },
      "patch": {
        "operationId": "workspaces.coupons.update",
        "summary": "Update the terms of one of the workspace's coupons",
        "description": "Needs `workspace:selling:manage`. The `code` and `kind` stay as created; invalid terms answer 422 `COUPON_INVALID`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "percentBps": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "amount": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 99999999
                  },
                  "currency": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-zA-Z]{3}$"
                  },
                  "duration": {
                    "type": "string",
                    "enum": [
                      "once",
                      "repeating",
                      "forever"
                    ]
                  },
                  "durationPeriods": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 36
                  },
                  "maxRedemptions": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 1000000
                  },
                  "perBuyerOnce": {
                    "type": "boolean"
                  },
                  "startsAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 40
                  },
                  "endsAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 40
                  },
                  "minSubtotal": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 99999999
                  },
                  "itemIds": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  },
                  "active": {
                    "type": "boolean"
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200
                  },
                  "affiliateId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-f0-9]{24}$"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/coupons/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/credits": {
      "get": {
        "operationId": "workspaces.credits.list",
        "summary": "Get the workspace's credit balance",
        "description": "Needs `workspace:billing:view`. Answers `available`, `held`, the granted, consumed, expired and refunded totals, and the automatic top-up switch and threshold.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "autoTopUp": {
                      "properties": {
                        "enabled": {
                          "type": "boolean"
                        },
                        "pausedReason": {},
                        "threshold": {}
                      },
                      "type": "object"
                    },
                    "available": {
                      "type": "integer"
                    },
                    "held": {
                      "type": "integer"
                    },
                    "totalConsumed": {
                      "type": "integer"
                    },
                    "totalExpired": {
                      "type": "integer"
                    },
                    "totalGranted": {
                      "type": "integer"
                    },
                    "totalRefunded": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "autoTopUp": {
                    "enabled": false,
                    "pausedReason": null,
                    "threshold": null
                  },
                  "available": 40,
                  "held": 0,
                  "totalConsumed": 860,
                  "totalExpired": 0,
                  "totalGranted": 900,
                  "totalRefunded": 0
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/credits/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/credits/auto-top-up": {
      "get": {
        "operationId": "workspaces.credits.autoTopUp.list",
        "summary": "Get the workspace's automatic credit top-up setting",
        "description": "Needs `workspace:billing:view`. Answers the setting, its pack priced in the workspace's currency, this month's count and the card the next top-up charges.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/credits/index.ts"
      },
      "patch": {
        "operationId": "workspaces.credits.autoTopUp.update",
        "summary": "Update the workspace's automatic credit top-up setting",
        "description": "Needs `workspace:billing:manage`. Refused 400 for a pack not on sale or with no price in the workspace's currency, or switching on without a threshold or a pack, and 409 where the org collects tax. Switching on with no card saves it paused.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "threshold": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "creditPackageId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "monthlyCap": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50
                  },
                  "resume": {
                    "type": "boolean"
                  },
                  "acceptVersion": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  }
                },
                "additionalProperties": false,
                "minProperties": 1
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/credits/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/credits/buckets": {
      "get": {
        "operationId": "workspaces.credits.buckets.list",
        "summary": "List the workspace's credit buckets",
        "description": "Needs `workspace:billing:view`. Paginated, newest first, filterable by `status` and `source`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1
            }
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "docs": {
                      "items": {
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "activatedAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "creditAmount": {
                            "type": "integer"
                          },
                          "creditPackage": {
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "creditAmount": {
                                "type": "integer"
                              },
                              "name": {
                                "type": "string"
                              },
                              "slug": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "creditPackageVersion": {
                            "type": "string"
                          },
                          "deleted": {
                            "type": "boolean"
                          },
                          "expiresAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "grantedBy": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "metadata": {
                            "properties": {},
                            "type": "object"
                          },
                          "orgId": {
                            "type": "string"
                          },
                          "remaining": {
                            "type": "integer"
                          },
                          "source": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "subjectId": {
                            "type": "string"
                          },
                          "subjectType": {
                            "type": "string"
                          },
                          "updatedAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "workspace": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "hasNextPage": {
                      "type": "boolean"
                    },
                    "hasPrevPage": {
                      "type": "boolean"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "nextPage": {},
                    "page": {
                      "type": "integer"
                    },
                    "pagingCounter": {
                      "type": "integer"
                    },
                    "prevPage": {},
                    "totalDocs": {
                      "type": "integer"
                    },
                    "totalPages": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "docs": [
                    {
                      "_id": "000000000000000000000001",
                      "activatedAt": "2026-01-01T00:00:00.000Z",
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "creditAmount": 200,
                      "creditPackage": {
                        "_id": "000000000000000000000002",
                        "creditAmount": 200,
                        "name": "Credit 200",
                        "slug": "credit-200-1767225600000"
                      },
                      "creditPackageVersion": "000000000000000000000002",
                      "deleted": false,
                      "expiresAt": "2026-01-01T00:00:00.000Z",
                      "grantedBy": "000000000000000000000003",
                      "id": "000000000000000000000001",
                      "metadata": {},
                      "orgId": "000000000000000000000004",
                      "remaining": 40,
                      "source": "admin_grant",
                      "status": "active",
                      "subjectId": "000000000000000000000005",
                      "subjectType": "workspace",
                      "updatedAt": "2026-01-01T00:00:00.000Z",
                      "workspace": "000000000000000000000005"
                    },
                    {
                      "_id": "000000000000000000000006",
                      "activatedAt": "2026-01-01T00:00:00.000Z",
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "creditAmount": 500,
                      "creditPackage": {
                        "_id": "000000000000000000000007",
                        "creditAmount": 500,
                        "name": "Credit 500",
                        "slug": "credit-500-1767225600000"
                      },
                      "creditPackageVersion": "000000000000000000000007",
                      "deleted": false,
                      "grantedBy": "000000000000000000000003",
                      "id": "000000000000000000000006",
                      "metadata": {},
                      "orgId": "000000000000000000000004",
                      "remaining": 500,
                      "source": "admin_grant",
                      "status": "active",
                      "subjectId": "000000000000000000000005",
                      "subjectType": "workspace",
                      "updatedAt": "2026-01-01T00:00:00.000Z",
                      "workspace": "000000000000000000000005"
                    }
                  ],
                  "hasNextPage": false,
                  "hasPrevPage": false,
                  "limit": 10,
                  "nextPage": null,
                  "page": 1,
                  "pagingCounter": 1,
                  "prevPage": null,
                  "totalDocs": 2,
                  "totalPages": 1
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/credits/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/credits/consume": {
      "post": {
        "operationId": "workspaces.credits.consume.create",
        "summary": "Consume credits from the workspace balance",
        "description": "Needs `workspace:usage:record`. Refused 402 with `available` and `requested` when the balance cannot cover `amount`, and 402 `PLAN_REQUIRED` when the app requires a plan and the workspace has none. An `idempotencyKey` in the body guards against a double spend.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "number",
                    "minimum": 1
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "metadata": {
                    "type": "object",
                    "maxProperties": 10
                  }
                },
                "required": [
                  "amount"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "balanceAfter": {
                      "type": "integer"
                    },
                    "consumed": {
                      "type": "integer"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "balanceAfter": 550,
                  "consumed": 100,
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "credit",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/credits/index.ts",
        "x-events": [
          "credit.consumed",
          "credit.low_balance"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/credits/expiring": {
      "get": {
        "operationId": "workspaces.credits.expiring.list",
        "summary": "List credits expiring soon",
        "description": "Needs `workspace:billing:view`. Answers the active buckets with credits left that expire within `days` (from the query, 1 to 90), and their total.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/credits/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/credits/holds": {
      "get": {
        "operationId": "workspaces.credits.holds.list",
        "summary": "List the workspace's credit holds",
        "description": "Needs `workspace:billing:view`. Paginated, newest first, optionally filtered by `status`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "held",
                "settling",
                "settled",
                "released",
                "expired"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/credits/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/credits/holds/{holdId}/release": {
      "post": {
        "operationId": "workspaces.credits.holds.release.create",
        "summary": "Release a credit hold in full",
        "description": "Needs `workspace:usage:record`. Returns all held credits to the balance. Refused 404 `HOLD_NOT_FOUND` and 409 `HOLD_NOT_OPEN`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "holdId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "credit-hold",
            "windowMs": 60000,
            "max": 60,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/credits/index.ts",
        "x-events": [
          "credit.released"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/credits/holds/{holdId}/settle": {
      "post": {
        "operationId": "workspaces.credits.holds.settle.create",
        "summary": "Settle a credit hold at its final cost",
        "description": "Needs `workspace:usage:record`. Less than held returns the rest, more takes the extra (402 when it is not there, the hold left open), and zero releases the hold. Refused 404 `HOLD_NOT_FOUND` and 409 `HOLD_NOT_OPEN`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "holdId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "number",
                    "minimum": 0
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "metadata": {
                    "type": "object",
                    "maxProperties": 10
                  }
                },
                "required": [
                  "amount"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "credit-hold",
            "windowMs": 60000,
            "max": 60,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/credits/index.ts",
        "x-events": [
          "credit.consumed",
          "credit.settled"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/credits/packages": {
      "get": {
        "operationId": "workspaces.credits.packages.list",
        "summary": "List the credit packages on sale",
        "description": "Needs `workspace:billing:view`. Lists active, unarchived packages with a price above zero, in the org's sort order.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "docs": {
                      "items": {
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "archived": {
                            "type": "boolean"
                          },
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "creditAmount": {
                            "type": "integer"
                          },
                          "deleted": {
                            "type": "boolean"
                          },
                          "id": {
                            "type": "string"
                          },
                          "isActive": {
                            "type": "boolean"
                          },
                          "metadata": {
                            "properties": {},
                            "type": "object"
                          },
                          "name": {
                            "type": "string"
                          },
                          "pricingVariants": {
                            "items": {
                              "properties": {
                                "amount": {
                                  "type": "integer"
                                },
                                "currency": {
                                  "type": "string"
                                }
                              },
                              "type": "object"
                            },
                            "type": "array"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "sortOrder": {
                            "type": "integer"
                          },
                          "updatedAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "validityDays": {
                            "type": "integer"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "hasNextPage": {
                      "type": "boolean"
                    },
                    "hasPrevPage": {
                      "type": "boolean"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "nextPage": {},
                    "page": {
                      "type": "integer"
                    },
                    "pagingCounter": {
                      "type": "integer"
                    },
                    "prevPage": {},
                    "totalDocs": {
                      "type": "integer"
                    },
                    "totalPages": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "docs": [
                    {
                      "_id": "000000000000000000000001",
                      "archived": false,
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "creditAmount": 50,
                      "deleted": false,
                      "id": "000000000000000000000001",
                      "isActive": true,
                      "metadata": {},
                      "name": "Credit 50",
                      "pricingVariants": [
                        {
                          "amount": 499,
                          "currency": "usd"
                        }
                      ],
                      "slug": "credit-50-1767225600000",
                      "sortOrder": 0,
                      "updatedAt": "2026-01-01T00:00:00.000Z"
                    },
                    {
                      "_id": "000000000000000000000002",
                      "archived": false,
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "creditAmount": 100,
                      "deleted": false,
                      "id": "000000000000000000000002",
                      "isActive": true,
                      "metadata": {},
                      "name": "Credit 100",
                      "pricingVariants": [
                        {
                          "amount": 999,
                          "currency": "usd"
                        }
                      ],
                      "slug": "credit-100-1767225600000",
                      "sortOrder": 0,
                      "updatedAt": "2026-01-01T00:00:00.000Z"
                    },
                    {
                      "_id": "000000000000000000000003",
                      "archived": false,
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "creditAmount": 200,
                      "deleted": false,
                      "id": "000000000000000000000003",
                      "isActive": true,
                      "metadata": {},
                      "name": "Credit 200",
                      "pricingVariants": [
                        {
                          "amount": 1999,
                          "currency": "usd"
                        }
                      ],
                      "slug": "credit-200-1767225600000",
                      "sortOrder": 0,
                      "updatedAt": "2026-01-01T00:00:00.000Z",
                      "validityDays": 30
                    },
                    {
                      "_id": "000000000000000000000004",
                      "archived": false,
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "creditAmount": 500,
                      "deleted": false,
                      "id": "000000000000000000000004",
                      "isActive": true,
                      "metadata": {},
                      "name": "Credit 500",
                      "pricingVariants": [
                        {
                          "amount": 4999,
                          "currency": "usd"
                        }
                      ],
                      "slug": "credit-500-1767225600000",
                      "sortOrder": 0,
                      "updatedAt": "2026-01-01T00:00:00.000Z"
                    },
                    {
                      "_id": "000000000000000000000005",
                      "archived": false,
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "creditAmount": 500,
                      "deleted": false,
                      "id": "000000000000000000000005",
                      "isActive": true,
                      "metadata": {},
                      "name": "500 Credits Pack",
                      "pricingVariants": [
                        {
                          "amount": 3999,
                          "currency": "usd"
                        },
                        {
                          "amount": 3699,
                          "currency": "eur"
                        }
                      ],
                      "slug": "500-credits",
                      "sortOrder": 2,
                      "updatedAt": "2026-01-01T00:00:00.000Z",
                      "validityDays": 30
                    }
                  ],
                  "hasNextPage": false,
                  "hasPrevPage": false,
                  "limit": 5,
                  "nextPage": null,
                  "page": 1,
                  "pagingCounter": 1,
                  "prevPage": null,
                  "totalDocs": 5,
                  "totalPages": 1
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/credits/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/credits/payment-method-setup": {
      "post": {
        "operationId": "workspaces.credits.paymentMethodSetup.create",
        "summary": "Start a Stripe page that saves a card for credit top-ups",
        "description": "Needs `workspace:billing:manage`. Creates a Stripe session that saves a card without charging it. Accepts an `Idempotency-Key`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "successUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "cancelUrl": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/credits/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/credits/purchase": {
      "post": {
        "operationId": "workspaces.credits.purchase.create",
        "summary": "Start a Stripe Checkout session for a credit package",
        "description": "Needs `workspace:billing:manage`. Refused 400 for a package that cannot be bought, an invalid promotion code or an unpriced currency, and 409 `STRIPE_NOT_CONNECTED` when the org has no Stripe. Accepts an `Idempotency-Key`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "creditPackageId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "currency": {
                    "type": "string",
                    "minLength": 2
                  },
                  "successUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "cancelUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "maxProperties": 20
                  },
                  "promotionCode": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "uiMode": {
                    "type": "string",
                    "enum": [
                      "hosted",
                      "embedded"
                    ]
                  },
                  "returnUrl": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": [
                  "creditPackageId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/credits/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/credits/reserve": {
      "post": {
        "operationId": "workspaces.credits.reserve.create",
        "summary": "Put workspace credits on hold",
        "description": "Needs `workspace:usage:record`. Reserves `amount` for work whose cost is not known yet, for up to `ttlSeconds`. Refused 402 `INSUFFICIENT_CREDITS` when the balance cannot cover it, and 402 `PLAN_REQUIRED` when the app requires a plan and the workspace has none.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "number",
                    "minimum": 1
                  },
                  "ttlSeconds": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 86400
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "metadata": {
                    "type": "object",
                    "maxProperties": 10
                  }
                },
                "required": [
                  "amount"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "credit-hold",
            "windowMs": 60000,
            "max": 60,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/credits/index.ts",
        "x-events": [
          "credit.reserved",
          "credit.low_balance"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/credits/transactions": {
      "get": {
        "operationId": "workspaces.credits.transactions.list",
        "summary": "List the workspace's credit transactions",
        "description": "Needs `workspace:billing:view`. Paginated, newest first, optionally filtered by `type`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "docs": {
                      "items": {
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "actor": {
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "email": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "amount": {
                            "type": "integer"
                          },
                          "balanceAfter": {
                            "type": "integer"
                          },
                          "bucket": {
                            "type": "string"
                          },
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "creditPackage": {
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "creditAmount": {
                                "type": "integer"
                              },
                              "name": {
                                "type": "string"
                              },
                              "slug": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "creditPackageVersion": {
                            "type": "string"
                          },
                          "deleted": {
                            "type": "boolean"
                          },
                          "description": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "metadata": {
                            "properties": {},
                            "type": "object"
                          },
                          "subjectId": {
                            "type": "string"
                          },
                          "subjectType": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "updatedAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "workspace": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "hasNextPage": {
                      "type": "boolean"
                    },
                    "hasPrevPage": {
                      "type": "boolean"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "nextPage": {},
                    "page": {
                      "type": "integer"
                    },
                    "pagingCounter": {
                      "type": "integer"
                    },
                    "prevPage": {},
                    "totalDocs": {
                      "type": "integer"
                    },
                    "totalPages": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "docs": [
                    {
                      "_id": "000000000000000000000001",
                      "actor": {
                        "_id": "000000000000000000000002",
                        "email": "user@example.com",
                        "name": "Session User credits"
                      },
                      "amount": -10,
                      "balanceAfter": 540,
                      "bucket": "000000000000000000000003",
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "creditPackage": {
                        "_id": "000000000000000000000004",
                        "creditAmount": 200,
                        "name": "Credit 200",
                        "slug": "credit-200-1767225600000"
                      },
                      "creditPackageVersion": "000000000000000000000004",
                      "deleted": false,
                      "description": "Idempotent",
                      "id": "000000000000000000000001",
                      "metadata": {},
                      "subjectId": "000000000000000000000005",
                      "subjectType": "workspace",
                      "type": "consumed",
                      "updatedAt": "2026-01-01T00:00:00.000Z",
                      "workspace": "000000000000000000000005"
                    },
                    {
                      "_id": "000000000000000000000006",
                      "actor": {
                        "_id": "000000000000000000000002",
                        "email": "user@example.com",
                        "name": "Session User credits"
                      },
                      "amount": -100,
                      "balanceAfter": 550,
                      "bucket": "000000000000000000000003",
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "creditPackage": {
                        "_id": "000000000000000000000004",
                        "creditAmount": 200,
                        "name": "Credit 200",
                        "slug": "credit-200-1767225600000"
                      },
                      "creditPackageVersion": "000000000000000000000004",
                      "deleted": false,
                      "description": "Premium export",
                      "id": "000000000000000000000006",
                      "metadata": {},
                      "subjectId": "000000000000000000000005",
                      "subjectType": "workspace",
                      "type": "consumed",
                      "updatedAt": "2026-01-01T00:00:00.000Z",
                      "workspace": "000000000000000000000005"
                    },
                    {
                      "_id": "000000000000000000000007",
                      "actor": {
                        "_id": "000000000000000000000002",
                        "email": "user@example.com",
                        "name": "Session User credits"
                      },
                      "amount": -50,
                      "balanceAfter": 650,
                      "bucket": "000000000000000000000003",
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "creditPackage": {
                        "_id": "000000000000000000000004",
                        "creditAmount": 200,
                        "name": "Credit 200",
                        "slug": "credit-200-1767225600000"
                      },
                      "creditPackageVersion": "000000000000000000000004",
                      "deleted": false,
                      "description": "AI generation",
                      "id": "000000000000000000000007",
                      "metadata": {},
                      "subjectId": "000000000000000000000005",
                      "subjectType": "workspace",
                      "type": "consumed",
                      "updatedAt": "2026-01-01T00:00:00.000Z",
                      "workspace": "000000000000000000000005"
                    },
                    {
                      "_id": "000000000000000000000008",
                      "actor": {
                        "_id": "000000000000000000000009",
                        "email": "user@example.com",
                        "name": "E2E Admin 1767225600000"
                      },
                      "amount": 200,
                      "balanceAfter": 700,
                      "bucket": "000000000000000000000003",
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "creditPackage": {
                        "_id": "000000000000000000000004",
                        "creditAmount": 200,
                        "name": "Credit 200",
                        "slug": "credit-200-1767225600000"
                      },
                      "creditPackageVersion": "000000000000000000000004",
                      "deleted": false,
                      "description": "Topup with 30-day validity",
                      "id": "000000000000000000000008",
                      "metadata": {},
                      "subjectId": "000000000000000000000005",
                      "subjectType": "workspace",
                      "type": "admin_grant",
                      "updatedAt": "2026-01-01T00:00:00.000Z",
                      "workspace": "000000000000000000000005"
                    },
                    {
                      "_id": "000000000000000000000010",
                      "actor": {
                        "_id": "000000000000000000000009",
                        "email": "user@example.com",
                        "name": "E2E Admin 1767225600000"
                      },
                      "amount": 500,
                      "balanceAfter": 500,
                      "bucket": "000000000000000000000011",
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "creditPackage": {
                        "_id": "000000000000000000000012",
                        "creditAmount": 500,
                        "name": "Credit 500",
                        "slug": "credit-500-1767225600000"
                      },
                      "creditPackageVersion": "000000000000000000000012",
                      "deleted": false,
                      "description": "Initial grant",
                      "id": "000000000000000000000010",
                      "metadata": {},
                      "subjectId": "000000000000000000000005",
                      "subjectType": "workspace",
                      "type": "admin_grant",
                      "updatedAt": "2026-01-01T00:00:00.000Z",
                      "workspace": "000000000000000000000005"
                    }
                  ],
                  "hasNextPage": false,
                  "hasPrevPage": false,
                  "limit": 10,
                  "nextPage": null,
                  "page": 1,
                  "pagingCounter": 1,
                  "prevPage": null,
                  "totalDocs": 5,
                  "totalPages": 1
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/credits/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise": {
      "get": {
        "operationId": "workspaces.enterprise.list",
        "summary": "Get the enterprise SSO status of a workspace",
        "description": "Needs `workspace:settings:view`. Returns the company bound to this workspace (its sign-in connections, directory provisioning, certificate, domains, audit log setting, IT contacts and the groups the caller manages) and what the caller may do, area by area. Answers 404 `{ available: false }` when no enterprise is bound; `?refresh=1` re-reads the connections from the app owner's WorkOS account.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "access": {
                      "properties": {
                        "activity": {
                          "type": "string"
                        },
                        "admins": {
                          "type": "string"
                        },
                        "apps": {
                          "type": "string"
                        },
                        "groups": {
                          "type": "string"
                        },
                        "insights": {
                          "type": "string"
                        },
                        "keys": {
                          "type": "string"
                        },
                        "people": {
                          "type": "string"
                        },
                        "policy": {
                          "type": "string"
                        },
                        "setup": {
                          "type": "string"
                        },
                        "streams": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "admins": {
                      "properties": {
                        "named": {
                          "type": "boolean"
                        },
                        "you": {
                          "type": "boolean"
                        }
                      },
                      "type": "object"
                    },
                    "auditLogs": {
                      "properties": {
                        "enabled": {
                          "type": "boolean"
                        },
                        "retentionDays": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        }
                      },
                      "type": "object"
                    },
                    "available": {
                      "type": "boolean"
                    },
                    "canManage": {
                      "type": "boolean"
                    },
                    "certificate": {
                      "properties": {
                        "daysUntilExpiry": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "expiresAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "state": {
                          "type": "string"
                        }
                      },
                      "type": [
                        "null",
                        "object"
                      ]
                    },
                    "domains": {
                      "items": {
                        "properties": {
                          "domain": {
                            "type": "string"
                          },
                          "lastError": {},
                          "source": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "verifiedAt": {
                            "format": "date-time",
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "enterprise": {
                      "properties": {
                        "name": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "groupsManaged": {
                      "items": {
                        "properties": {
                          "groupId": {
                            "type": "string"
                          },
                          "mayChange": {
                            "type": "boolean"
                          },
                          "name": {
                            "type": "string"
                          },
                          "people": {
                            "type": "integer"
                          },
                          "reason": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "itContacts": {
                      "properties": {
                        "contacts": {
                          "items": {
                            "properties": {
                              "addedAt": {
                                "format": "date-time",
                                "type": "string"
                              },
                              "email": {
                                "type": "string"
                              },
                              "ref": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": [
                            "array",
                            "null"
                          ]
                        },
                        "error": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "max": {
                          "type": "integer"
                        },
                        "readAt": {
                          "format": "date-time",
                          "type": [
                            "null",
                            "string"
                          ]
                        }
                      },
                      "type": "object"
                    },
                    "provisioning": {
                      "properties": {
                        "enabled": {
                          "type": "boolean"
                        },
                        "lastSyncAt": {
                          "format": "date-time",
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "linked": {
                          "type": "boolean"
                        },
                        "state": {
                          "type": [
                            "null",
                            "string"
                          ]
                        }
                      },
                      "type": "object"
                    },
                    "role": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "sso": {
                      "properties": {
                        "beyondLimit": {
                          "type": "integer"
                        },
                        "checkedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "connectionState": {
                          "type": "string"
                        },
                        "connections": {
                          "items": {
                            "properties": {
                              "certificate": {
                                "properties": {
                                  "daysUntilExpiry": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ]
                                  },
                                  "expiresAt": {
                                    "format": "date-time",
                                    "type": "string"
                                  },
                                  "state": {
                                    "type": "string"
                                  }
                                },
                                "type": [
                                  "null",
                                  "object"
                                ]
                              },
                              "domains": {
                                "items": {
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "isDefault": {
                                "type": "boolean"
                              },
                              "label": {
                                "type": "string"
                              },
                              "provider": {
                                "type": "string"
                              },
                              "ref": {
                                "type": "string"
                              },
                              "state": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "limits": {
                          "properties": {
                            "connections": {
                              "type": "integer"
                            },
                            "labelMax": {
                              "type": "integer"
                            },
                            "perDomain": {
                              "type": "integer"
                            },
                            "routes": {
                              "type": "integer"
                            }
                          },
                          "type": "object"
                        },
                        "routing": {
                          "properties": {
                            "confirmed": {
                              "type": "boolean"
                            },
                            "defaultRef": {
                              "type": "string"
                            },
                            "routes": {
                              "items": {
                                "properties": {
                                  "domain": {
                                    "type": "string"
                                  },
                                  "refs": {
                                    "items": {
                                      "type": "string"
                                    },
                                    "type": "array"
                                  }
                                },
                                "type": "object"
                              },
                              "type": "array"
                            },
                            "unservedDomains": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "updatedAt": {
                              "format": "date-time",
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "updatedBy": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "version": {
                              "type": "integer"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "workosRoles": {
                      "properties": {
                        "enabled": {
                          "type": "boolean"
                        },
                        "readAt": {
                          "format": "date-time",
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "state": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "access": {
                    "activity": "view",
                    "admins": "manage",
                    "apps": "manage",
                    "groups": "manage",
                    "insights": "view",
                    "keys": "[REDACTED]",
                    "people": "manage",
                    "policy": "manage",
                    "setup": "manage",
                    "streams": "manage"
                  },
                  "admins": {
                    "named": true,
                    "you": true
                  },
                  "auditLogs": {
                    "enabled": false,
                    "retentionDays": null
                  },
                  "available": true,
                  "canManage": true,
                  "certificate": null,
                  "domains": [
                    {
                      "domain": "it-contacts-1767225600000.test",
                      "lastError": null,
                      "source": "workos",
                      "status": "verified",
                      "verifiedAt": "2026-01-01T00:00:00.000Z"
                    }
                  ],
                  "enterprise": {
                    "name": "Globex"
                  },
                  "groupsManaged": [],
                  "itContacts": {
                    "contacts": [
                      {
                        "addedAt": "2026-01-01T00:00:00.000Z",
                        "email": "user@example.com",
                        "ref": "e9a8b97a49e8d3d6"
                      },
                      {
                        "addedAt": "2026-01-01T00:00:00.000Z",
                        "email": "user@example.com",
                        "ref": "2a350d9bfd0dd841"
                      },
                      {
                        "addedAt": "2026-01-01T00:00:00.000Z",
                        "email": "user@example.com",
                        "ref": "f87084c4e185ea32"
                      },
                      {
                        "addedAt": "2026-01-01T00:00:00.000Z",
                        "email": "user@example.com",
                        "ref": "0c00cabe03d041b9"
                      },
                      {
                        "addedAt": "2026-01-01T00:00:00.000Z",
                        "email": "user@example.com",
                        "ref": "68844f9033aa872d"
                      },
                      {
                        "addedAt": "2026-01-01T00:00:00.000Z",
                        "email": "user@example.com",
                        "ref": "50d976ef9cf4e973"
                      },
                      {
                        "addedAt": "2026-01-01T00:00:00.000Z",
                        "email": "user@example.com",
                        "ref": "7d5c032e2b12da06"
                      },
                      {
                        "addedAt": "2026-01-01T00:00:00.000Z",
                        "email": "user@example.com",
                        "ref": "8c832cd42a2f2bd1"
                      },
                      {
                        "addedAt": "2026-01-01T00:00:00.000Z",
                        "email": "user@example.com",
                        "ref": "8ada6bed298ec4ca"
                      },
                      {
                        "addedAt": "2026-01-01T00:00:00.000Z",
                        "email": "user@example.com",
                        "ref": "18ee2638333b383b"
                      }
                    ],
                    "error": null,
                    "max": 20,
                    "readAt": "2026-01-01T00:00:00.000Z"
                  },
                  "provisioning": {
                    "enabled": false,
                    "lastSyncAt": null,
                    "linked": false,
                    "state": null
                  },
                  "role": "company-admin",
                  "sso": {
                    "beyondLimit": 0,
                    "checkedAt": "2026-01-01T00:00:00.000Z",
                    "connectionState": "active",
                    "connections": [
                      {
                        "certificate": null,
                        "domains": [
                          "it-contacts-1767225600000.test"
                        ],
                        "isDefault": true,
                        "label": "Okta",
                        "provider": "okta",
                        "ref": "96ccc66c4a5e07f3",
                        "state": "active",
                        "type": "OktaSAML"
                      }
                    ],
                    "limits": {
                      "connections": 10,
                      "labelMax": 60,
                      "perDomain": 5,
                      "routes": 50
                    },
                    "routing": {
                      "confirmed": true,
                      "defaultRef": "96ccc66c4a5e07f3",
                      "routes": [],
                      "unservedDomains": [],
                      "updatedAt": null,
                      "updatedBy": null,
                      "version": 0
                    }
                  },
                  "workosRoles": {
                    "enabled": false,
                    "readAt": null,
                    "state": "off"
                  }
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/admins": {
      "get": {
        "operationId": "workspaces.enterprise.admins.list",
        "summary": "List the company admins and their company roles",
        "description": "Needs a company role reaching the `admins` area at `view` (until the company names an admin, `workspace:settings:edit`). Empty until one is named.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "admins": {
                      "items": {
                        "properties": {
                          "addedAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string"
                          },
                          "roleName": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string"
                          },
                          "userId": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "max": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "admins": [
                    {
                      "addedAt": "2026-01-01T00:00:00.000Z",
                      "email": "user@example.com",
                      "name": "Session User m10-alice",
                      "role": "company-admin",
                      "roleName": "Company admin",
                      "source": "app",
                      "userId": "000000000000000000000001"
                    }
                  ],
                  "max": 20
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      },
      "post": {
        "operationId": "workspaces.enterprise.admins.create",
        "summary": "Name a company admin",
        "description": "Needs the `admins` area at `manage` and a recent sign-in (403 `reauth_required`). The person must be one of the company's own people (422 `not_enterprise_people`); once the first admin is named, only named admins manage the company. Also 403 `managed_by_app`, 422 `too_many_admins` or `unknown_role`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "userId": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  },
                  "role": {
                    "type": "string",
                    "pattern": "^([a-f0-9]{24}|[a-z][a-z-]{0,39})$"
                  }
                },
                "required": [
                  "userId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "admins": {
                      "items": {
                        "properties": {
                          "addedAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string"
                          },
                          "roleName": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string"
                          },
                          "userId": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "max": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "admins": [
                    {
                      "addedAt": "2026-01-01T00:00:00.000Z",
                      "email": "user@example.com",
                      "name": "Session User stepup-priya",
                      "role": "company-admin",
                      "roleName": "Company admin",
                      "source": "console",
                      "userId": "000000000000000000000001"
                    },
                    {
                      "addedAt": "2026-01-01T00:00:00.000Z",
                      "email": "user@example.com",
                      "name": "Session User stepup-bob",
                      "role": "company-admin",
                      "roleName": "Company admin",
                      "source": "console",
                      "userId": "000000000000000000000002"
                    },
                    {
                      "addedAt": "2026-01-01T00:00:00.000Z",
                      "email": "user@example.com",
                      "name": "Session User stepup-carl",
                      "role": "company-admin",
                      "roleName": "Company admin",
                      "source": "console",
                      "userId": "000000000000000000000003"
                    },
                    {
                      "addedAt": "2026-01-01T00:00:00.000Z",
                      "email": "user@example.com",
                      "name": "Session User stepup-sam",
                      "role": "company-admin",
                      "roleName": "Company admin",
                      "source": "app",
                      "userId": "000000000000000000000004"
                    }
                  ],
                  "max": 20
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/admins/{userId}": {
      "delete": {
        "operationId": "workspaces.enterprise.admins.delete",
        "summary": "Remove a company admin",
        "description": "Needs the `admins` area at `manage` and a recent sign-in (403 `reauth_required`). An admin made by the identity provider through a role mapping is refused with 409 `managed_by_idp`. Removing the last one hands the company back to members with `workspace:settings:edit`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "admins": {
                      "items": {
                        "properties": {
                          "addedAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string"
                          },
                          "roleName": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string"
                          },
                          "userId": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "max": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "admins": [
                    {
                      "addedAt": "2026-01-01T00:00:00.000Z",
                      "email": "user@example.com",
                      "name": "Session User stepup-priya",
                      "role": "company-admin",
                      "roleName": "Company admin",
                      "source": "console",
                      "userId": "000000000000000000000001"
                    },
                    {
                      "addedAt": "2026-01-01T00:00:00.000Z",
                      "email": "user@example.com",
                      "name": "Session User stepup-bob",
                      "role": "company-admin",
                      "roleName": "Company admin",
                      "source": "console",
                      "userId": "000000000000000000000002"
                    },
                    {
                      "addedAt": "2026-01-01T00:00:00.000Z",
                      "email": "user@example.com",
                      "name": "Session User stepup-carl",
                      "role": "company-admin",
                      "roleName": "Company admin",
                      "source": "console",
                      "userId": "000000000000000000000003"
                    }
                  ],
                  "max": 20
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      },
      "patch": {
        "operationId": "workspaces.enterprise.admins.update",
        "summary": "Change a company admin's company role",
        "description": "Needs the `admins` area at `manage` and a recent sign-in (403 `reauth_required`). 404 when the person is not named; 409 `managed_by_idp` for one the identity provider made; 422 `unknown_role`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "role": {
                    "type": "string",
                    "pattern": "^([a-f0-9]{24}|[a-z][a-z-]{0,39})$"
                  }
                },
                "required": [
                  "role"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "admins": {
                      "items": {
                        "properties": {
                          "addedAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string"
                          },
                          "roleName": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string"
                          },
                          "userId": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "max": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "admins": [
                    {
                      "addedAt": "2026-01-01T00:00:00.000Z",
                      "email": "user@example.com",
                      "name": "Session User stepup-priya",
                      "role": "company-admin",
                      "roleName": "Company admin",
                      "source": "console",
                      "userId": "000000000000000000000001"
                    },
                    {
                      "addedAt": "2026-01-01T00:00:00.000Z",
                      "email": "user@example.com",
                      "name": "Session User stepup-bob",
                      "role": "company-admin",
                      "roleName": "Company admin",
                      "source": "console",
                      "userId": "000000000000000000000002"
                    },
                    {
                      "addedAt": "2026-01-01T00:00:00.000Z",
                      "email": "user@example.com",
                      "name": "Session User stepup-carl",
                      "role": "company-admin",
                      "roleName": "Company admin",
                      "source": "console",
                      "userId": "000000000000000000000003"
                    },
                    {
                      "addedAt": "2026-01-01T00:00:00.000Z",
                      "email": "user@example.com",
                      "name": "Session User stepup-sam",
                      "role": "auditor",
                      "roleName": "Auditor",
                      "source": "app",
                      "userId": "000000000000000000000004"
                    }
                  ],
                  "max": 20
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/agent-access": {
      "get": {
        "operationId": "workspaces.enterprise.agentAccess.list",
        "summary": "Get the company's agent access settings",
        "description": "Needs the `apps` area at `view` or the `setup` area at `manage`. Returns whether the app's team turned agent access on, the issuer and token endpoint to give the identity provider, the allowed agents' client IDs and the issuer the company trusts.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "agents": {
                      "properties": {
                        "allowed": {
                          "items": {
                            "properties": {
                              "clientId": {
                                "type": "string"
                              },
                              "identifiedBy": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "mode": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "audience": {
                      "type": "string"
                    },
                    "available": {
                      "type": "boolean"
                    },
                    "connections": {
                      "items": {
                        "properties": {
                          "isDefault": {
                            "type": "boolean"
                          },
                          "label": {
                            "type": "string"
                          },
                          "ref": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "issuer": {
                      "properties": {
                        "addedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "addedBy": {
                          "type": "string"
                        },
                        "advertisesIdJag": {
                          "type": "boolean"
                        },
                        "connection": {
                          "properties": {
                            "label": {
                              "type": "string"
                            },
                            "ref": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "issuer": {
                          "type": "string"
                        },
                        "jwksUri": {
                          "type": "string"
                        },
                        "jwksUriOverridden": {
                          "type": "boolean"
                        },
                        "keys": {
                          "properties": {
                            "checkedAt": {
                              "type": "string"
                            },
                            "count": {
                              "type": "integer"
                            },
                            "error": {}
                          },
                          "type": "object"
                        },
                        "lastUsedAt": {
                          "format": "date-time",
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "notice": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "proof": {
                          "properties": {
                            "at": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "by": {
                              "type": "string"
                            }
                          },
                          "type": [
                            "null",
                            "object"
                          ]
                        },
                        "status": {
                          "type": "string"
                        },
                        "tenant": {},
                        "tokenMinutes": {
                          "type": "integer"
                        }
                      },
                      "type": [
                        "null",
                        "object"
                      ]
                    },
                    "maxTokenMinutes": {
                      "type": "integer"
                    },
                    "provider": {
                      "type": "string"
                    },
                    "tokenEndpoint": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "agents": {
                    "allowed": [
                      {
                        "clientId": "L4trnsJReCyjyIZQMScvU0ty6eHA4Af1aMDb8nbT",
                        "identifiedBy": "registered",
                        "title": "Okta tester 1767225600000"
                      },
                      {
                        "clientId": "0KMHGQRzsdUyyxIy0QL6vLQaiUElpWWylys1a6Bd",
                        "identifiedBy": "registered",
                        "title": "M17 agent 1767225600000"
                      },
                      {
                        "clientId": "ePJlBwmsp0AKQFNLy29YYiT6OpgwJMZqZeG7m8uv",
                        "identifiedBy": "registered",
                        "title": "M17 agent 1767225600000"
                      },
                      {
                        "clientId": "nysUGAyOW12ixNsman6ebx10ZcMKMOxMmupN0meb",
                        "identifiedBy": "registered",
                        "title": "M10 agent 1767225600000"
                      },
                      {
                        "clientId": "rIG6JB0QlxdkVeRMnrTM0M3VCKXw394eUerQ8u83",
                        "identifiedBy": "registered",
                        "title": "MCP Discovery Client"
                      },
                      {
                        "clientId": "d4UCagv45LlCvHo3zlW6nxa2hft8Q1yWEHJlxmOd",
                        "identifiedBy": "registered",
                        "title": "E2E Scoped Agent"
                      },
                      {
                        "clientId": "GxE7uiXJZYhGEFKiaG6IItfgpKTQgMx8pxqvNHZi",
                        "identifiedBy": "registered",
                        "title": "E2E Deny Agent"
                      },
                      {
                        "clientId": "PdcZi54Ss71u9xJsxkCpj3cRrNle48cSM5RTaFvK",
                        "identifiedBy": "registered",
                        "title": "E2E Agent"
                      }
                    ],
                    "mode": "any"
                  },
                  "audience": "http://localhost:3000/org/000000000000000000000001",
                  "available": true,
                  "connections": [
                    {
                      "isDefault": true,
                      "label": "Okta",
                      "ref": "56772ef3f78599fe"
                    }
                  ],
                  "issuer": {
                    "addedAt": "2026-01-01T00:00:00.000Z",
                    "addedBy": "Session User m19-issuer-owner",
                    "advertisesIdJag": true,
                    "connection": {
                      "label": "Okta",
                      "ref": "56772ef3f78599fe"
                    },
                    "issuer": "http://127.0.0.1:4199/idp/globex",
                    "jwksUri": "http://127.0.0.1:4199/idp/globex/keys",
                    "jwksUriOverridden": false,
                    "keys": {
                      "checkedAt": "[REDACTED]",
                      "count": 0,
                      "error": null
                    },
                    "lastUsedAt": null,
                    "notice": "Waiting to be proven. No agent gets a token through it yet. The first time one of your people uses an agent through it and is matched by their single sign-on, the app knows it is your company's and turns it on. The app's team can also approve it.",
                    "proof": null,
                    "status": "pending",
                    "tenant": null,
                    "tokenMinutes": 0
                  },
                  "maxTokenMinutes": 0,
                  "provider": "okta",
                  "tokenEndpoint": "[REDACTED]"
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      },
      "patch": {
        "operationId": "workspaces.enterprise.agentAccess.update",
        "summary": "Turn agent access on or off, or change its token lifetime",
        "description": "Needs the `setup` area at `manage`; turning it on also needs a recent sign-in (403 `reauth_required`). Turning it off ends the sessions of every agent it approved. 409 `agent_access_off` when the app's team has not turned it on, 409 `agent_issuer_taken` when another company holds the issuer.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "disabled"
                    ]
                  },
                  "tokenMinutes": {
                    "type": "integer",
                    "enum": [
                      5,
                      15,
                      30,
                      60
                    ]
                  }
                },
                "additionalProperties": false,
                "minProperties": 1
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "agents": {
                      "properties": {
                        "allowed": {
                          "items": {
                            "properties": {
                              "clientId": {
                                "type": "string"
                              },
                              "identifiedBy": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "mode": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "audience": {
                      "type": "string"
                    },
                    "available": {
                      "type": "boolean"
                    },
                    "connections": {
                      "items": {
                        "properties": {
                          "isDefault": {
                            "type": "boolean"
                          },
                          "label": {
                            "type": "string"
                          },
                          "ref": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "issuer": {
                      "properties": {
                        "addedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "addedBy": {
                          "type": "string"
                        },
                        "advertisesIdJag": {
                          "type": "boolean"
                        },
                        "connection": {
                          "properties": {
                            "label": {
                              "type": "string"
                            },
                            "ref": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "issuer": {
                          "type": "string"
                        },
                        "jwksUri": {
                          "type": "string"
                        },
                        "jwksUriOverridden": {
                          "type": "boolean"
                        },
                        "keys": {
                          "properties": {
                            "checkedAt": {
                              "type": "string"
                            },
                            "count": {
                              "type": "integer"
                            },
                            "error": {}
                          },
                          "type": "object"
                        },
                        "lastUsedAt": {
                          "format": "date-time",
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "notice": {},
                        "proof": {
                          "properties": {
                            "at": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "by": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "status": {
                          "type": "string"
                        },
                        "tenant": {},
                        "tokenMinutes": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "maxTokenMinutes": {
                      "type": "integer"
                    },
                    "provider": {
                      "type": "string"
                    },
                    "sessionsEnded": {
                      "type": "integer"
                    },
                    "tokenEndpoint": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "agents": {
                    "allowed": [
                      {
                        "clientId": "IIDobjbV4HB0tQDo1lRHNhprt7IGGKR6uxp2qi3Y",
                        "identifiedBy": "registered",
                        "title": "Second agent 1767225600000"
                      },
                      {
                        "clientId": "3WeDmRQJI9oZrANqfrUwm392oaw3JX1yHviXwqhq",
                        "identifiedBy": "registered",
                        "title": "Okta tester 1767225600000"
                      },
                      {
                        "clientId": "pjUaF40O2rtm64dBqY0cTfKTNhlqU1P8bVdZycha",
                        "identifiedBy": "registered",
                        "title": "Okta tester 1767225600000"
                      },
                      {
                        "clientId": "JqaLEW6YTfKbcERm1VrodxwoW7AzlvEMSduwLoQC",
                        "identifiedBy": "registered",
                        "title": "Second agent 1767225600000"
                      },
                      {
                        "clientId": "VXsk3VwZodEHrA6UT9OJFZ1TuzgO4t2ON88hwYDb",
                        "identifiedBy": "registered",
                        "title": "Okta tester 1767225600000"
                      },
                      {
                        "clientId": "L4trnsJReCyjyIZQMScvU0ty6eHA4Af1aMDb8nbT",
                        "identifiedBy": "registered",
                        "title": "Okta tester 1767225600000"
                      },
                      {
                        "clientId": "0KMHGQRzsdUyyxIy0QL6vLQaiUElpWWylys1a6Bd",
                        "identifiedBy": "registered",
                        "title": "M17 agent 1767225600000"
                      },
                      {
                        "clientId": "ePJlBwmsp0AKQFNLy29YYiT6OpgwJMZqZeG7m8uv",
                        "identifiedBy": "registered",
                        "title": "M17 agent 1767225600000"
                      },
                      {
                        "clientId": "nysUGAyOW12ixNsman6ebx10ZcMKMOxMmupN0meb",
                        "identifiedBy": "registered",
                        "title": "M10 agent 1767225600000"
                      },
                      {
                        "clientId": "rIG6JB0QlxdkVeRMnrTM0M3VCKXw394eUerQ8u83",
                        "identifiedBy": "registered",
                        "title": "MCP Discovery Client"
                      }
                    ],
                    "mode": "any"
                  },
                  "audience": "http://localhost:3000/org/000000000000000000000001",
                  "available": true,
                  "connections": [
                    {
                      "isDefault": true,
                      "label": "Okta",
                      "ref": "52eb7c252b79bbbb"
                    }
                  ],
                  "issuer": {
                    "addedAt": "2026-01-01T00:00:00.000Z",
                    "addedBy": "The app's team",
                    "advertisesIdJag": true,
                    "connection": {
                      "label": "Okta",
                      "ref": "52eb7c252b79bbbb"
                    },
                    "issuer": "http://127.0.0.1:4199/idp/globex",
                    "jwksUri": "http://127.0.0.1:4199/idp/globex/keys",
                    "jwksUriOverridden": false,
                    "keys": {
                      "checkedAt": "[REDACTED]",
                      "count": 0,
                      "error": null
                    },
                    "lastUsedAt": "2026-01-01T00:00:00.000Z",
                    "notice": null,
                    "proof": {
                      "at": "2026-01-01T00:00:00.000Z",
                      "by": "app_team"
                    },
                    "status": "disabled",
                    "tenant": null,
                    "tokenMinutes": 0
                  },
                  "maxTokenMinutes": 0,
                  "provider": "okta",
                  "sessionsEnded": 2,
                  "tokenEndpoint": "[REDACTED]"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/agent-access/check": {
      "post": {
        "operationId": "workspaces.enterprise.agentAccess.check.create",
        "summary": "Re-read the agent issuer's discovery document and keys",
        "description": "Needs the `setup` area at `manage`. A failure is stored for the status card and the last good keys stay in use. 404 `agent_issuer_not_found` when the company trusts no issuer.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "agents": {
                      "properties": {
                        "allowed": {
                          "items": {
                            "properties": {
                              "clientId": {
                                "type": "string"
                              },
                              "identifiedBy": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "mode": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "audience": {
                      "type": "string"
                    },
                    "available": {
                      "type": "boolean"
                    },
                    "checked": {
                      "properties": {
                        "discovery": {
                          "type": "string"
                        },
                        "keys": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "connections": {
                      "items": {
                        "properties": {
                          "isDefault": {
                            "type": "boolean"
                          },
                          "label": {
                            "type": "string"
                          },
                          "ref": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "issuer": {
                      "properties": {
                        "addedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "addedBy": {
                          "type": "string"
                        },
                        "advertisesIdJag": {
                          "type": "boolean"
                        },
                        "connection": {
                          "properties": {
                            "label": {
                              "type": "string"
                            },
                            "ref": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "issuer": {
                          "type": "string"
                        },
                        "jwksUri": {
                          "type": "string"
                        },
                        "jwksUriOverridden": {
                          "type": "boolean"
                        },
                        "keys": {
                          "properties": {
                            "checkedAt": {
                              "type": "string"
                            },
                            "count": {
                              "type": "integer"
                            },
                            "error": {}
                          },
                          "type": "object"
                        },
                        "lastUsedAt": {
                          "format": "date-time",
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "notice": {},
                        "proof": {
                          "properties": {
                            "at": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "by": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "status": {
                          "type": "string"
                        },
                        "tenant": {},
                        "tokenMinutes": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "maxTokenMinutes": {
                      "type": "integer"
                    },
                    "provider": {
                      "type": "string"
                    },
                    "tokenEndpoint": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "agents": {
                    "allowed": [
                      {
                        "clientId": "L4trnsJReCyjyIZQMScvU0ty6eHA4Af1aMDb8nbT",
                        "identifiedBy": "registered",
                        "title": "Okta tester 1767225600000"
                      },
                      {
                        "clientId": "0KMHGQRzsdUyyxIy0QL6vLQaiUElpWWylys1a6Bd",
                        "identifiedBy": "registered",
                        "title": "M17 agent 1767225600000"
                      },
                      {
                        "clientId": "ePJlBwmsp0AKQFNLy29YYiT6OpgwJMZqZeG7m8uv",
                        "identifiedBy": "registered",
                        "title": "M17 agent 1767225600000"
                      },
                      {
                        "clientId": "nysUGAyOW12ixNsman6ebx10ZcMKMOxMmupN0meb",
                        "identifiedBy": "registered",
                        "title": "M10 agent 1767225600000"
                      },
                      {
                        "clientId": "rIG6JB0QlxdkVeRMnrTM0M3VCKXw394eUerQ8u83",
                        "identifiedBy": "registered",
                        "title": "MCP Discovery Client"
                      },
                      {
                        "clientId": "d4UCagv45LlCvHo3zlW6nxa2hft8Q1yWEHJlxmOd",
                        "identifiedBy": "registered",
                        "title": "E2E Scoped Agent"
                      },
                      {
                        "clientId": "GxE7uiXJZYhGEFKiaG6IItfgpKTQgMx8pxqvNHZi",
                        "identifiedBy": "registered",
                        "title": "E2E Deny Agent"
                      },
                      {
                        "clientId": "PdcZi54Ss71u9xJsxkCpj3cRrNle48cSM5RTaFvK",
                        "identifiedBy": "registered",
                        "title": "E2E Agent"
                      }
                    ],
                    "mode": "any"
                  },
                  "audience": "http://localhost:3000/org/000000000000000000000001",
                  "available": true,
                  "checked": {
                    "discovery": "ok",
                    "keys": 0
                  },
                  "connections": [
                    {
                      "isDefault": true,
                      "label": "Okta",
                      "ref": "56772ef3f78599fe"
                    }
                  ],
                  "issuer": {
                    "addedAt": "2026-01-01T00:00:00.000Z",
                    "addedBy": "Session User m19-issuer-owner",
                    "advertisesIdJag": true,
                    "connection": {
                      "label": "Okta",
                      "ref": "56772ef3f78599fe"
                    },
                    "issuer": "http://127.0.0.1:4199/idp/globex",
                    "jwksUri": "http://127.0.0.1:4199/idp/globex/keys",
                    "jwksUriOverridden": false,
                    "keys": {
                      "checkedAt": "[REDACTED]",
                      "count": 0,
                      "error": null
                    },
                    "lastUsedAt": "2026-01-01T00:00:00.000Z",
                    "notice": null,
                    "proof": {
                      "at": "2026-01-01T00:00:00.000Z",
                      "by": "app_team"
                    },
                    "status": "active",
                    "tenant": null,
                    "tokenMinutes": 0
                  },
                  "maxTokenMinutes": 0,
                  "provider": "okta",
                  "tokenEndpoint": "[REDACTED]"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/agent-access/issuer": {
      "put": {
        "operationId": "workspaces.enterprise.agentAccess.issuer.update",
        "summary": "Set the identity provider trusted to approve agents",
        "description": "Needs the `setup` area at `manage`, a recent sign-in (403 `reauth_required`) and the app's plan to include Enterprise SSO (402). The issuer's discovery document must name exactly this issuer (400 `agent_issuer_invalid`); 409 `agent_issuer_taken` when another company of the app trusts it, 409 `agent_access_off`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "issuer": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512
                  },
                  "tenant": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 128
                  },
                  "jwksUri": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 512
                  },
                  "connection": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 32
                  }
                },
                "required": [
                  "issuer"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "agents": {
                      "properties": {
                        "allowed": {
                          "items": {
                            "properties": {
                              "clientId": {
                                "type": "string"
                              },
                              "identifiedBy": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "mode": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "audience": {
                      "type": "string"
                    },
                    "available": {
                      "type": "boolean"
                    },
                    "connections": {
                      "items": {
                        "properties": {
                          "isDefault": {
                            "type": "boolean"
                          },
                          "label": {
                            "type": "string"
                          },
                          "ref": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "issuer": {
                      "properties": {
                        "addedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "addedBy": {
                          "type": "string"
                        },
                        "advertisesIdJag": {
                          "type": "boolean"
                        },
                        "connection": {
                          "properties": {
                            "label": {
                              "type": "string"
                            },
                            "ref": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "issuer": {
                          "type": "string"
                        },
                        "jwksUri": {
                          "type": "string"
                        },
                        "jwksUriOverridden": {
                          "type": "boolean"
                        },
                        "keys": {
                          "properties": {
                            "checkedAt": {
                              "type": "string"
                            },
                            "count": {
                              "type": "integer"
                            },
                            "error": {}
                          },
                          "type": "object"
                        },
                        "lastUsedAt": {
                          "format": "date-time",
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "notice": {
                          "type": "string"
                        },
                        "proof": {},
                        "status": {
                          "type": "string"
                        },
                        "tenant": {},
                        "tokenMinutes": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "maxTokenMinutes": {
                      "type": "integer"
                    },
                    "provider": {
                      "type": "string"
                    },
                    "tokenEndpoint": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "agents": {
                    "allowed": [
                      {
                        "clientId": "RBKymkykLTaCklHrX8JHWfrZi4wE2AEiETnQY8Nz",
                        "identifiedBy": "registered",
                        "title": "Okta tester 1767225600000"
                      },
                      {
                        "clientId": "sZli2BIvqS9UtvsRnmmdRsmwN9wCY1cBNVWHT7Ma",
                        "identifiedBy": "registered",
                        "title": "M17 agent 1767225600000"
                      },
                      {
                        "clientId": "J2CCTCKFc1vTSP8sEMPbUSUzQ3sXlt2hR2NwMlsQ",
                        "identifiedBy": "registered",
                        "title": "Okta tester 1767225600000"
                      },
                      {
                        "clientId": "IIDobjbV4HB0tQDo1lRHNhprt7IGGKR6uxp2qi3Y",
                        "identifiedBy": "registered",
                        "title": "Second agent 1767225600000"
                      },
                      {
                        "clientId": "3WeDmRQJI9oZrANqfrUwm392oaw3JX1yHviXwqhq",
                        "identifiedBy": "registered",
                        "title": "Okta tester 1767225600000"
                      },
                      {
                        "clientId": "pjUaF40O2rtm64dBqY0cTfKTNhlqU1P8bVdZycha",
                        "identifiedBy": "registered",
                        "title": "Okta tester 1767225600000"
                      },
                      {
                        "clientId": "JqaLEW6YTfKbcERm1VrodxwoW7AzlvEMSduwLoQC",
                        "identifiedBy": "registered",
                        "title": "Second agent 1767225600000"
                      },
                      {
                        "clientId": "VXsk3VwZodEHrA6UT9OJFZ1TuzgO4t2ON88hwYDb",
                        "identifiedBy": "registered",
                        "title": "Okta tester 1767225600000"
                      },
                      {
                        "clientId": "L4trnsJReCyjyIZQMScvU0ty6eHA4Af1aMDb8nbT",
                        "identifiedBy": "registered",
                        "title": "Okta tester 1767225600000"
                      },
                      {
                        "clientId": "0KMHGQRzsdUyyxIy0QL6vLQaiUElpWWylys1a6Bd",
                        "identifiedBy": "registered",
                        "title": "M17 agent 1767225600000"
                      }
                    ],
                    "mode": "any"
                  },
                  "audience": "http://localhost:3000/org/000000000000000000000001",
                  "available": true,
                  "connections": [
                    {
                      "isDefault": true,
                      "label": "Okta",
                      "ref": "6da1c38316815ce6"
                    },
                    {
                      "isDefault": false,
                      "label": "Umbrella (Entra)",
                      "ref": "f2a0a3a5254d2007"
                    }
                  ],
                  "issuer": {
                    "addedAt": "2026-01-01T00:00:00.000Z",
                    "addedBy": "The app's team",
                    "advertisesIdJag": true,
                    "connection": {
                      "label": "Umbrella (Entra)",
                      "ref": "f2a0a3a5254d2007"
                    },
                    "issuer": "http://127.0.0.1:4199/idp/globex",
                    "jwksUri": "http://127.0.0.1:4199/idp/globex/keys",
                    "jwksUriOverridden": false,
                    "keys": {
                      "checkedAt": "[REDACTED]",
                      "count": 0,
                      "error": null
                    },
                    "lastUsedAt": "2026-01-01T00:00:00.000Z",
                    "notice": "Waiting to be proven. No agent gets a token through it yet. The first time one of your people uses an agent through it and is matched by their single sign-on, the app knows it is your company's and turns it on. The app's team can also approve it.",
                    "proof": null,
                    "status": "pending",
                    "tenant": null,
                    "tokenMinutes": 0
                  },
                  "maxTokenMinutes": 0,
                  "provider": "entra",
                  "tokenEndpoint": "[REDACTED]"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      },
      "delete": {
        "operationId": "workspaces.enterprise.agentAccess.issuer.delete",
        "summary": "Stop trusting the company's agent issuer",
        "description": "Needs the `setup` area at `manage`. Every agent session the issuer approved ends now. 404 `agent_issuer_not_found` when none is set.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "removed": {
                      "type": "boolean"
                    },
                    "sessionsEnded": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "removed": true,
                  "sessionsEnded": 0
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/audit": {
      "get": {
        "operationId": "workspaces.enterprise.audit.list",
        "summary": "List the company's sign-in audit trail",
        "description": "Needs the `activity` area at `view`. Returns the company's sign-ins, refusals, provisioning, certificate and setup entries, limited to the app plan's audit retention window.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "entries": {
                      "items": {
                        "properties": {
                          "action": {
                            "type": "string"
                          },
                          "actor": {
                            "properties": {
                              "email": {
                                "type": "string"
                              },
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "type": [
                              "null",
                              "object"
                            ]
                          },
                          "at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "details": {
                            "properties": {
                              "actingAs": {
                                "type": "string"
                              },
                              "added": {
                                "items": {
                                  "properties": {
                                    "email": {
                                      "type": "string"
                                    },
                                    "userId": {
                                      "type": "string"
                                    }
                                  },
                                  "type": "object"
                                },
                                "type": "array"
                              },
                              "addedCount": {
                                "type": "integer"
                              },
                              "affected": {
                                "properties": {
                                  "people": {
                                    "type": "integer"
                                  },
                                  "sessions": {
                                    "type": "integer"
                                  }
                                },
                                "type": "object"
                              },
                              "after": {
                                "properties": {
                                  "default": {
                                    "properties": {
                                      "connectionId": {
                                        "type": "string"
                                      },
                                      "label": {
                                        "type": "string"
                                      }
                                    },
                                    "type": "object"
                                  },
                                  "labels": {
                                    "items": {
                                      "properties": {
                                        "connectionId": {
                                          "type": "string"
                                        },
                                        "label": {
                                          "type": "string"
                                        }
                                      },
                                      "type": "object"
                                    },
                                    "type": "array"
                                  },
                                  "routes": {
                                    "items": {
                                      "properties": {
                                        "connections": {
                                          "items": {
                                            "properties": {
                                              "connectionId": {
                                                "type": "string"
                                              },
                                              "label": {
                                                "type": "string"
                                              }
                                            },
                                            "type": "object"
                                          },
                                          "type": "array"
                                        },
                                        "domain": {
                                          "type": "string"
                                        }
                                      },
                                      "type": "object"
                                    },
                                    "type": "array"
                                  }
                                },
                                "type": "object"
                              },
                              "app": {
                                "type": "string"
                              },
                              "appKeyId": {
                                "type": "string"
                              },
                              "appKeyName": {
                                "type": "string"
                              },
                              "appTeamReason": {
                                "type": "string"
                              },
                              "appTeamSessions": {
                                "type": "string"
                              },
                              "assertionId": {
                                "type": "string"
                              },
                              "attentionSince": {
                                "format": "date-time",
                                "type": "string"
                              },
                              "audience": {
                                "type": "string"
                              },
                              "before": {
                                "properties": {
                                  "default": {
                                    "properties": {
                                      "connectionId": {
                                        "type": "string"
                                      },
                                      "label": {
                                        "type": "string"
                                      }
                                    },
                                    "type": "object"
                                  },
                                  "labels": {
                                    "items": {
                                      "properties": {
                                        "connectionId": {
                                          "type": "string"
                                        },
                                        "label": {
                                          "type": "string"
                                        }
                                      },
                                      "type": "object"
                                    },
                                    "type": "array"
                                  },
                                  "routes": {
                                    "type": "array"
                                  }
                                },
                                "type": [
                                  "null",
                                  "object"
                                ]
                              },
                              "breakGlass": {
                                "properties": {
                                  "passkeyOnly": {
                                    "type": "boolean"
                                  },
                                  "people": {
                                    "type": "integer"
                                  }
                                },
                                "type": "object"
                              },
                              "certificateType": {
                                "type": "string"
                              },
                              "change": {
                                "items": {
                                  "type": "string"
                                },
                                "type": [
                                  "array",
                                  "string"
                                ]
                              },
                              "changed": {
                                "items": {
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "clientId": {
                                "type": "string"
                              },
                              "companyManages": {
                                "type": "boolean"
                              },
                              "conditions": {
                                "items": {
                                  "properties": {
                                    "claim": {
                                      "type": "string"
                                    },
                                    "value": {
                                      "type": "string"
                                    }
                                  },
                                  "type": "object"
                                },
                                "type": "array"
                              },
                              "connectedApps": {
                                "properties": {
                                  "approved": {
                                    "type": "integer"
                                  },
                                  "mode": {
                                    "type": "string"
                                  }
                                },
                                "type": "object"
                              },
                              "connectionId": {
                                "type": "string"
                              },
                              "connectionLabel": {
                                "type": "string"
                              },
                              "connectionType": {
                                "type": "string"
                              },
                              "created": {
                                "type": "boolean"
                              },
                              "credential": {
                                "type": "string"
                              },
                              "credentialId": {
                                "type": "string"
                              },
                              "daysUntilExpiry": {
                                "type": "integer"
                              },
                              "device": {
                                "type": "string"
                              },
                              "deviceName": {
                                "type": "string"
                              },
                              "domainJoin": {
                                "type": "string"
                              },
                              "door": {
                                "type": "string"
                              },
                              "email": {
                                "type": "string"
                              },
                              "enterpriseId": {
                                "type": "string"
                              },
                              "eventAt": {
                                "format": "date-time",
                                "type": "string"
                              },
                              "excluded": {
                                "items": {
                                  "properties": {
                                    "groupId": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    }
                                  },
                                  "type": "object"
                                },
                                "type": "array"
                              },
                              "expiresAt": {
                                "format": "date-time",
                                "type": "string"
                              },
                              "expiresIn": {
                                "type": "integer"
                              },
                              "exportedVia": {
                                "type": "string"
                              },
                              "forced": {
                                "type": "boolean"
                              },
                              "from": {},
                              "group": {
                                "type": "string"
                              },
                              "groupId": {
                                "type": "string"
                              },
                              "groups": {
                                "items": {
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "idleMinutes": {
                                "type": [
                                  "integer",
                                  "null"
                                ]
                              },
                              "included": {
                                "items": {
                                  "properties": {
                                    "groupId": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    }
                                  },
                                  "type": "object"
                                },
                                "type": "array"
                              },
                              "intent": {
                                "type": "string"
                              },
                              "ipAllowlist": {
                                "properties": {
                                  "enabled": {
                                    "type": "boolean"
                                  },
                                  "ranges": {
                                    "items": {
                                      "type": "string"
                                    },
                                    "type": "array"
                                  }
                                },
                                "type": "object"
                              },
                              "issuer": {
                                "type": "string"
                              },
                              "issues": {
                                "items": {
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "joinedEnterprise": {
                                "type": "boolean"
                              },
                              "jwksUri": {
                                "type": "string"
                              },
                              "keyId": {
                                "type": "string"
                              },
                              "keyName": {
                                "type": "string"
                              },
                              "keyOwner": {
                                "type": "string"
                              },
                              "keys": {
                                "properties": {
                                  "checkedAt": {
                                    "type": "string"
                                  },
                                  "count": {
                                    "type": "integer"
                                  },
                                  "error": {}
                                },
                                "type": "object"
                              },
                              "kind": {
                                "type": "string"
                              },
                              "labels": {
                                "properties": {
                                  "owner": {
                                    "type": "string"
                                  },
                                  "repository": {
                                    "type": "string"
                                  }
                                },
                                "type": "object"
                              },
                              "matchedBy": {
                                "type": "string"
                              },
                              "maxAssertionMinutes": {
                                "type": "integer"
                              },
                              "maxSessionHours": {},
                              "method": {
                                "type": "string"
                              },
                              "orgRole": {
                                "properties": {
                                  "from": {
                                    "type": "string"
                                  },
                                  "to": {
                                    "type": "string"
                                  }
                                },
                                "type": "object"
                              },
                              "origin": {
                                "type": "string"
                              },
                              "outsiders": {
                                "properties": {
                                  "maxRole": {
                                    "type": "string"
                                  },
                                  "mode": {
                                    "type": "string"
                                  }
                                },
                                "type": "object"
                              },
                              "people": {
                                "type": "integer"
                              },
                              "preset": {
                                "type": "string"
                              },
                              "previousRole": {
                                "type": "string"
                              },
                              "reached": {
                                "type": "integer"
                              },
                              "reason": {
                                "type": "string"
                              },
                              "removed": {
                                "type": "array"
                              },
                              "removedCount": {
                                "type": "integer"
                              },
                              "resource": {
                                "type": "array"
                              },
                              "returnOrigin": {
                                "type": "string"
                              },
                              "role": {
                                "type": "string"
                              },
                              "roleId": {
                                "type": "string"
                              },
                              "roleName": {
                                "type": "string"
                              },
                              "roles": {
                                "items": {
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "rules": {
                                "properties": {
                                  "appTeamSessions": {
                                    "type": "string"
                                  },
                                  "connectedApps": {
                                    "properties": {
                                      "approved": {
                                        "items": {
                                          "type": "string"
                                        },
                                        "type": "array"
                                      },
                                      "mode": {
                                        "type": "string"
                                      }
                                    },
                                    "type": "object"
                                  },
                                  "idleMinutes": {
                                    "type": "integer"
                                  },
                                  "ipAllowlist": {
                                    "properties": {
                                      "ranges": {
                                        "items": {
                                          "type": "string"
                                        },
                                        "type": "array"
                                      }
                                    },
                                    "type": "object"
                                  },
                                  "maxSessionHours": {
                                    "type": "integer"
                                  },
                                  "outsiders": {
                                    "properties": {
                                      "maxRole": {
                                        "type": "string"
                                      },
                                      "mode": {
                                        "type": "string"
                                      }
                                    },
                                    "type": "object"
                                  },
                                  "requireSso": {
                                    "type": "boolean"
                                  },
                                  "signInMethods": {
                                    "properties": {
                                      "allowed": {
                                        "items": {
                                          "type": "string"
                                        },
                                        "type": "array"
                                      }
                                    },
                                    "type": "object"
                                  },
                                  "workspaceId": {
                                    "type": "string"
                                  }
                                },
                                "type": "object"
                              },
                              "scope": {
                                "type": "string"
                              },
                              "scopes": {
                                "items": {
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "serviceAccount": {
                                "type": "string"
                              },
                              "serviceAccountId": {
                                "type": "string"
                              },
                              "sessionRef": {
                                "type": "string"
                              },
                              "sessions": {
                                "type": "integer"
                              },
                              "setupBy": {
                                "type": "string"
                              },
                              "signInMethods": {
                                "properties": {
                                  "allowed": {}
                                },
                                "type": "object"
                              },
                              "source": {
                                "type": "string"
                              },
                              "state": {
                                "type": "string"
                              },
                              "stepUp": {
                                "properties": {
                                  "at": {
                                    "format": "date-time",
                                    "type": "string"
                                  },
                                  "method": {
                                    "type": "string"
                                  }
                                },
                                "type": "object"
                              },
                              "stream": {
                                "type": "string"
                              },
                              "subject": {
                                "properties": {
                                  "prefix": {
                                    "type": "boolean"
                                  },
                                  "value": {
                                    "type": "string"
                                  }
                                },
                                "type": [
                                  "null",
                                  "object"
                                ]
                              },
                              "tenant": {},
                              "throughWorkspaceId": {
                                "type": "string"
                              },
                              "to": {
                                "format": "date-time",
                                "type": "string"
                              },
                              "tokenMinutes": {
                                "type": "integer"
                              },
                              "userId": {
                                "type": "string"
                              },
                              "version": {
                                "type": "integer"
                              },
                              "via": {
                                "type": "string"
                              },
                              "workosOrganizationId": {
                                "type": "string"
                              },
                              "workosRoles": {
                                "items": {
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "workspace": {
                                "type": "string"
                              },
                              "workspaceId": {
                                "type": "string"
                              },
                              "workspaceRoles": {
                                "items": {
                                  "properties": {
                                    "from": {
                                      "type": "string"
                                    },
                                    "to": {
                                      "type": "string"
                                    },
                                    "workspaceId": {
                                      "type": "string"
                                    }
                                  },
                                  "type": "object"
                                },
                                "type": "array"
                              },
                              "workspaces": {
                                "items": {
                                  "type": "string"
                                },
                                "type": "array"
                              }
                            },
                            "type": "object"
                          },
                          "id": {
                            "type": "string"
                          },
                          "ip": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "userAgent": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "nextCursor": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "entries": [
                    {
                      "action": "enterprise_group_updated",
                      "actor": null,
                      "at": "2026-01-01T00:00:00.000Z",
                      "details": {
                        "changed": [
                          "includes"
                        ],
                        "enterpriseId": "000000000000000000000001",
                        "excluded": [
                          {
                            "groupId": "000000000000000000000002",
                            "name": "On-call"
                          }
                        ],
                        "group": "Security reviewers",
                        "groupId": "000000000000000000000003",
                        "included": [],
                        "reached": 1,
                        "via": "console"
                      },
                      "id": "000000000000000000000004",
                      "ip": null,
                      "userAgent": null
                    },
                    {
                      "action": "enterprise_group_updated",
                      "actor": null,
                      "at": "2026-01-01T00:00:00.000Z",
                      "details": {
                        "changed": [
                          "includes"
                        ],
                        "enterpriseId": "000000000000000000000001",
                        "excluded": [],
                        "group": "Security reviewers",
                        "groupId": "000000000000000000000003",
                        "included": [
                          {
                            "groupId": "000000000000000000000002",
                            "name": "On-call"
                          }
                        ],
                        "reached": 1,
                        "via": "console"
                      },
                      "id": "000000000000000000000005",
                      "ip": null,
                      "userAgent": null
                    },
                    {
                      "action": "enterprise_group_updated",
                      "actor": null,
                      "at": "2026-01-01T00:00:00.000Z",
                      "details": {
                        "changed": [
                          "includes"
                        ],
                        "enterpriseId": "000000000000000000000001",
                        "excluded": [],
                        "group": "Platform",
                        "groupId": "000000000000000000000006",
                        "included": [
                          {
                            "groupId": "000000000000000000000002",
                            "name": "On-call"
                          }
                        ],
                        "keyId": "[REDACTED]",
                        "keyName": "[REDACTED]",
                        "keyOwner": "[REDACTED]",
                        "reached": 1,
                        "via": "api"
                      },
                      "id": "000000000000000000000007",
                      "ip": "127.0.0.1",
                      "userAgent": "undefined"
                    },
                    {
                      "action": "enterprise_group_updated",
                      "actor": {
                        "email": "user@example.com",
                        "id": "000000000000000000000008",
                        "name": "Session User m23-nested-gus"
                      },
                      "at": "2026-01-01T00:00:00.000Z",
                      "details": {
                        "changed": [
                          "includes"
                        ],
                        "enterpriseId": "000000000000000000000001",
                        "excluded": [],
                        "group": "Engineering",
                        "groupId": "000000000000000000000009",
                        "included": [
                          {
                            "groupId": "000000000000000000000010",
                            "name": "Backend"
                          }
                        ],
                        "reached": 2,
                        "via": "app",
                        "workspaceId": "000000000000000000000011"
                      },
                      "id": "000000000000000000000012",
                      "ip": "127.0.0.1",
                      "userAgent": "undefined"
                    },
                    {
                      "action": "enterprise_group_updated",
                      "actor": {
                        "email": "user@example.com",
                        "id": "000000000000000000000008",
                        "name": "Session User m23-nested-gus"
                      },
                      "at": "2026-01-01T00:00:00.000Z",
                      "details": {
                        "changed": [
                          "includes"
                        ],
                        "enterpriseId": "000000000000000000000001",
                        "excluded": [
                          {
                            "groupId": "000000000000000000000010",
                            "name": "Backend"
                          }
                        ],
                        "group": "Engineering",
                        "groupId": "000000000000000000000009",
                        "included": [],
                        "reached": 2,
                        "via": "app",
                        "workspaceId": "000000000000000000000011"
                      },
                      "id": "000000000000000000000013",
                      "ip": "127.0.0.1",
                      "userAgent": "undefined"
                    },
                    {
                      "action": "enterprise_group_updated",
                      "actor": {
                        "email": "user@example.com",
                        "id": "000000000000000000000008",
                        "name": "Session User m23-nested-gus"
                      },
                      "at": "2026-01-01T00:00:00.000Z",
                      "details": {
                        "changed": [
                          "includes"
                        ],
                        "enterpriseId": "000000000000000000000001",
                        "excluded": [],
                        "group": "Engineering",
                        "groupId": "000000000000000000000009",
                        "included": [
                          {
                            "groupId": "000000000000000000000010",
                            "name": "Backend"
                          }
                        ],
                        "reached": 2,
                        "via": "app",
                        "workspaceId": "000000000000000000000011"
                      },
                      "id": "000000000000000000000014",
                      "ip": "127.0.0.1",
                      "userAgent": "undefined"
                    },
                    {
                      "action": "enterprise_group_updated",
                      "actor": {
                        "email": "user@example.com",
                        "id": "000000000000000000000008",
                        "name": "Session User m23-nested-gus"
                      },
                      "at": "2026-01-01T00:00:00.000Z",
                      "details": {
                        "changed": [
                          "includes"
                        ],
                        "enterpriseId": "000000000000000000000001",
                        "excluded": [
                          {
                            "groupId": "000000000000000000000010",
                            "name": "Backend"
                          }
                        ],
                        "group": "Engineering",
                        "groupId": "000000000000000000000009",
                        "included": [],
                        "reached": 2,
                        "via": "app",
                        "workspaceId": "000000000000000000000011"
                      },
                      "id": "000000000000000000000015",
                      "ip": "127.0.0.1",
                      "userAgent": "undefined"
                    },
                    {
                      "action": "enterprise_group_updated",
                      "actor": {
                        "email": "user@example.com",
                        "id": "000000000000000000000008",
                        "name": "Session User m23-nested-gus"
                      },
                      "at": "2026-01-01T00:00:00.000Z",
                      "details": {
                        "changed": [
                          "workspaces"
                        ],
                        "enterpriseId": "000000000000000000000001",
                        "group": "Engineering",
                        "groupId": "000000000000000000000009",
                        "reached": 2,
                        "via": "app",
                        "workspaceId": "000000000000000000000011"
                      },
                      "id": "000000000000000000000016",
                      "ip": "127.0.0.1",
                      "userAgent": "undefined"
                    },
                    {
                      "action": "enterprise_group_updated",
                      "actor": {
                        "email": "user@example.com",
                        "id": "000000000000000000000017",
                        "name": "Session User m23-nested-ada"
                      },
                      "at": "2026-01-01T00:00:00.000Z",
                      "details": {
                        "changed": [
                          "includes"
                        ],
                        "enterpriseId": "000000000000000000000001",
                        "excluded": [
                          {
                            "groupId": "000000000000000000000010",
                            "name": "Backend"
                          }
                        ],
                        "group": "Security reviewers",
                        "groupId": "000000000000000000000003",
                        "included": [],
                        "reached": 2,
                        "stepUp": {
                          "at": "2026-01-01T00:00:00.000Z",
                          "method": "passkey"
                        },
                        "via": "app",
                        "workspaceId": "000000000000000000000011"
                      },
                      "id": "000000000000000000000018",
                      "ip": "127.0.0.1",
                      "userAgent": "undefined"
                    },
                    {
                      "action": "enterprise_group_updated",
                      "actor": {
                        "email": "user@example.com",
                        "id": "000000000000000000000017",
                        "name": "Session User m23-nested-ada"
                      },
                      "at": "2026-01-01T00:00:00.000Z",
                      "details": {
                        "changed": [
                          "includes"
                        ],
                        "enterpriseId": "000000000000000000000001",
                        "excluded": [],
                        "group": "Security reviewers",
                        "groupId": "000000000000000000000003",
                        "included": [
                          {
                            "groupId": "000000000000000000000010",
                            "name": "Backend"
                          }
                        ],
                        "reached": 2,
                        "stepUp": {
                          "at": "2026-01-01T00:00:00.000Z",
                          "method": "passkey"
                        },
                        "via": "app",
                        "workspaceId": "000000000000000000000011"
                      },
                      "id": "000000000000000000000019",
                      "ip": "127.0.0.1",
                      "userAgent": "undefined"
                    }
                  ],
                  "nextCursor": null
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/audit/export": {
      "get": {
        "operationId": "workspaces.enterprise.audit.export.list",
        "summary": "Export the company's audit trail as CSV",
        "description": "Needs the `activity` area at `view`. Streams a `text/csv` attachment within the plan's retention window, and records the export in the trail.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/audit/exports": {
      "post": {
        "operationId": "workspaces.enterprise.audit.exports.create",
        "summary": "Request an export of the company's WorkOS audit log",
        "description": "Needs the `activity` area at `view`; rate limited per company. Exports from the app owner's WorkOS account cover at most 31 days of the last three months (422 `export_window`, `export_empty`); 409 `audit_logs_off` when company audit logs are off. Older entries are in the CSV export.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  },
                  "to": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  },
                  "actions": {
                    "type": "array",
                    "maxItems": 89,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "rangeEnd": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "rangeStart": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "id": "audit_log_export_01STUB51D88C0BE978E36AA9FD",
                  "rangeEnd": "2026-01-01T00:00:00.000Z",
                  "rangeStart": "2026-01-01T00:00:00.000Z",
                  "state": "pending"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          },
          {
            "prefix": "enterprise-audit-export",
            "windowMs": 60000,
            "max": 10,
            "per": "enterpriseLimiterKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/audit/exports/{exportId}": {
      "get": {
        "operationId": "workspaces.enterprise.audit.exports.get",
        "summary": "Get a WorkOS audit log export and its download link",
        "description": "Needs the `activity` area at `view`. Includes a short-lived download link once the export is ready; answered `no-store`. 404 when the export is not the company's.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "exportId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "rangeEnd": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "rangeStart": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "id": "audit_log_export_01STUB51D88C0BE978E36AA9FD",
                  "rangeEnd": "2026-01-01T00:00:00.000Z",
                  "rangeStart": "2026-01-01T00:00:00.000Z",
                  "state": "pending"
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "enterprise-audit-read",
            "windowMs": 60000,
            "max": 60,
            "per": "enterpriseLimiterKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/claim": {
      "post": {
        "operationId": "workspaces.enterprise.claim.create",
        "summary": "Bring accounts on the company's domains into the company",
        "description": "Needs the `people` area at `manage`. Links the named `userIds` (or `all`, capped per call) to the company, joins them to its bound workspaces without email, and signs each one out. Returns `claimed`, `skipped` and `remaining`; 403 `managed_by_app` while the app's team manages the settings.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "userIds": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 100,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  },
                  "all": {
                    "type": "boolean",
                    "const": true
                  }
                },
                "additionalProperties": false,
                "oneOf": [
                  {
                    "required": [
                      "userIds"
                    ]
                  },
                  {
                    "required": [
                      "all"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.person_joined"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/connected-apps": {
      "get": {
        "operationId": "workspaces.enterprise.connectedApps.list",
        "summary": "List the apps and agents the company's people have connected",
        "description": "Needs the `apps` area at `view`. Each app with how many of the company's people connected it.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/connected-apps/revoke": {
      "post": {
        "operationId": "workspaces.enterprise.connectedApps.revoke.create",
        "summary": "Disconnect an app or agent for one person or the whole company",
        "description": "Needs the `apps` area at `manage`. Revokes the grant, its tokens and the sessions bound to them for `userId`, or for everyone when it is left out. 422 `not_enterprise_people` when the user is not the company's; 403 `managed_by_app`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clientId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512
                  },
                  "userId": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  }
                },
                "required": [
                  "clientId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "people": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "people": 1
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/connected-apps/{clientId}": {
      "get": {
        "operationId": "workspaces.enterprise.connectedApps.get",
        "summary": "List one app's grants among the company's people",
        "description": "Needs the `apps` area at `view`. 404 when no one in the company connected that client.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "clientId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/domains/sync": {
      "post": {
        "operationId": "workspaces.enterprise.domains.sync.create",
        "summary": "Re-read the company's verified domains from WorkOS",
        "description": "Needs the `setup` area at `manage`. Reconciles the domains with the app owner's WorkOS account and returns what was added, removed and refused. 502 `workos_error` when WorkOS cannot be reached.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "added": {
                      "type": "array"
                    },
                    "domains": {
                      "items": {
                        "properties": {
                          "domain": {
                            "type": "string"
                          },
                          "lastError": {},
                          "source": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "verifiedAt": {
                            "format": "date-time",
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "refused": {
                      "type": "array"
                    },
                    "removed": {
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "added": [],
                  "domains": [
                    {
                      "domain": "stepup-1767225600000.test",
                      "lastError": null,
                      "source": "workos",
                      "status": "verified",
                      "verifiedAt": "2026-01-01T00:00:00.000Z"
                    }
                  ],
                  "refused": [],
                  "removed": []
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/groups": {
      "get": {
        "operationId": "workspaces.enterprise.groups.list",
        "summary": "List the company's groups",
        "description": "Needs the `groups` area at `view`. Each group with its people and what it gives.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "groups": {
                      "items": {
                        "properties": {
                          "companyRole": {},
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "createdVia": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "groupId": {
                            "type": "string"
                          },
                          "includedIn": {
                            "type": "array"
                          },
                          "includes": {
                            "type": "array"
                          },
                          "inherited": {
                            "type": "array"
                          },
                          "linked": {
                            "items": {
                              "properties": {
                                "groupId": {
                                  "type": "string"
                                },
                                "source": {
                                  "type": "string"
                                }
                              },
                              "type": "object"
                            },
                            "type": "array"
                          },
                          "managers": {
                            "type": "array"
                          },
                          "members": {
                            "items": {
                              "properties": {
                                "email": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "userId": {
                                  "type": "string"
                                }
                              },
                              "type": "object"
                            },
                            "type": "array"
                          },
                          "name": {
                            "type": "string"
                          },
                          "people": {
                            "type": "integer"
                          },
                          "peopleBy": {
                            "properties": {
                              "included": {
                                "type": "integer"
                              },
                              "linked": {
                                "type": "integer"
                              },
                              "named": {
                                "type": "integer"
                              }
                            },
                            "type": "object"
                          },
                          "rolesReached": {
                            "type": "array"
                          },
                          "workos": {},
                          "workspaces": {
                            "items": {
                              "properties": {
                                "role": {
                                  "type": "string"
                                },
                                "workspaceId": {
                                  "type": "string"
                                },
                                "workspaceName": {
                                  "type": "string"
                                }
                              },
                              "type": "object"
                            },
                            "type": "array"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "limits": {
                      "properties": {
                        "depth": {
                          "type": "integer"
                        },
                        "includes": {
                          "type": "integer"
                        },
                        "managers": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "max": {
                      "type": "integer"
                    },
                    "workspaces": {
                      "items": {
                        "properties": {
                          "autoJoin": {
                            "type": "boolean"
                          },
                          "name": {
                            "type": "string"
                          },
                          "roles": {
                            "items": {
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "workspaceId": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "groups": [
                    {
                      "companyRole": null,
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "createdVia": "app",
                      "description": "",
                      "groupId": "000000000000000000000001",
                      "includedIn": [],
                      "includes": [],
                      "inherited": [],
                      "linked": [
                        {
                          "groupId": "Finance team",
                          "source": "sso_group"
                        }
                      ],
                      "managers": [],
                      "members": [],
                      "name": "Finance",
                      "people": 1,
                      "peopleBy": {
                        "included": 0,
                        "linked": 1,
                        "named": 0
                      },
                      "rolesReached": [],
                      "workos": null,
                      "workspaces": [
                        {
                          "role": "editor",
                          "workspaceId": "000000000000000000000002",
                          "workspaceName": "Finance 1767225600000"
                        }
                      ]
                    },
                    {
                      "companyRole": null,
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "createdVia": "app",
                      "description": "",
                      "groupId": "000000000000000000000003",
                      "includedIn": [],
                      "includes": [],
                      "inherited": [],
                      "linked": [],
                      "managers": [],
                      "members": [
                        {
                          "email": "user@example.com",
                          "name": "Session User m12-cy",
                          "userId": "000000000000000000000004"
                        }
                      ],
                      "name": "Auditors",
                      "people": 1,
                      "peopleBy": {
                        "included": 0,
                        "linked": 0,
                        "named": 1
                      },
                      "rolesReached": [],
                      "workos": null,
                      "workspaces": []
                    },
                    {
                      "companyRole": null,
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "createdVia": "app",
                      "description": "",
                      "groupId": "000000000000000000000005",
                      "includedIn": [],
                      "includes": [],
                      "inherited": [],
                      "linked": [],
                      "managers": [],
                      "members": [
                        {
                          "email": "user@example.com",
                          "name": "Session User m12-dee",
                          "userId": "000000000000000000000006"
                        }
                      ],
                      "name": "Support",
                      "people": 1,
                      "peopleBy": {
                        "included": 0,
                        "linked": 0,
                        "named": 1
                      },
                      "rolesReached": [],
                      "workos": null,
                      "workspaces": []
                    },
                    {
                      "companyRole": null,
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "createdVia": "app",
                      "description": "",
                      "groupId": "000000000000000000000007",
                      "includedIn": [],
                      "includes": [],
                      "inherited": [],
                      "linked": [],
                      "managers": [],
                      "members": [
                        {
                          "email": "user@example.com",
                          "name": "Session User m12-dee",
                          "userId": "000000000000000000000006"
                        }
                      ],
                      "name": "From the API",
                      "people": 1,
                      "peopleBy": {
                        "included": 0,
                        "linked": 0,
                        "named": 1
                      },
                      "rolesReached": [],
                      "workos": null,
                      "workspaces": []
                    }
                  ],
                  "limits": {
                    "depth": 3,
                    "includes": 10,
                    "managers": 10
                  },
                  "max": 50,
                  "workspaces": [
                    {
                      "autoJoin": true,
                      "name": "Design 1767225600000",
                      "roles": [
                        "admin",
                        "editor",
                        "viewer",
                        "reviewer"
                      ],
                      "workspaceId": "000000000000000000000008"
                    },
                    {
                      "autoJoin": false,
                      "name": "Finance 1767225600000",
                      "roles": [
                        "admin",
                        "editor",
                        "viewer",
                        "reviewer"
                      ],
                      "workspaceId": "000000000000000000000002"
                    }
                  ]
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      },
      "post": {
        "operationId": "workspaces.enterprise.groups.create",
        "summary": "Create a company group",
        "description": "Needs the `groups` area at `manage` and the app's plan to include Enterprise SSO (402). A group that reaches a company role also needs a recent sign-in (403 `reauth_required`). 409 `name_taken`, 422 `too_many_groups`, 403 `managed_by_app`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 280
                  },
                  "members": {
                    "type": "array",
                    "maxItems": 1000,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  },
                  "linked": {
                    "type": "array",
                    "maxItems": 6,
                    "items": {
                      "type": "object",
                      "properties": {
                        "source": {
                          "type": "string",
                          "enum": [
                            "workos_role",
                            "directory",
                            "sso_role",
                            "sso_group"
                          ]
                        },
                        "groupId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "groupName": {
                          "type": "string",
                          "maxLength": 200
                        }
                      },
                      "required": [
                        "source",
                        "groupId"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "workspaces": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "object",
                      "properties": {
                        "workspaceId": {
                          "type": "string",
                          "pattern": "^[a-f0-9]{24}$"
                        },
                        "role": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        }
                      },
                      "required": [
                        "workspaceId",
                        "role"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "companyRole": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^([a-f0-9]{24}|[a-z][a-z-]{0,39})$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "assignableInWorkOS": {
                    "type": "boolean"
                  },
                  "includes": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "applied": {
                      "type": "integer"
                    },
                    "group": {
                      "properties": {
                        "companyRole": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "companyRoleName": {
                          "type": "string"
                        },
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "createdVia": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "groupId": {
                          "type": "string"
                        },
                        "includedIn": {
                          "type": "array"
                        },
                        "includes": {
                          "type": "array"
                        },
                        "inherited": {
                          "type": "array"
                        },
                        "linked": {
                          "items": {
                            "properties": {
                              "groupId": {
                                "type": "string"
                              },
                              "groupName": {
                                "type": "string"
                              },
                              "source": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "managers": {
                          "type": "array"
                        },
                        "members": {
                          "items": {
                            "properties": {
                              "email": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "userId": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "name": {
                          "type": "string"
                        },
                        "people": {
                          "type": "integer"
                        },
                        "peopleBy": {
                          "properties": {
                            "included": {
                              "type": "integer"
                            },
                            "linked": {
                              "type": "integer"
                            },
                            "named": {
                              "type": "integer"
                            }
                          },
                          "type": "object"
                        },
                        "rolesReached": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "workos": {},
                        "workspaces": {
                          "items": {
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "workspaceId": {
                                "type": "string"
                              },
                              "workspaceName": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "pending": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "applied": 2,
                  "group": {
                    "companyRole": null,
                    "createdAt": "2026-01-01T00:00:00.000Z",
                    "createdVia": "app",
                    "description": "",
                    "groupId": "000000000000000000000001",
                    "includedIn": [],
                    "includes": [],
                    "inherited": [],
                    "linked": [
                      {
                        "groupId": "directory_group_01STUB5AFD616E105DFD330795",
                        "groupName": "backend-eng",
                        "source": "directory"
                      }
                    ],
                    "managers": [],
                    "members": [
                      {
                        "email": "user@example.com",
                        "name": "Session User m23-nested-priya",
                        "userId": "000000000000000000000002"
                      }
                    ],
                    "name": "Backend",
                    "people": 2,
                    "peopleBy": {
                      "included": 0,
                      "linked": 1,
                      "named": 1
                    },
                    "rolesReached": [],
                    "workos": null,
                    "workspaces": [
                      {
                        "role": "viewer",
                        "workspaceId": "000000000000000000000003",
                        "workspaceName": "Globex support 1767225600000"
                      }
                    ]
                  },
                  "pending": 0
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.group_created",
          "enterprise.group_members_changed"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/groups/{groupId}": {
      "get": {
        "operationId": "workspaces.enterprise.groups.get",
        "summary": "Get a company group",
        "description": "Needs the `groups` area at `view`, or being one of the group's managers. Returns what it gives (directly and through the groups that include it), the groups inside and around it, and its managers.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "companyRole": {},
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "createdVia": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "groupId": {
                      "type": "string"
                    },
                    "includedIn": {
                      "type": "array"
                    },
                    "includes": {
                      "type": "array"
                    },
                    "inherited": {
                      "type": "array"
                    },
                    "linked": {
                      "type": "array"
                    },
                    "managers": {
                      "items": {
                        "properties": {
                          "active": {
                            "type": "boolean"
                          },
                          "addedAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "addedVia": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "userId": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "members": {
                      "type": "array"
                    },
                    "name": {
                      "type": "string"
                    },
                    "people": {
                      "type": "integer"
                    },
                    "peopleBy": {
                      "properties": {
                        "included": {
                          "type": "integer"
                        },
                        "linked": {
                          "type": "integer"
                        },
                        "named": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "rolesReached": {
                      "type": "array"
                    },
                    "workos": {},
                    "workspaces": {
                      "items": {
                        "properties": {
                          "role": {
                            "type": "string"
                          },
                          "workspaceId": {
                            "type": "string"
                          },
                          "workspaceName": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "companyRole": null,
                  "createdAt": "2026-01-01T00:00:00.000Z",
                  "createdVia": "console",
                  "description": "",
                  "groupId": "000000000000000000000001",
                  "includedIn": [],
                  "includes": [],
                  "inherited": [],
                  "linked": [],
                  "managers": [
                    {
                      "active": true,
                      "addedAt": "2026-01-01T00:00:00.000Z",
                      "addedVia": "app",
                      "email": "user@example.com",
                      "name": "mia Directory",
                      "userId": "000000000000000000000002"
                    },
                    {
                      "active": true,
                      "addedAt": "2026-01-01T00:00:00.000Z",
                      "addedVia": "app",
                      "email": "user@example.com",
                      "name": "Session User m23-managers-kai",
                      "userId": "000000000000000000000003"
                    }
                  ],
                  "members": [],
                  "name": "Backend",
                  "people": 0,
                  "peopleBy": {
                    "included": 0,
                    "linked": 0,
                    "named": 0
                  },
                  "rolesReached": [],
                  "workos": null,
                  "workspaces": [
                    {
                      "role": "viewer",
                      "workspaceId": "000000000000000000000004",
                      "workspaceName": "Globex support 1767225600000"
                    }
                  ]
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      },
      "delete": {
        "operationId": "workspaces.enterprise.groups.delete",
        "summary": "Delete a company group",
        "description": "Needs the `groups` area at `manage`; a group that reaches a company role also needs a recent sign-in (403 `reauth_required`). Everyone in it loses what it gave.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "applied": {
                      "type": "integer"
                    },
                    "pending": {
                      "type": "integer"
                    },
                    "people": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "applied": 0,
                  "pending": 0,
                  "people": 0
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.group_deleted"
        ]
      },
      "patch": {
        "operationId": "workspaces.enterprise.groups.update",
        "summary": "Update a company group's name, people, workspaces or role",
        "description": "Needs the `groups` area at `manage`; a change that reaches a company role also needs a recent sign-in (403 `reauth_required`). 409 `name_taken` or a nesting cycle, 422 when nested too deep.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 280
                  },
                  "members": {
                    "type": "array",
                    "maxItems": 1000,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  },
                  "linked": {
                    "type": "array",
                    "maxItems": 6,
                    "items": {
                      "type": "object",
                      "properties": {
                        "source": {
                          "type": "string",
                          "enum": [
                            "workos_role",
                            "directory",
                            "sso_role",
                            "sso_group"
                          ]
                        },
                        "groupId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "groupName": {
                          "type": "string",
                          "maxLength": 200
                        }
                      },
                      "required": [
                        "source",
                        "groupId"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "workspaces": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "object",
                      "properties": {
                        "workspaceId": {
                          "type": "string",
                          "pattern": "^[a-f0-9]{24}$"
                        },
                        "role": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        }
                      },
                      "required": [
                        "workspaceId",
                        "role"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "companyRole": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^([a-f0-9]{24}|[a-z][a-z-]{0,39})$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "assignableInWorkOS": {
                    "type": "boolean"
                  },
                  "includes": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "applied": {
                      "type": "integer"
                    },
                    "group": {
                      "properties": {
                        "companyRole": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "companyRoleName": {
                          "type": "string"
                        },
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "createdVia": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "groupId": {
                          "type": "string"
                        },
                        "includedIn": {
                          "items": {
                            "properties": {
                              "groupId": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "includes": {
                          "items": {
                            "properties": {
                              "groupId": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "inherited": {
                          "items": {
                            "properties": {
                              "companyRole": {},
                              "from": {
                                "properties": {
                                  "groupId": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "type": "object"
                              },
                              "workspaces": {
                                "items": {
                                  "properties": {
                                    "role": {
                                      "type": "string"
                                    },
                                    "workspaceId": {
                                      "type": "string"
                                    },
                                    "workspaceName": {
                                      "type": "string"
                                    }
                                  },
                                  "type": "object"
                                },
                                "type": "array"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "linked": {
                          "items": {
                            "properties": {
                              "groupId": {
                                "type": "string"
                              },
                              "groupName": {
                                "type": "string"
                              },
                              "source": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "managers": {
                          "type": "array"
                        },
                        "members": {
                          "items": {
                            "properties": {
                              "email": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "userId": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "name": {
                          "type": "string"
                        },
                        "people": {
                          "type": "integer"
                        },
                        "peopleBy": {
                          "properties": {
                            "included": {
                              "type": "integer"
                            },
                            "linked": {
                              "type": "integer"
                            },
                            "named": {
                              "type": "integer"
                            }
                          },
                          "type": "object"
                        },
                        "rolesReached": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "workos": {
                          "properties": {
                            "publishedAt": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "publishedBy": {
                              "type": "string"
                            },
                            "slug": {
                              "type": "string"
                            },
                            "state": {
                              "type": "string"
                            }
                          },
                          "type": [
                            "null",
                            "object"
                          ]
                        },
                        "workspaces": {
                          "items": {
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "workspaceId": {
                                "type": "string"
                              },
                              "workspaceName": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "pending": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "applied": 1,
                  "group": {
                    "companyRole": null,
                    "createdAt": "2026-01-01T00:00:00.000Z",
                    "createdVia": "app",
                    "description": "",
                    "groupId": "000000000000000000000001",
                    "includedIn": [
                      {
                        "groupId": "000000000000000000000002",
                        "name": "Engineering"
                      }
                    ],
                    "includes": [
                      {
                        "groupId": "000000000000000000000003",
                        "name": "On-call"
                      }
                    ],
                    "inherited": [
                      {
                        "companyRole": null,
                        "from": {
                          "groupId": "000000000000000000000002",
                          "name": "Engineering"
                        },
                        "workspaces": [
                          {
                            "role": "editor",
                            "workspaceId": "000000000000000000000004",
                            "workspaceName": "Globex design 1767225600000"
                          }
                        ]
                      }
                    ],
                    "linked": [
                      {
                        "groupId": "directory_group_01STUB5AFD616E105DFD330795",
                        "groupName": "backend-eng",
                        "source": "directory"
                      }
                    ],
                    "managers": [],
                    "members": [
                      {
                        "email": "user@example.com",
                        "name": "Session User m23-nested-priya",
                        "userId": "000000000000000000000005"
                      }
                    ],
                    "name": "Backend",
                    "people": 3,
                    "peopleBy": {
                      "included": 1,
                      "linked": 1,
                      "named": 1
                    },
                    "rolesReached": [],
                    "workos": null,
                    "workspaces": [
                      {
                        "role": "viewer",
                        "workspaceId": "000000000000000000000006",
                        "workspaceName": "Globex support 1767225600000"
                      }
                    ]
                  },
                  "pending": 0
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.group_updated",
          "enterprise.group_members_changed"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/groups/{groupId}/candidates": {
      "get": {
        "operationId": "workspaces.enterprise.groups.candidates.list",
        "summary": "Search the company's people who can be added to a group",
        "description": "Needs the `groups` area at `manage`, or being one of the group's managers. Searches the company's active people only, with its own per-person rate limit.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "people": {
                      "items": {
                        "properties": {
                          "email": {
                            "type": "string"
                          },
                          "inGroup": {
                            "type": "boolean"
                          },
                          "name": {
                            "type": "string"
                          },
                          "userId": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "people": [
                    {
                      "email": "user@example.com",
                      "inGroup": false,
                      "name": "Session User m23-managers-priya",
                      "userId": "000000000000000000000001"
                    }
                  ]
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "enterprise-group-candidates",
            "windowMs": 60000,
            "max": 30,
            "per": "groupCandidatesKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/groups/{groupId}/managers": {
      "post": {
        "operationId": "workspaces.enterprise.groups.managers.create",
        "summary": "Name a group manager",
        "description": "Needs the `groups` area at `manage`. The person must be one of the company's active people; a manager gives no company role, so no recent sign-in is asked. 422 when the group has too many managers.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "userId": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  }
                },
                "required": [
                  "userId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "group": {
                      "properties": {
                        "companyRole": {},
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "createdVia": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "groupId": {
                          "type": "string"
                        },
                        "includedIn": {
                          "type": "array"
                        },
                        "includes": {
                          "type": "array"
                        },
                        "inherited": {
                          "type": "array"
                        },
                        "linked": {
                          "type": "array"
                        },
                        "managers": {
                          "items": {
                            "properties": {
                              "active": {
                                "type": "boolean"
                              },
                              "addedAt": {
                                "format": "date-time",
                                "type": "string"
                              },
                              "addedVia": {
                                "type": "string"
                              },
                              "email": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "userId": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "members": {
                          "type": "array"
                        },
                        "name": {
                          "type": "string"
                        },
                        "people": {
                          "type": "integer"
                        },
                        "peopleBy": {
                          "properties": {
                            "included": {
                              "type": "integer"
                            },
                            "linked": {
                              "type": "integer"
                            },
                            "named": {
                              "type": "integer"
                            }
                          },
                          "type": "object"
                        },
                        "rolesReached": {
                          "type": "array"
                        },
                        "workos": {},
                        "workspaces": {
                          "items": {
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "workspaceId": {
                                "type": "string"
                              },
                              "workspaceName": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "group": {
                    "companyRole": null,
                    "createdAt": "2026-01-01T00:00:00.000Z",
                    "createdVia": "console",
                    "description": "",
                    "groupId": "000000000000000000000001",
                    "includedIn": [],
                    "includes": [],
                    "inherited": [],
                    "linked": [],
                    "managers": [
                      {
                        "active": true,
                        "addedAt": "2026-01-01T00:00:00.000Z",
                        "addedVia": "app",
                        "email": "user@example.com",
                        "name": "mia Directory",
                        "userId": "000000000000000000000002"
                      },
                      {
                        "active": true,
                        "addedAt": "2026-01-01T00:00:00.000Z",
                        "addedVia": "app",
                        "email": "user@example.com",
                        "name": "Session User m23-managers-kai",
                        "userId": "000000000000000000000003"
                      }
                    ],
                    "members": [],
                    "name": "Backend",
                    "people": 0,
                    "peopleBy": {
                      "included": 0,
                      "linked": 0,
                      "named": 0
                    },
                    "rolesReached": [],
                    "workos": null,
                    "workspaces": [
                      {
                        "role": "viewer",
                        "workspaceId": "000000000000000000000004",
                        "workspaceName": "Globex support 1767225600000"
                      }
                    ]
                  }
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.group_updated"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/groups/{groupId}/managers/{userId}": {
      "delete": {
        "operationId": "workspaces.enterprise.groups.managers.delete",
        "summary": "Remove a group manager",
        "description": "Needs the `groups` area at `manage`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.group_updated"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/groups/{groupId}/members": {
      "post": {
        "operationId": "workspaces.enterprise.groups.members.create",
        "summary": "Add or remove the people named in a group",
        "description": "Needs the `groups` area at `manage`, or being one of the group's managers. A manager may not change a group that reaches a company role, nor add themselves or another manager (403); a role holder changing such a group needs a recent sign-in (403 `reauth_required`).",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "add": {
                    "type": "array",
                    "maxItems": 100,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  },
                  "remove": {
                    "type": "array",
                    "maxItems": 100,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  }
                },
                "anyOf": [
                  {
                    "required": [
                      "add"
                    ],
                    "properties": {
                      "add": {
                        "minItems": 1
                      }
                    }
                  },
                  {
                    "required": [
                      "remove"
                    ],
                    "properties": {
                      "remove": {
                        "minItems": 1
                      }
                    }
                  }
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "added": {
                      "type": "integer"
                    },
                    "applied": {
                      "type": "integer"
                    },
                    "group": {
                      "properties": {
                        "companyRole": {},
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "createdVia": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "groupId": {
                          "type": "string"
                        },
                        "includedIn": {
                          "items": {
                            "properties": {
                              "groupId": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "includes": {
                          "type": "array"
                        },
                        "inherited": {
                          "items": {
                            "properties": {
                              "companyRole": {},
                              "from": {
                                "properties": {
                                  "groupId": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "type": "object"
                              },
                              "workspaces": {
                                "items": {
                                  "properties": {
                                    "role": {
                                      "type": "string"
                                    },
                                    "workspaceId": {
                                      "type": "string"
                                    },
                                    "workspaceName": {
                                      "type": "string"
                                    }
                                  },
                                  "type": "object"
                                },
                                "type": "array"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "linked": {
                          "type": "array"
                        },
                        "managers": {
                          "items": {
                            "properties": {
                              "active": {
                                "type": "boolean"
                              },
                              "addedAt": {
                                "format": "date-time",
                                "type": "string"
                              },
                              "addedVia": {
                                "type": "string"
                              },
                              "email": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "userId": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "members": {
                          "items": {
                            "properties": {
                              "email": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "userId": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "name": {
                          "type": "string"
                        },
                        "people": {
                          "type": "integer"
                        },
                        "peopleBy": {
                          "properties": {
                            "included": {
                              "type": "integer"
                            },
                            "linked": {
                              "type": "integer"
                            },
                            "named": {
                              "type": "integer"
                            }
                          },
                          "type": "object"
                        },
                        "rolesReached": {
                          "type": "array"
                        },
                        "workos": {},
                        "workspaces": {
                          "items": {
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "workspaceId": {
                                "type": "string"
                              },
                              "workspaceName": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "pending": {
                      "type": "integer"
                    },
                    "removed": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "added": 1,
                  "applied": 1,
                  "group": {
                    "companyRole": null,
                    "createdAt": "2026-01-01T00:00:00.000Z",
                    "createdVia": "console",
                    "description": "",
                    "groupId": "000000000000000000000001",
                    "includedIn": [
                      {
                        "groupId": "000000000000000000000002",
                        "name": "Engineering"
                      }
                    ],
                    "includes": [],
                    "inherited": [
                      {
                        "companyRole": null,
                        "from": {
                          "groupId": "000000000000000000000002",
                          "name": "Engineering"
                        },
                        "workspaces": [
                          {
                            "role": "editor",
                            "workspaceId": "000000000000000000000003",
                            "workspaceName": "Globex design 1767225600000"
                          }
                        ]
                      }
                    ],
                    "linked": [],
                    "managers": [
                      {
                        "active": true,
                        "addedAt": "2026-01-01T00:00:00.000Z",
                        "addedVia": "app",
                        "email": "user@example.com",
                        "name": "mia Directory",
                        "userId": "000000000000000000000004"
                      },
                      {
                        "active": true,
                        "addedAt": "2026-01-01T00:00:00.000Z",
                        "addedVia": "app",
                        "email": "user@example.com",
                        "name": "Session User m23-managers-kai",
                        "userId": "000000000000000000000005"
                      }
                    ],
                    "members": [
                      {
                        "email": "user@example.com",
                        "name": "Session User m23-managers-priya",
                        "userId": "000000000000000000000006"
                      },
                      {
                        "email": "user@example.com",
                        "name": "Session User m23-managers-lena",
                        "userId": "000000000000000000000007"
                      }
                    ],
                    "name": "Backend",
                    "people": 2,
                    "peopleBy": {
                      "included": 0,
                      "linked": 0,
                      "named": 2
                    },
                    "rolesReached": [],
                    "workos": null,
                    "workspaces": [
                      {
                        "role": "viewer",
                        "workspaceId": "000000000000000000000008",
                        "workspaceName": "Globex support 1767225600000"
                      }
                    ]
                  },
                  "pending": 0,
                  "removed": 0
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.group_members_changed"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/groups/{groupId}/people": {
      "get": {
        "operationId": "workspaces.enterprise.groups.people.list",
        "summary": "List the people in a group",
        "description": "Needs the `groups` area at `view`, or being one of the group's managers. Paged by `cursor` and filterable by `search`, with how each person is in the group.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 12,
              "pattern": "^[0-9]*$"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "capped": {
                      "type": "boolean"
                    },
                    "next": {},
                    "people": {
                      "items": {
                        "properties": {
                          "email": {
                            "type": "string"
                          },
                          "how": {
                            "items": {
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "name": {
                            "type": "string"
                          },
                          "through": {
                            "properties": {
                              "groupId": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "userId": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "total": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "capped": false,
                  "next": null,
                  "people": [
                    {
                      "email": "user@example.com",
                      "how": [
                        "included"
                      ],
                      "name": "dmitri Directory",
                      "through": {
                        "groupId": "000000000000000000000001",
                        "name": "Backend"
                      },
                      "userId": "000000000000000000000002"
                    },
                    {
                      "email": "user@example.com",
                      "how": [
                        "included"
                      ],
                      "name": "Session User m23-nested-priya",
                      "through": {
                        "groupId": "000000000000000000000001",
                        "name": "Backend"
                      },
                      "userId": "000000000000000000000003"
                    }
                  ],
                  "total": 2
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/insights": {
      "get": {
        "operationId": "workspaces.enterprise.insights.list",
        "summary": "Get the company's identity insights",
        "description": "Needs the `insights` area at `view`. `days` must be 7, 30 or 90 (400 `invalid_days`); limited to the app plan's audit retention window.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "agents": {
                      "properties": {
                        "byReason": {
                          "properties": {},
                          "type": "object"
                        },
                        "granted": {
                          "type": "integer"
                        },
                        "people": {
                          "type": "integer"
                        },
                        "refused": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "appTeam": {
                      "properties": {
                        "refused": {
                          "type": "integer"
                        },
                        "sessions": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "daily": {
                      "items": {
                        "properties": {
                          "day": {
                            "type": "string"
                          },
                          "refusals": {
                            "type": "integer"
                          },
                          "signIns": {
                            "type": "integer"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "days": {
                      "type": "integer"
                    },
                    "from": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "health": {
                      "properties": {
                        "certificate": {},
                        "connection": {
                          "type": "string"
                        },
                        "connections": {
                          "items": {
                            "properties": {
                              "label": {
                                "type": "string"
                              },
                              "state": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "directory": {},
                        "streams": {
                          "items": {
                            "properties": {
                              "kind": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "state": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "people": {
                      "properties": {
                        "active": {
                          "type": "integer"
                        },
                        "inactive": {
                          "type": "integer"
                        },
                        "notSignedIn": {
                          "type": "integer"
                        },
                        "provisioned": {
                          "type": "integer"
                        },
                        "signedIn": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "viaDomain": {
                          "type": "integer"
                        },
                        "viaSso": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "refusals": {
                      "properties": {
                        "byReason": {
                          "items": {
                            "properties": {
                              "count": {
                                "type": "integer"
                              },
                              "reason": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "network": {
                          "properties": {
                            "requests": {
                              "type": "integer"
                            },
                            "signIns": {
                              "type": "integer"
                            }
                          },
                          "type": "object"
                        },
                        "requests": {
                          "type": "integer"
                        },
                        "topEmails": {
                          "items": {
                            "properties": {
                              "count": {
                                "type": "integer"
                              },
                              "email": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "workspaces": {
                          "properties": {
                            "byReason": {
                              "properties": {},
                              "type": "object"
                            },
                            "refused": {
                              "type": "integer"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "signIns": {
                      "properties": {
                        "breakGlass": {
                          "type": "integer"
                        },
                        "byConnection": {
                          "items": {
                            "properties": {
                              "count": {
                                "type": "integer"
                              },
                              "label": {
                                "type": "string"
                              },
                              "ref": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "firstTime": {
                          "type": "integer"
                        },
                        "fromIdp": {
                          "type": "integer"
                        },
                        "people": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "to": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "workloads": {
                      "properties": {
                        "byReason": {
                          "properties": {},
                          "type": "object"
                        },
                        "credentials": {
                          "type": "integer"
                        },
                        "issued": {
                          "type": "integer"
                        },
                        "refused": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "agents": {
                    "byReason": {},
                    "granted": 0,
                    "people": 0,
                    "refused": 0
                  },
                  "appTeam": {
                    "refused": 0,
                    "sessions": 0
                  },
                  "daily": [
                    {
                      "day": "2026-10-12",
                      "refusals": 0,
                      "signIns": 0
                    },
                    {
                      "day": "2026-10-13",
                      "refusals": 0,
                      "signIns": 0
                    },
                    {
                      "day": "2026-10-14",
                      "refusals": 0,
                      "signIns": 0
                    },
                    {
                      "day": "2026-10-15",
                      "refusals": 0,
                      "signIns": 0
                    },
                    {
                      "day": "2026-10-16",
                      "refusals": 0,
                      "signIns": 0
                    },
                    {
                      "day": "2026-10-17",
                      "refusals": 0,
                      "signIns": 0
                    },
                    {
                      "day": "2026-10-18",
                      "refusals": 0,
                      "signIns": 0
                    },
                    {
                      "day": "2026-10-19",
                      "refusals": 0,
                      "signIns": 0
                    },
                    {
                      "day": "2026-10-20",
                      "refusals": 0,
                      "signIns": 0
                    },
                    {
                      "day": "2026-10-21",
                      "refusals": 0,
                      "signIns": 0
                    }
                  ],
                  "days": 30,
                  "from": "2026-01-01T00:00:00.000Z",
                  "health": {
                    "certificate": null,
                    "connection": "active",
                    "connections": [
                      {
                        "label": "Okta",
                        "state": "active"
                      }
                    ],
                    "directory": null,
                    "streams": [
                      {
                        "kind": "https",
                        "name": "Acme SIEM",
                        "state": "active"
                      },
                      {
                        "kind": "splunk",
                        "name": "Splunk",
                        "state": "active"
                      }
                    ]
                  },
                  "people": {
                    "active": 5,
                    "inactive": 0,
                    "notSignedIn": 0,
                    "provisioned": 0,
                    "signedIn": 5,
                    "total": 5,
                    "viaDomain": 0,
                    "viaSso": 5
                  },
                  "refusals": {
                    "byReason": [
                      {
                        "count": 1,
                        "reason": "sso_email_mismatch"
                      }
                    ],
                    "network": {
                      "requests": 0,
                      "signIns": 0
                    },
                    "requests": 0,
                    "topEmails": [
                      {
                        "count": 1,
                        "email": "user@example.com"
                      }
                    ],
                    "total": 1,
                    "workspaces": {
                      "byReason": {},
                      "refused": 0
                    }
                  },
                  "signIns": {
                    "breakGlass": 0,
                    "byConnection": [
                      {
                        "count": 6,
                        "label": "Okta",
                        "ref": "d6c231291bea80e7",
                        "type": "OktaSAML"
                      }
                    ],
                    "firstTime": 5,
                    "fromIdp": 0,
                    "people": 5,
                    "total": 6
                  },
                  "to": "2026-01-01T00:00:00.000Z",
                  "workloads": {
                    "byReason": {},
                    "credentials": 0,
                    "issued": 0,
                    "refused": 0
                  }
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/join-requests": {
      "get": {
        "operationId": "workspaces.enterprise.joinRequests.list",
        "summary": "List requests to join the company",
        "description": "Needs the `people` area at `view`. Waiting requests come first; pass the answer's `pendingNext` as `before` for older ones (400 `invalid_cursor`).",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/join-requests/{requestId}/approve": {
      "post": {
        "operationId": "workspaces.enterprise.joinRequests.approve.create",
        "summary": "Approve a request to join the company",
        "description": "Needs the `people` area at `manage`. Links the person to the company and joins them to its bound workspaces. 409 `already_decided` or `cannot_join`; 403 `managed_by_app`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "requestId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.person_joined"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/join-requests/{requestId}/decline": {
      "post": {
        "operationId": "workspaces.enterprise.joinRequests.decline.create",
        "summary": "Decline a request to join the company",
        "description": "Needs the `people` area at `manage`. 409 `already_decided`; 403 `managed_by_app`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "requestId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.join_request_declined"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/keys": {
      "get": {
        "operationId": "workspaces.enterprise.keys.list",
        "summary": "List the company's API keys",
        "description": "Needs the `keys` area at `view`. Newest first, revoked and expired keys included, with the company API address the keys call.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "apiBase": {
                      "type": "string"
                    },
                    "keys": {
                      "items": {
                        "properties": {
                          "createdAt": {
                            "type": "string"
                          },
                          "createdVia": {
                            "type": "string"
                          },
                          "expiresAt": {
                            "type": "string"
                          },
                          "ipRanges": {
                            "type": "array"
                          },
                          "keyId": {
                            "type": "string"
                          },
                          "lastUsedAt": {},
                          "lastUsedIp": {},
                          "name": {
                            "type": "string"
                          },
                          "owner": {
                            "properties": {
                              "email": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "userId": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "preview": {
                            "type": "string"
                          },
                          "revokedAt": {},
                          "revokedReason": {},
                          "scopes": {
                            "items": {
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "state": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "max": {
                      "type": "integer"
                    },
                    "olderHidden": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "apiBase": "http://localhost:3000/api/v1/company",
                  "keys": [
                    {
                      "createdAt": "[REDACTED]",
                      "createdVia": "[REDACTED]",
                      "expiresAt": "[REDACTED]",
                      "ipRanges": [],
                      "keyId": "[REDACTED]",
                      "lastUsedAt": null,
                      "lastUsedIp": null,
                      "name": "[REDACTED]",
                      "owner": {
                        "email": "[REDACTED]",
                        "name": "[REDACTED]",
                        "type": "[REDACTED]",
                        "userId": "[REDACTED]"
                      },
                      "preview": "[REDACTED]",
                      "revokedAt": null,
                      "revokedReason": null,
                      "scopes": [
                        "[REDACTED]",
                        "[REDACTED]"
                      ],
                      "state": "[REDACTED]"
                    }
                  ],
                  "max": 50,
                  "olderHidden": 0
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      },
      "post": {
        "operationId": "workspaces.enterprise.keys.create",
        "summary": "Create a company API key",
        "description": "Needs the `keys` area at `manage`, a recent sign-in (403 `reauth_required`) and the app's plan to include Enterprise SSO (402). The key is the caller's own (which needs named company admins, 422 `admins_required`) or a service account's; the secret is returned only in this answer. 422 `too_many_keys`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "scopes": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 15,
                    "items": {
                      "type": "string",
                      "maxLength": 32
                    }
                  },
                  "serviceAccountId": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  },
                  "expiresInDays": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "ipRanges": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "string",
                      "maxLength": 64
                    }
                  }
                },
                "required": [
                  "name",
                  "scopes"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "key": {
                      "properties": {
                        "createdAt": {
                          "type": "string"
                        },
                        "createdVia": {
                          "type": "string"
                        },
                        "expiresAt": {
                          "type": "string"
                        },
                        "ipRanges": {
                          "type": "array"
                        },
                        "keyId": {
                          "type": "string"
                        },
                        "lastUsedAt": {},
                        "lastUsedIp": {},
                        "name": {
                          "type": "string"
                        },
                        "owner": {
                          "properties": {
                            "email": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "serviceAccountId": {
                              "type": "string"
                            },
                            "type": {
                              "type": "string"
                            },
                            "userId": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "preview": {
                          "type": "string"
                        },
                        "revokedAt": {},
                        "revokedReason": {},
                        "scopes": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "state": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "secret": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "key": {
                    "createdAt": "[REDACTED]",
                    "createdVia": "[REDACTED]",
                    "expiresAt": "[REDACTED]",
                    "ipRanges": [],
                    "keyId": "[REDACTED]",
                    "lastUsedAt": null,
                    "lastUsedIp": null,
                    "name": "[REDACTED]",
                    "owner": {
                      "email": "[REDACTED]",
                      "name": "[REDACTED]",
                      "type": "[REDACTED]",
                      "userId": "[REDACTED]"
                    },
                    "preview": "[REDACTED]",
                    "revokedAt": null,
                    "revokedReason": null,
                    "scopes": [
                      "[REDACTED]",
                      "[REDACTED]"
                    ],
                    "state": "[REDACTED]"
                  },
                  "secret": "[REDACTED]"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.key_created"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/keys/{keyId}": {
      "delete": {
        "operationId": "workspaces.enterprise.keys.delete",
        "summary": "Revoke a company API key",
        "description": "Needs the `keys` area at `manage`. Returns the revoked key.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "keyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "createdVia": {
                      "type": "string"
                    },
                    "expiresAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "ipRanges": {
                      "type": "array"
                    },
                    "keyId": {
                      "type": "string"
                    },
                    "lastUsedAt": {},
                    "lastUsedIp": {},
                    "name": {
                      "type": "string"
                    },
                    "owner": {
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "serviceAccountId": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "preview": {
                      "type": "string"
                    },
                    "revokedAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "revokedReason": {
                      "type": "string"
                    },
                    "scopes": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "state": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "createdAt": "2026-01-01T00:00:00.000Z",
                  "createdVia": "app",
                  "expiresAt": "2026-01-01T00:00:00.000Z",
                  "ipRanges": [],
                  "keyId": "[REDACTED]",
                  "lastUsedAt": null,
                  "lastUsedIp": null,
                  "name": "To revoke",
                  "owner": {
                    "name": "SIEM reader",
                    "serviceAccountId": "000000000000000000000001",
                    "type": "service_account"
                  },
                  "preview": "bbck_…82AM",
                  "revokedAt": "2026-01-01T00:00:00.000Z",
                  "revokedReason": "revoked",
                  "scopes": [
                    "audit:read"
                  ],
                  "state": "revoked"
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.key_revoked"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/log-stream": {
      "get": {
        "operationId": "workspaces.enterprise.logStream.list",
        "summary": "Get the company's WorkOS log stream",
        "description": "Needs the `streams` area at `view`. Read only - the app's team sets the stream up from the console. Null when the company has none; 409 `audit_logs_off` when company audit logs are off.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "retentionDays": {
                      "type": "integer"
                    },
                    "stream": {}
                  },
                  "type": "object"
                },
                "example": {
                  "retentionDays": 30,
                  "stream": null
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "enterprise-audit-read",
            "windowMs": 60000,
            "max": 60,
            "per": "enterpriseLimiterKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/log-streams": {
      "get": {
        "operationId": "workspaces.enterprise.logStreams.list",
        "summary": "List the company's log streams to its SIEM",
        "description": "Needs company access `streams` at `view` (until a Company admin is named, `workspace:settings:edit`). Returns `streams` and `companyManages`, whether the company's admins may change them. 404 when no enterprise is bound to the workspace.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "companyManages": {
                      "type": "boolean"
                    },
                    "streams": {
                      "items": {
                        "properties": {
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "delivered": {
                            "type": "integer"
                          },
                          "enabled": {
                            "type": "boolean"
                          },
                          "failingSince": {},
                          "failures": {
                            "type": "integer"
                          },
                          "hasAuthorization": {
                            "type": "boolean"
                          },
                          "id": {
                            "type": "string"
                          },
                          "index": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "lastAttemptAt": {
                            "format": "date-time",
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "lastDeliveredAt": {
                            "format": "date-time",
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "lastError": {
                            "properties": {
                              "at": {
                                "format": "date-time",
                                "type": "string"
                              },
                              "message": {
                                "type": "string"
                              },
                              "status": {
                                "type": "integer"
                              }
                            },
                            "type": [
                              "null",
                              "object"
                            ]
                          },
                          "lastTest": {
                            "properties": {
                              "at": {
                                "format": "date-time",
                                "type": "string"
                              },
                              "ok": {
                                "type": "boolean"
                              },
                              "status": {
                                "type": "integer"
                              }
                            },
                            "type": [
                              "null",
                              "object"
                            ]
                          },
                          "name": {
                            "type": "string"
                          },
                          "nextAttemptAt": {},
                          "pending": {
                            "type": "integer"
                          },
                          "secretPreview": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string"
                          },
                          "updatedAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "companyManages": false,
                  "streams": [
                    {
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "delivered": 22,
                      "enabled": true,
                      "failingSince": null,
                      "failures": 0,
                      "hasAuthorization": true,
                      "id": "000000000000000000000001",
                      "kind": "https",
                      "lastAttemptAt": "2026-01-01T00:00:00.000Z",
                      "lastDeliveredAt": "2026-01-01T00:00:00.000Z",
                      "lastError": {
                        "at": "2026-01-01T00:00:00.000Z",
                        "message": "{\"error\":\"the sink was told to fail\"}",
                        "status": 503
                      },
                      "lastTest": {
                        "at": "2026-01-01T00:00:00.000Z",
                        "ok": true,
                        "status": 200
                      },
                      "name": "Acme SIEM",
                      "nextAttemptAt": null,
                      "pending": 4,
                      "secretPreview": "[REDACTED]",
                      "state": "active",
                      "updatedAt": "2026-01-01T00:00:00.000Z",
                      "url": "http://127.0.0.1:4199/__sink/https-1767225600000/ingest?..."
                    },
                    {
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "delivered": 16,
                      "enabled": true,
                      "failingSince": null,
                      "failures": 0,
                      "id": "000000000000000000000002",
                      "index": "security",
                      "kind": "splunk",
                      "lastAttemptAt": "2026-01-01T00:00:00.000Z",
                      "lastDeliveredAt": "2026-01-01T00:00:00.000Z",
                      "lastError": null,
                      "lastTest": null,
                      "name": "Splunk",
                      "nextAttemptAt": null,
                      "pending": 4,
                      "secretPreview": "[REDACTED]",
                      "state": "active",
                      "updatedAt": "2026-01-01T00:00:00.000Z",
                      "url": "http://127.0.0.1:4199/__sink/splunk-1767225600000/services/collector/event"
                    },
                    {
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "delivered": 0,
                      "enabled": true,
                      "failingSince": null,
                      "failures": 0,
                      "hasAuthorization": false,
                      "id": "000000000000000000000003",
                      "kind": "https",
                      "lastAttemptAt": null,
                      "lastDeliveredAt": null,
                      "lastError": null,
                      "lastTest": {
                        "at": "2026-01-01T00:00:00.000Z",
                        "ok": true,
                        "status": 200
                      },
                      "name": "Our collector",
                      "nextAttemptAt": null,
                      "pending": 2,
                      "secretPreview": "[REDACTED]",
                      "state": "active",
                      "updatedAt": "2026-01-01T00:00:00.000Z",
                      "url": "http://127.0.0.1:4199/__sink/app-1767225600000"
                    }
                  ]
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      },
      "post": {
        "operationId": "workspaces.enterprise.logStreams.create",
        "summary": "Add a log stream for the company",
        "description": "Needs company access `streams` at `manage` and a recent re-authentication (403 `reauth_required`); refused inside an agent's session. Needs the Enterprise SSO plan feature (402). The `signingSecret` is returned once; 403 `managed_by_app`, 409 `log_stream_limit` or `use_workos_log_streams`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 80
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "https",
                      "datadog",
                      "splunk"
                    ]
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "site": {
                    "type": "string",
                    "maxLength": 16
                  },
                  "index": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 128
                  },
                  "secret": {
                    "type": "string",
                    "maxLength": 512
                  },
                  "authorization": {
                    "type": "string",
                    "maxLength": 512
                  }
                },
                "required": [
                  "name",
                  "kind"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "signingSecret": {
                      "type": "string"
                    },
                    "stream": {
                      "properties": {
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "delivered": {
                          "type": "integer"
                        },
                        "enabled": {
                          "type": "boolean"
                        },
                        "failingSince": {},
                        "failures": {
                          "type": "integer"
                        },
                        "hasAuthorization": {
                          "type": "boolean"
                        },
                        "id": {
                          "type": "string"
                        },
                        "kind": {
                          "type": "string"
                        },
                        "lastAttemptAt": {},
                        "lastDeliveredAt": {},
                        "lastError": {},
                        "lastTest": {},
                        "name": {
                          "type": "string"
                        },
                        "nextAttemptAt": {},
                        "pending": {
                          "type": "integer"
                        },
                        "secretPreview": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "url": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "signingSecret": "[REDACTED]",
                  "stream": {
                    "createdAt": "2026-01-01T00:00:00.000Z",
                    "delivered": 0,
                    "enabled": true,
                    "failingSince": null,
                    "failures": 0,
                    "hasAuthorization": false,
                    "id": "000000000000000000000001",
                    "kind": "https",
                    "lastAttemptAt": null,
                    "lastDeliveredAt": null,
                    "lastError": null,
                    "lastTest": null,
                    "name": "Our collector",
                    "nextAttemptAt": null,
                    "pending": 0,
                    "secretPreview": "[REDACTED]",
                    "state": "active",
                    "updatedAt": "2026-01-01T00:00:00.000Z",
                    "url": "http://127.0.0.1:4199/__sink/app-1767225600000"
                  }
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/log-streams/{streamId}": {
      "delete": {
        "operationId": "workspaces.enterprise.logStreams.delete",
        "summary": "Remove one of the company's log streams",
        "description": "Needs company access `streams` at `manage` and a recent re-authentication (403 `reauth_required`). 404 when the stream is not the company's.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "streamId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "deleted": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "deleted": true
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      },
      "patch": {
        "operationId": "workspaces.enterprise.logStreams.update",
        "summary": "Update one of the company's log streams",
        "description": "Needs company access `streams` at `manage` and a recent re-authentication (403 `reauth_required`). 400 `invalid_log_stream`, 403 `managed_by_app`, 404 when the stream is not the company's.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "streamId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 80
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "site": {
                    "type": "string",
                    "maxLength": 16
                  },
                  "index": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 128
                  },
                  "secret": {
                    "type": "string",
                    "maxLength": 512
                  },
                  "authorization": {
                    "type": "string",
                    "maxLength": 512
                  }
                },
                "required": [],
                "additionalProperties": false,
                "minProperties": 1
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/log-streams/{streamId}/rotate-secret": {
      "post": {
        "operationId": "workspaces.enterprise.logStreams.rotateSecret.create",
        "summary": "Rotate a log stream's signing secret",
        "description": "Needs company access `streams` at `manage` and a recent re-authentication (403 `reauth_required`). The new `signingSecret` is returned once and never read back.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "streamId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/log-streams/{streamId}/test": {
      "post": {
        "operationId": "workspaces.enterprise.logStreams.test.create",
        "summary": "Send a test event to one of the company's log streams",
        "description": "Needs company access `streams` at `manage`. Rate limited after the access check; returns the delivery result.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "streamId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "ms": {
                      "type": "integer"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "ms": 6,
                  "ok": true,
                  "status": 200
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "enterprise-log-stream-test",
            "windowMs": 60000,
            "max": 10,
            "per": "orgWriteLimiterKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/outsiders": {
      "get": {
        "operationId": "workspaces.enterprise.outsiders.list",
        "summary": "List members of the company's workspaces who are outside the company",
        "description": "Needs company access `people` at `view` (until a Company admin is named, `workspace:settings:edit`).",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/people": {
      "get": {
        "operationId": "workspaces.enterprise.people.list",
        "summary": "List the company's people, newest first",
        "description": "Needs company access `people` at `view`, `groups` at `manage` or `admins` at `manage`. People who signed in through the company or were provisioned, searched by email or name with `search`; `page` and `limit` are optional and the answer adds `page`, `limit`, `total` and `hasNextPage`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "hasNextPage": {
                      "type": "boolean"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "page": {
                      "type": "integer"
                    },
                    "people": {
                      "items": {
                        "properties": {
                          "active": {
                            "type": "boolean"
                          },
                          "email": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "provisionedBy": {
                            "type": "string"
                          },
                          "userId": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "total": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "hasNextPage": false,
                  "limit": 50,
                  "page": 1,
                  "people": [
                    {
                      "active": true,
                      "email": "user@example.com",
                      "name": "Session User stepup-carl",
                      "provisionedBy": "sso",
                      "userId": "000000000000000000000001"
                    },
                    {
                      "active": true,
                      "email": "user@example.com",
                      "name": "Session User stepup-sam",
                      "provisionedBy": "sso",
                      "userId": "000000000000000000000002"
                    },
                    {
                      "active": true,
                      "email": "user@example.com",
                      "name": "Session User stepup-bob",
                      "provisionedBy": "sso",
                      "userId": "000000000000000000000003"
                    },
                    {
                      "active": true,
                      "email": "user@example.com",
                      "name": "Session User stepup-priya",
                      "provisionedBy": "sso",
                      "userId": "000000000000000000000004"
                    }
                  ],
                  "total": 4
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/people/{userId}/passkeys/reset": {
      "post": {
        "operationId": "workspaces.enterprise.people.passkeys.reset.create",
        "summary": "Reset a person's passkeys and sign them out",
        "description": "Needs company access `people` at `manage` and a recent re-authentication (403 `reauth_required`). Removes the person's passkeys for the app and ends every session, so their next sign-in sets up a new one; 404 `not_a_person` for someone outside the company.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "removed": {
                      "type": "integer"
                    },
                    "sessions": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "removed": 0,
                  "sessions": 2
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.sessions_revoked"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/people/{userId}/sessions": {
      "get": {
        "operationId": "workspaces.enterprise.people.sessions.list",
        "summary": "List one of the company's people's live sessions",
        "description": "Needs company access `people` at `view`. One row per device, newest first; 404 `not_a_person` for someone outside the company.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "sessions": {
                      "items": {
                        "properties": {
                          "browser": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "current": {
                            "type": "boolean"
                          },
                          "device": {
                            "properties": {
                              "name": {
                                "type": "string"
                              }
                            },
                            "type": [
                              "null",
                              "object"
                            ]
                          },
                          "endsAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "ip": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "issuedBy": {
                            "properties": {
                              "appKeyName": {
                                "type": "string"
                              },
                              "kind": {
                                "type": "string"
                              }
                            },
                            "type": [
                              "null",
                              "object"
                            ]
                          },
                          "lastActiveAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "method": {
                            "type": "string"
                          },
                          "os": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "place": {},
                          "signedInAt": {
                            "format": "date-time",
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "sessions": [
                    {
                      "browser": "Firefox 131",
                      "current": false,
                      "device": {
                        "name": "Firefox on Windows"
                      },
                      "endsAt": "2026-01-01T00:00:00.000Z",
                      "id": "000000000000000000000001",
                      "ip": "198.51.100.9",
                      "issuedBy": null,
                      "lastActiveAt": "2026-01-01T00:00:00.000Z",
                      "method": "sso",
                      "os": "Windows",
                      "place": null,
                      "signedInAt": "2026-01-01T00:00:00.000Z"
                    },
                    {
                      "browser": "Chrome 141",
                      "current": false,
                      "device": {
                        "name": "Chrome on Mac OS"
                      },
                      "endsAt": "2026-01-01T00:00:00.000Z",
                      "id": "000000000000000000000002",
                      "ip": "203.0.113.7",
                      "issuedBy": null,
                      "lastActiveAt": "2026-01-01T00:00:00.000Z",
                      "method": "password",
                      "os": "macOS",
                      "place": null,
                      "signedInAt": "2026-01-01T00:00:00.000Z"
                    },
                    {
                      "browser": null,
                      "current": false,
                      "device": {
                        "name": "Unknown device"
                      },
                      "endsAt": "2026-01-01T00:00:00.000Z",
                      "id": "000000000000000000000003",
                      "ip": "127.0.0.1",
                      "issuedBy": null,
                      "lastActiveAt": "2026-01-01T00:00:00.000Z",
                      "method": "password",
                      "os": null,
                      "place": null,
                      "signedInAt": "2026-01-01T00:00:00.000Z"
                    }
                  ]
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/people/{userId}/sessions/{sessionRef}": {
      "delete": {
        "operationId": "workspaces.enterprise.people.sessions.delete",
        "summary": "End one of a person's sessions",
        "description": "Needs company access `people` at `manage`. Ends that session alone; the person's other sessions, connected apps and the company's keys are left as they are. 404 `not_a_person` or `not_found`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sessionRef",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "ended": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "ended": 1
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.sessions_revoked"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/policy": {
      "get": {
        "operationId": "workspaces.enterprise.policy.list",
        "summary": "Get the company's access policy",
        "description": "Needs company access `policy` at `view` (until a Company admin is named, `workspace:settings:edit`). Returns session length, IP allowlist and break-glass people, with the address this request came from.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "appTeamSessions": {
                      "type": "string"
                    },
                    "breakGlass": {
                      "properties": {
                        "passkeyOnly": {
                          "type": "boolean"
                        },
                        "people": {
                          "items": {
                            "properties": {
                              "email": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "userId": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "companyManages": {
                      "type": "boolean"
                    },
                    "connectedApps": {
                      "properties": {
                        "approved": {
                          "type": "array"
                        },
                        "mode": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "domainJoin": {
                      "type": "string"
                    },
                    "idleMinutes": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "ipAllowlist": {
                      "properties": {
                        "enabled": {
                          "type": "boolean"
                        },
                        "ranges": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "maxSessionHours": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "networkRestriction": {
                      "properties": {
                        "companyId": {
                          "type": "string"
                        },
                        "header": {
                          "type": "string"
                        },
                        "hosts": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "received": {}
                      },
                      "type": "object"
                    },
                    "outsiders": {
                      "properties": {
                        "maxRole": {
                          "type": "string"
                        },
                        "mode": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "signInMethods": {
                      "properties": {
                        "allowed": {
                          "items": {
                            "type": "string"
                          },
                          "type": [
                            "array",
                            "null"
                          ]
                        },
                        "offered": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "outside": {
                          "properties": {
                            "people": {
                              "type": "integer"
                            },
                            "sessions": {
                              "type": "integer"
                            }
                          },
                          "type": "object"
                        },
                        "people": {
                          "type": "integer"
                        },
                        "withPasskey": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "updatedAt": {
                      "format": "date-time",
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "workspaceExceptions": {
                      "type": "array"
                    },
                    "yourIp": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "appTeamSessions": "allowed",
                  "breakGlass": {
                    "passkeyOnly": true,
                    "people": [
                      {
                        "email": "user@example.com",
                        "name": "Session User wsrules-bob",
                        "userId": "000000000000000000000001"
                      }
                    ]
                  },
                  "companyManages": true,
                  "connectedApps": {
                    "approved": [],
                    "mode": "any"
                  },
                  "domainJoin": "off",
                  "idleMinutes": 60,
                  "ipAllowlist": {
                    "enabled": true,
                    "ranges": [
                      "10.20.0.0/16",
                      "127.0.0.0/8",
                      "::1/128"
                    ]
                  },
                  "maxSessionHours": 24,
                  "networkRestriction": {
                    "companyId": "000000000000000000000002",
                    "header": "allowed-company-ids",
                    "hosts": [
                      "localhost:3000"
                    ],
                    "received": null
                  },
                  "outsiders": {
                    "maxRole": "viewer",
                    "mode": "allowed"
                  },
                  "signInMethods": {
                    "allowed": [
                      "password",
                      "magic_link",
                      "passkey"
                    ],
                    "offered": [
                      "password",
                      "magic_link",
                      "passkey",
                      "github"
                    ],
                    "outside": {
                      "people": 0,
                      "sessions": 0
                    },
                    "people": 4,
                    "withPasskey": 0
                  },
                  "updatedAt": "2026-01-01T00:00:00.000Z",
                  "workspaceExceptions": [],
                  "yourIp": "127.0.0.1"
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      },
      "put": {
        "operationId": "workspaces.enterprise.policy.update",
        "summary": "Update the company's access policy",
        "description": "Needs company access `policy` at `manage` and a recent re-authentication (403 `reauth_required`). 403 `managed_by_app` while the app's team keeps the policy; 409 `would_lock_you_out` when the allowlist leaves out this request's own address; 422 `not_enterprise_people` or `not_connected_apps`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "idleMinutes": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "maxSessionHours": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "ipAllowlist": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "ranges": {
                        "type": "array",
                        "maxItems": 100,
                        "items": {
                          "type": "string",
                          "maxLength": 64
                        }
                      }
                    },
                    "required": [
                      "enabled",
                      "ranges"
                    ],
                    "additionalProperties": false
                  },
                  "breakGlass": {
                    "type": "object",
                    "properties": {
                      "emails": {
                        "type": "array",
                        "maxItems": 5,
                        "items": {
                          "type": "string",
                          "maxLength": 254
                        }
                      },
                      "passkeyOnly": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "emails"
                    ],
                    "additionalProperties": false
                  },
                  "companyManages": {
                    "type": "boolean"
                  },
                  "domainJoin": {
                    "type": "string",
                    "enum": [
                      "off",
                      "join",
                      "request"
                    ]
                  },
                  "appTeamSessions": {
                    "type": "string",
                    "enum": [
                      "allowed",
                      "refused"
                    ]
                  },
                  "outsiders": {
                    "type": "object",
                    "properties": {
                      "mode": {
                        "type": "string",
                        "enum": [
                          "allowed",
                          "limited",
                          "blocked"
                        ]
                      },
                      "maxRole": {
                        "type": "string",
                        "enum": [
                          "editor",
                          "viewer"
                        ]
                      }
                    },
                    "required": [
                      "mode"
                    ],
                    "additionalProperties": false
                  },
                  "signInMethods": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "allowed": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "password",
                            "magic_link",
                            "email_code",
                            "phone_code",
                            "passkey",
                            "google",
                            "microsoft",
                            "github",
                            "linkedin",
                            "apple",
                            "lovable",
                            "vercel",
                            "custom_oidc",
                            "ethereum_wallet",
                            "solana_wallet"
                          ]
                        },
                        "minItems": 1,
                        "maxItems": 15,
                        "uniqueItems": true
                      }
                    },
                    "required": [
                      "allowed"
                    ],
                    "additionalProperties": false
                  },
                  "connectedApps": {
                    "type": "object",
                    "properties": {
                      "mode": {
                        "type": "string",
                        "enum": [
                          "any",
                          "approved",
                          "none"
                        ]
                      },
                      "approved": {
                        "type": "array",
                        "maxItems": 50,
                        "items": {
                          "type": "string",
                          "maxLength": 512
                        }
                      }
                    },
                    "required": [
                      "mode"
                    ],
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false,
                "minProperties": 1
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "appTeamSessions": {
                      "type": "string"
                    },
                    "breakGlass": {
                      "properties": {
                        "passkeyOnly": {
                          "type": "boolean"
                        },
                        "people": {
                          "items": {
                            "properties": {
                              "email": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "userId": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "companyManages": {
                      "type": "boolean"
                    },
                    "connectedApps": {
                      "properties": {
                        "approved": {
                          "type": "array"
                        },
                        "mode": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "domainJoin": {
                      "type": "string"
                    },
                    "idleMinutes": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "ipAllowlist": {
                      "properties": {
                        "enabled": {
                          "type": "boolean"
                        },
                        "ranges": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "maxSessionHours": {},
                    "networkRestriction": {
                      "properties": {
                        "companyId": {
                          "type": "string"
                        },
                        "header": {
                          "type": "string"
                        },
                        "hosts": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "received": {}
                      },
                      "type": "object"
                    },
                    "outsiders": {
                      "properties": {
                        "maxRole": {
                          "type": "string"
                        },
                        "mode": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "signInMethods": {
                      "properties": {
                        "allowed": {
                          "items": {
                            "type": "string"
                          },
                          "type": [
                            "array",
                            "null"
                          ]
                        },
                        "offered": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "outside": {
                          "properties": {
                            "people": {
                              "type": "integer"
                            },
                            "sessions": {
                              "type": "integer"
                            }
                          },
                          "type": "object"
                        },
                        "people": {
                          "type": "integer"
                        },
                        "withPasskey": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "updatedAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "workspaceExceptions": {
                      "type": "array"
                    },
                    "yourIp": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "appTeamSessions": "allowed",
                  "breakGlass": {
                    "passkeyOnly": false,
                    "people": [
                      {
                        "email": "user@example.com",
                        "name": "Session User stepup-carl",
                        "userId": "000000000000000000000001"
                      }
                    ]
                  },
                  "companyManages": true,
                  "connectedApps": {
                    "approved": [],
                    "mode": "any"
                  },
                  "domainJoin": "off",
                  "idleMinutes": 15,
                  "ipAllowlist": {
                    "enabled": false,
                    "ranges": []
                  },
                  "maxSessionHours": null,
                  "networkRestriction": {
                    "companyId": "000000000000000000000002",
                    "header": "allowed-company-ids",
                    "hosts": [
                      "localhost:3000"
                    ],
                    "received": null
                  },
                  "outsiders": {
                    "maxRole": "viewer",
                    "mode": "allowed"
                  },
                  "signInMethods": {
                    "allowed": null,
                    "offered": [
                      "password",
                      "magic_link",
                      "passkey",
                      "github"
                    ],
                    "outside": {
                      "people": 0,
                      "sessions": 0
                    },
                    "people": 4,
                    "withPasskey": 0
                  },
                  "updatedAt": "2026-01-01T00:00:00.000Z",
                  "workspaceExceptions": [],
                  "yourIp": "127.0.0.1"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.policy_updated"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/policy/workspaces": {
      "get": {
        "operationId": "workspaces.enterprise.policy.workspaces.list",
        "summary": "List the company's per-workspace policy exceptions",
        "description": "Needs company access `policy` at `view`. Returns every exception the company holds and its bound workspaces to choose from.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "exceptions": {
                      "items": {
                        "properties": {
                          "effective": {
                            "properties": {
                              "appTeamSessions": {
                                "type": "string"
                              },
                              "connectedApps": {
                                "properties": {
                                  "approved": {
                                    "items": {
                                      "type": "string"
                                    },
                                    "type": "array"
                                  },
                                  "mode": {
                                    "type": "string"
                                  }
                                },
                                "type": "object"
                              },
                              "idleMinutes": {
                                "type": "integer"
                              },
                              "ipAllowlist": {
                                "properties": {
                                  "company": {
                                    "items": {
                                      "type": "string"
                                    },
                                    "type": "array"
                                  },
                                  "workspace": {
                                    "items": {
                                      "type": "string"
                                    },
                                    "type": "array"
                                  }
                                },
                                "type": "object"
                              },
                              "maxSessionHours": {
                                "type": "integer"
                              },
                              "outsiders": {
                                "properties": {
                                  "maxRole": {
                                    "type": "string"
                                  },
                                  "mode": {
                                    "type": "string"
                                  }
                                },
                                "type": "object"
                              },
                              "requireSso": {
                                "type": "boolean"
                              },
                              "signInMethods": {
                                "items": {
                                  "type": "string"
                                },
                                "type": "array"
                              }
                            },
                            "type": "object"
                          },
                          "rules": {
                            "properties": {
                              "appTeamSessions": {
                                "type": "string"
                              },
                              "connectedApps": {
                                "properties": {
                                  "approved": {
                                    "items": {
                                      "type": "string"
                                    },
                                    "type": "array"
                                  },
                                  "mode": {
                                    "type": "string"
                                  }
                                },
                                "type": "object"
                              },
                              "idleMinutes": {
                                "type": "integer"
                              },
                              "ipAllowlist": {
                                "properties": {
                                  "ranges": {
                                    "items": {
                                      "type": "string"
                                    },
                                    "type": "array"
                                  }
                                },
                                "type": "object"
                              },
                              "maxSessionHours": {
                                "type": "integer"
                              },
                              "outsiders": {
                                "properties": {
                                  "maxRole": {
                                    "type": "string"
                                  },
                                  "mode": {
                                    "type": "string"
                                  }
                                },
                                "type": "object"
                              },
                              "requireSso": {
                                "type": "boolean"
                              },
                              "signInMethods": {
                                "properties": {
                                  "allowed": {
                                    "items": {
                                      "type": "string"
                                    },
                                    "type": "array"
                                  }
                                },
                                "type": "object"
                              },
                              "workspaceId": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "sameAsCompany": {
                            "type": "array"
                          },
                          "updatedAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "updatedBy": {
                            "type": "string"
                          },
                          "warnings": {
                            "type": "array"
                          },
                          "workspace": {
                            "type": "string"
                          },
                          "workspaceId": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "max": {
                      "type": "integer"
                    },
                    "workspaces": {
                      "items": {
                        "properties": {
                          "hasException": {
                            "type": "boolean"
                          },
                          "name": {
                            "type": "string"
                          },
                          "workspaceId": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "exceptions": [
                    {
                      "effective": {
                        "appTeamSessions": "refused",
                        "connectedApps": {
                          "approved": [
                            "WIiFoauI7pn0ZclQHOi5Tvp0MrCIf98J5SaplEbA"
                          ],
                          "mode": "approved"
                        },
                        "idleMinutes": 15,
                        "ipAllowlist": {
                          "company": [
                            "10.20.0.0/16",
                            "127.0.0.0/8",
                            "::1/128"
                          ],
                          "workspace": [
                            "10.20.5.0/24"
                          ]
                        },
                        "maxSessionHours": 8,
                        "outsiders": {
                          "maxRole": "viewer",
                          "mode": "blocked"
                        },
                        "requireSso": true,
                        "signInMethods": [
                          "passkey"
                        ]
                      },
                      "rules": {
                        "appTeamSessions": "refused",
                        "connectedApps": {
                          "approved": [
                            "WIiFoauI7pn0ZclQHOi5Tvp0MrCIf98J5SaplEbA"
                          ],
                          "mode": "approved"
                        },
                        "idleMinutes": 15,
                        "ipAllowlist": {
                          "ranges": [
                            "10.20.5.0/24"
                          ]
                        },
                        "maxSessionHours": 8,
                        "outsiders": {
                          "maxRole": "viewer",
                          "mode": "blocked"
                        },
                        "requireSso": true,
                        "signInMethods": {
                          "allowed": [
                            "passkey"
                          ]
                        },
                        "workspaceId": "000000000000000000000001"
                      },
                      "sameAsCompany": [],
                      "updatedAt": "2026-01-01T00:00:00.000Z",
                      "updatedBy": "Session User wsrules-ada",
                      "warnings": [],
                      "workspace": "Globex finance 1767225600000",
                      "workspaceId": "000000000000000000000001"
                    }
                  ],
                  "max": 20,
                  "workspaces": [
                    {
                      "hasException": false,
                      "name": "wsrules 1767225600000",
                      "workspaceId": "000000000000000000000002"
                    },
                    {
                      "hasException": false,
                      "name": "Globex support 1767225600000",
                      "workspaceId": "000000000000000000000003"
                    },
                    {
                      "hasException": true,
                      "name": "Globex finance 1767225600000",
                      "workspaceId": "000000000000000000000001"
                    }
                  ]
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/policy/workspaces/{targetId}": {
      "get": {
        "operationId": "workspaces.enterprise.policy.workspaces.get",
        "summary": "Get the stricter policy for one of the company's workspaces",
        "description": "Needs company access `policy` at `view`. 404 `workspace_not_bound` when the workspace is not bound to the company.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "targetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      },
      "put": {
        "operationId": "workspaces.enterprise.policy.workspaces.update",
        "summary": "Set the stricter policy for one of the company's workspaces",
        "description": "Needs company access `policy` at `manage` and a recent re-authentication (403 `reauth_required`). Rules may not be looser than the company's (422 per field); 403 `managed_by_app`; 409 `would_lock_you_out` when the caller's own session would fail the new rules.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "targetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "idleMinutes": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "maxSessionHours": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "ipAllowlist": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "ranges": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 100,
                        "items": {
                          "type": "string",
                          "maxLength": 64
                        }
                      }
                    },
                    "required": [
                      "ranges"
                    ],
                    "additionalProperties": false
                  },
                  "signInMethods": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "allowed": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 15,
                        "uniqueItems": true,
                        "items": {
                          "type": "string",
                          "enum": [
                            "password",
                            "magic_link",
                            "email_code",
                            "phone_code",
                            "passkey",
                            "google",
                            "microsoft",
                            "github",
                            "linkedin",
                            "apple",
                            "lovable",
                            "vercel",
                            "custom_oidc",
                            "ethereum_wallet",
                            "solana_wallet"
                          ]
                        }
                      }
                    },
                    "required": [
                      "allowed"
                    ],
                    "additionalProperties": false
                  },
                  "requireSso": {
                    "type": "boolean"
                  },
                  "connectedApps": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "mode": {
                        "type": "string",
                        "enum": [
                          "approved",
                          "none"
                        ]
                      },
                      "approved": {
                        "type": "array",
                        "maxItems": 50,
                        "uniqueItems": true,
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 2048
                        }
                      }
                    },
                    "required": [
                      "mode"
                    ],
                    "additionalProperties": false
                  },
                  "outsiders": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "mode": {
                        "type": "string",
                        "enum": [
                          "limited",
                          "blocked"
                        ]
                      },
                      "maxRole": {
                        "type": "string",
                        "enum": [
                          "editor",
                          "viewer"
                        ]
                      }
                    },
                    "required": [
                      "mode"
                    ],
                    "additionalProperties": false
                  },
                  "appTeamSessions": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "refused",
                      null
                    ]
                  },
                  "expectedUpdatedAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 64
                  }
                },
                "additionalProperties": false,
                "minProperties": 1
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "affected": {
                      "properties": {
                        "people": {
                          "type": "integer"
                        },
                        "sessions": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "effective": {
                      "properties": {
                        "appTeamSessions": {
                          "type": "string"
                        },
                        "connectedApps": {
                          "properties": {
                            "approved": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "mode": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "idleMinutes": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "ipAllowlist": {
                          "properties": {
                            "company": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "workspace": {
                              "items": {
                                "type": "string"
                              },
                              "type": [
                                "array",
                                "null"
                              ]
                            }
                          },
                          "type": "object"
                        },
                        "maxSessionHours": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "outsiders": {
                          "properties": {
                            "maxRole": {
                              "type": "string"
                            },
                            "mode": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "requireSso": {
                          "type": "boolean"
                        },
                        "signInMethods": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "rules": {
                      "properties": {
                        "appTeamSessions": {
                          "type": "string"
                        },
                        "connectedApps": {
                          "properties": {
                            "approved": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "mode": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "idleMinutes": {
                          "type": "integer"
                        },
                        "ipAllowlist": {
                          "properties": {
                            "ranges": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          },
                          "type": "object"
                        },
                        "maxSessionHours": {
                          "type": "integer"
                        },
                        "outsiders": {
                          "properties": {
                            "maxRole": {
                              "type": "string"
                            },
                            "mode": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "requireSso": {
                          "type": "boolean"
                        },
                        "signInMethods": {
                          "properties": {
                            "allowed": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          },
                          "type": "object"
                        },
                        "workspaceId": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "sameAsCompany": {
                      "type": "array"
                    },
                    "updatedAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "updatedBy": {
                      "type": "string"
                    },
                    "warnings": {
                      "type": "array"
                    },
                    "workspace": {
                      "type": "string"
                    },
                    "workspaceId": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "affected": {
                    "people": 4,
                    "sessions": 4
                  },
                  "effective": {
                    "appTeamSessions": "refused",
                    "connectedApps": {
                      "approved": [
                        "WIiFoauI7pn0ZclQHOi5Tvp0MrCIf98J5SaplEbA"
                      ],
                      "mode": "approved"
                    },
                    "idleMinutes": 15,
                    "ipAllowlist": {
                      "company": [
                        "10.20.0.0/16",
                        "127.0.0.0/8",
                        "::1/128"
                      ],
                      "workspace": [
                        "10.20.5.0/24"
                      ]
                    },
                    "maxSessionHours": 8,
                    "outsiders": {
                      "maxRole": "viewer",
                      "mode": "blocked"
                    },
                    "requireSso": true,
                    "signInMethods": [
                      "passkey"
                    ]
                  },
                  "rules": {
                    "appTeamSessions": "refused",
                    "connectedApps": {
                      "approved": [
                        "WIiFoauI7pn0ZclQHOi5Tvp0MrCIf98J5SaplEbA"
                      ],
                      "mode": "approved"
                    },
                    "idleMinutes": 15,
                    "ipAllowlist": {
                      "ranges": [
                        "10.20.5.0/24"
                      ]
                    },
                    "maxSessionHours": 8,
                    "outsiders": {
                      "maxRole": "viewer",
                      "mode": "blocked"
                    },
                    "requireSso": true,
                    "signInMethods": {
                      "allowed": [
                        "passkey"
                      ]
                    },
                    "workspaceId": "000000000000000000000001"
                  },
                  "sameAsCompany": [],
                  "updatedAt": "2026-01-01T00:00:00.000Z",
                  "updatedBy": "Session User wsrules-ada",
                  "warnings": [],
                  "workspace": "Globex finance 1767225600000",
                  "workspaceId": "000000000000000000000001"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.workspace_policy_updated"
        ]
      },
      "delete": {
        "operationId": "workspaces.enterprise.policy.workspaces.delete",
        "summary": "Remove a workspace's policy exception",
        "description": "Needs company access `policy` at `manage` and a recent re-authentication (403 `reauth_required`). The workspace falls back to the company's policy; 403 `managed_by_app`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "targetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "removed": {
                      "type": "boolean"
                    },
                    "workspaceId": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "removed": true,
                  "workspaceId": "000000000000000000000001"
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.workspace_policy_updated"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/roles": {
      "get": {
        "operationId": "workspaces.enterprise.roles.list",
        "summary": "List the roles the company can give, with who holds each",
        "description": "Needs company access `admins` at `view` or `groups` at `view` (until a Company admin is named, `workspace:settings:edit`). Preset roles come first.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "max": {
                      "type": "integer"
                    },
                    "roles": {
                      "items": {
                        "properties": {
                          "createdAt": {},
                          "createdVia": {},
                          "description": {
                            "type": "string"
                          },
                          "holders": {
                            "properties": {
                              "groups": {
                                "type": "integer"
                              },
                              "groupsReached": {
                                "type": "integer"
                              },
                              "people": {
                                "type": "integer"
                              },
                              "workos": {
                                "type": "integer"
                              }
                            },
                            "type": "object"
                          },
                          "name": {
                            "type": "string"
                          },
                          "permissions": {
                            "properties": {
                              "activity": {
                                "type": "string"
                              },
                              "admins": {
                                "type": "string"
                              },
                              "apps": {
                                "type": "string"
                              },
                              "groups": {
                                "type": "string"
                              },
                              "insights": {
                                "type": "string"
                              },
                              "keys": {
                                "type": "string"
                              },
                              "people": {
                                "type": "string"
                              },
                              "policy": {
                                "type": "string"
                              },
                              "setup": {
                                "type": "string"
                              },
                              "streams": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "preset": {
                            "type": "boolean"
                          },
                          "roleId": {
                            "type": "string"
                          },
                          "workos": {}
                        },
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "max": 20,
                  "roles": [
                    {
                      "createdAt": null,
                      "createdVia": null,
                      "description": "Manages everything in the company's settings.",
                      "holders": {
                        "groups": 0,
                        "groupsReached": 0,
                        "people": 1,
                        "workos": 0
                      },
                      "name": "Company admin",
                      "permissions": {
                        "activity": "view",
                        "admins": "manage",
                        "apps": "manage",
                        "groups": "manage",
                        "insights": "view",
                        "keys": "[REDACTED]",
                        "people": "manage",
                        "policy": "manage",
                        "setup": "manage",
                        "streams": "manage"
                      },
                      "preset": true,
                      "roleId": "company-admin",
                      "workos": null
                    },
                    {
                      "createdAt": null,
                      "createdVia": null,
                      "description": "Manages the access policy, sign-outs, connected apps, API keys, log streams and setup. Views the rest.",
                      "holders": {
                        "groups": 0,
                        "groupsReached": 0,
                        "people": 0,
                        "workos": 0
                      },
                      "name": "Security admin",
                      "permissions": {
                        "activity": "view",
                        "admins": "view",
                        "apps": "manage",
                        "groups": "view",
                        "insights": "view",
                        "keys": "[REDACTED]",
                        "people": "manage",
                        "policy": "manage",
                        "setup": "manage",
                        "streams": "manage"
                      },
                      "preset": true,
                      "roleId": "security-admin",
                      "workos": null
                    },
                    {
                      "createdAt": null,
                      "createdVia": null,
                      "description": "Views everything and changes nothing.",
                      "holders": {
                        "groups": 0,
                        "groupsReached": 0,
                        "people": 0,
                        "workos": 0
                      },
                      "name": "Auditor",
                      "permissions": {
                        "activity": "view",
                        "admins": "view",
                        "apps": "view",
                        "groups": "view",
                        "insights": "view",
                        "keys": "[REDACTED]",
                        "people": "view",
                        "policy": "view",
                        "setup": "none",
                        "streams": "view"
                      },
                      "preset": true,
                      "roleId": "auditor",
                      "workos": null
                    }
                  ]
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      },
      "post": {
        "operationId": "workspaces.enterprise.roles.create",
        "summary": "Create a company role",
        "description": "Needs company access `admins` at `manage`, a recent re-authentication (403 `reauth_required`) and the Enterprise SSO plan feature (402). 403 `managed_by_app`; 409 `name_taken`; 422 `too_many_roles`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 280
                  },
                  "permissions": {
                    "type": "object",
                    "propertyNames": {
                      "enum": [
                        "activity",
                        "people",
                        "policy",
                        "insights",
                        "streams",
                        "apps",
                        "keys",
                        "groups",
                        "admins",
                        "setup"
                      ]
                    },
                    "additionalProperties": {
                      "type": "string",
                      "enum": [
                        "none",
                        "view",
                        "manage"
                      ]
                    }
                  },
                  "assignableInWorkOS": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "createdVia": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "holders": {
                      "properties": {
                        "groups": {
                          "type": "integer"
                        },
                        "groupsReached": {
                          "type": "integer"
                        },
                        "people": {
                          "type": "integer"
                        },
                        "workos": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "name": {
                      "type": "string"
                    },
                    "permissions": {
                      "properties": {
                        "activity": {
                          "type": "string"
                        },
                        "admins": {
                          "type": "string"
                        },
                        "apps": {
                          "type": "string"
                        },
                        "groups": {
                          "type": "string"
                        },
                        "insights": {
                          "type": "string"
                        },
                        "keys": {
                          "type": "string"
                        },
                        "people": {
                          "type": "string"
                        },
                        "policy": {
                          "type": "string"
                        },
                        "setup": {
                          "type": "string"
                        },
                        "streams": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "preset": {
                      "type": "boolean"
                    },
                    "roleId": {
                      "type": "string"
                    },
                    "workos": {
                      "properties": {
                        "publishedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "publishedBy": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string"
                        }
                      },
                      "type": [
                        "null",
                        "object"
                      ]
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "createdAt": "2026-01-01T00:00:00.000Z",
                  "createdVia": "app",
                  "description": "",
                  "holders": {
                    "groups": 0,
                    "groupsReached": 0,
                    "people": 0,
                    "workos": 0
                  },
                  "name": "Company admin.",
                  "permissions": {
                    "activity": "view",
                    "admins": "none",
                    "apps": "none",
                    "groups": "none",
                    "insights": "none",
                    "keys": "[REDACTED]",
                    "people": "none",
                    "policy": "none",
                    "setup": "none",
                    "streams": "none"
                  },
                  "preset": false,
                  "roleId": "000000000000000000000001",
                  "workos": {
                    "publishedAt": "2026-01-01T00:00:00.000Z",
                    "publishedBy": "app",
                    "slug": "org-bb-company-admin-2",
                    "state": "published"
                  }
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.role_created"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/roles/{roleId}": {
      "delete": {
        "operationId": "workspaces.enterprise.roles.delete",
        "summary": "Delete a company role",
        "description": "Needs company access `admins` at `manage` and a recent re-authentication (403 `reauth_required`). Everyone holding the role loses it; 409 `preset_role` for a preset, 403 `managed_by_app`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "roleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "groups": {
                      "type": "integer"
                    },
                    "people": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "groups": 0,
                  "people": 0
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.role_deleted"
        ]
      },
      "patch": {
        "operationId": "workspaces.enterprise.roles.update",
        "summary": "Rename a company role or change what it allows",
        "description": "Needs company access `admins` at `manage` and a recent re-authentication (403 `reauth_required`). 403 `managed_by_app`; 409 `name_taken` or `preset_role`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "roleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 280
                  },
                  "permissions": {
                    "type": "object",
                    "propertyNames": {
                      "enum": [
                        "activity",
                        "people",
                        "policy",
                        "insights",
                        "streams",
                        "apps",
                        "keys",
                        "groups",
                        "admins",
                        "setup"
                      ]
                    },
                    "additionalProperties": {
                      "type": "string",
                      "enum": [
                        "none",
                        "view",
                        "manage"
                      ]
                    }
                  },
                  "assignableInWorkOS": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "createdVia": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "holders": {
                      "properties": {
                        "groups": {
                          "type": "integer"
                        },
                        "groupsReached": {
                          "type": "integer"
                        },
                        "people": {
                          "type": "integer"
                        },
                        "workos": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "name": {
                      "type": "string"
                    },
                    "permissions": {
                      "properties": {
                        "activity": {
                          "type": "string"
                        },
                        "admins": {
                          "type": "string"
                        },
                        "apps": {
                          "type": "string"
                        },
                        "groups": {
                          "type": "string"
                        },
                        "insights": {
                          "type": "string"
                        },
                        "keys": {
                          "type": "string"
                        },
                        "people": {
                          "type": "string"
                        },
                        "policy": {
                          "type": "string"
                        },
                        "setup": {
                          "type": "string"
                        },
                        "streams": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "preset": {
                      "type": "boolean"
                    },
                    "roleId": {
                      "type": "string"
                    },
                    "workos": {
                      "properties": {
                        "publishedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "publishedBy": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string"
                        }
                      },
                      "type": [
                        "null",
                        "object"
                      ]
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "createdAt": "2026-01-01T00:00:00.000Z",
                  "createdVia": "app",
                  "description": "",
                  "holders": {
                    "groups": 0,
                    "groupsReached": 0,
                    "people": 0,
                    "workos": 0
                  },
                  "name": "Service desk",
                  "permissions": {
                    "activity": "view",
                    "admins": "none",
                    "apps": "none",
                    "groups": "none",
                    "insights": "none",
                    "keys": "[REDACTED]",
                    "people": "manage",
                    "policy": "none",
                    "setup": "none",
                    "streams": "none"
                  },
                  "preset": false,
                  "roleId": "000000000000000000000001",
                  "workos": {
                    "publishedAt": "2026-01-01T00:00:00.000Z",
                    "publishedBy": "app",
                    "slug": "org-bb-help-desk",
                    "state": "published"
                  }
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.role_updated"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/service-accounts": {
      "get": {
        "operationId": "workspaces.enterprise.serviceAccounts.list",
        "summary": "List the company's service accounts",
        "description": "Needs company access `keys` at `view` (until a Company admin is named, `workspace:settings:edit`).",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      },
      "post": {
        "operationId": "workspaces.enterprise.serviceAccounts.create",
        "summary": "Create a service account for the company",
        "description": "Needs company access `keys` at `manage`, a recent re-authentication (403 `reauth_required`) and the Enterprise SSO plan feature (402). 409 `name_taken`; 422 `too_many_service_accounts`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 280
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "createdVia": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "keys": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "serviceAccountId": {
                      "type": "string"
                    },
                    "workloadCredentials": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "createdAt": "2026-01-01T00:00:00.000Z",
                  "createdVia": "app",
                  "description": "",
                  "keys": 0,
                  "name": "M17 another bot 1767225600000",
                  "serviceAccountId": "000000000000000000000001",
                  "workloadCredentials": 0
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/service-accounts/{serviceAccountId}": {
      "delete": {
        "operationId": "workspaces.enterprise.serviceAccounts.delete",
        "summary": "Delete a service account and revoke its keys",
        "description": "Needs company access `keys` at `manage`; no re-authentication asked. Revokes every key it owns and deletes its workload credentials and their live tokens, returning `keysRevoked`, `credentialsDeleted` and `tokensRevoked`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "serviceAccountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.key_revoked",
          "enterprise.workload_credential_updated"
        ]
      },
      "patch": {
        "operationId": "workspaces.enterprise.serviceAccounts.update",
        "summary": "Update one of the company's service accounts",
        "description": "Needs company access `keys` at `manage` and a recent re-authentication (403 `reauth_required`). 409 `name_taken`; 404 when it is not the company's.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "serviceAccountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 280
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "createdVia": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "keys": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "serviceAccountId": {
                      "type": "string"
                    },
                    "workloadCredentials": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "createdAt": "2026-01-01T00:00:00.000Z",
                  "createdVia": "app",
                  "description": "Changed",
                  "keys": 0,
                  "name": "M17 bot 1767225600000",
                  "serviceAccountId": "000000000000000000000001",
                  "workloadCredentials": 0
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/setup-link": {
      "post": {
        "operationId": "workspaces.enterprise.setupLink.create",
        "summary": "Create a short-lived setup link for the company's IT admin",
        "description": "Needs the company access the `intent` asks for (`setup` at `manage`, or `activity` at `view` for the audit log viewer) and, except for the audit log viewer, a recent re-authentication. The link opens the WorkOS Admin Portal on the app owner's own WorkOS account and returns to the app's first redirect URL; 422 `client_has_no_redirect` or `insecure_return_url`, 403 `directory_not_enabled`, 403 `app_team_only` for an intent the company may not open (such as `log_streams`), 409 `nothing_to_renew`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "intent": {
                    "type": "string",
                    "enum": [
                      "sso",
                      "dsync",
                      "certificate_renewal",
                      "domain_verification",
                      "audit_logs",
                      "log_streams"
                    ]
                  },
                  "purpose": {
                    "type": "string",
                    "enum": [
                      "roles",
                      "it_contacts"
                    ]
                  }
                },
                "oneOf": [
                  {
                    "required": [
                      "intent"
                    ]
                  },
                  {
                    "required": [
                      "purpose"
                    ]
                  }
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "action": {
                      "type": "string"
                    },
                    "expiresAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "intent": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "action": "roleAssignment",
                  "expiresAt": "2026-01-01T00:00:00.000Z",
                  "intent": "sso",
                  "url": "http://127.0.0.1:4199/init?setupLinkToken=[REDACTED]"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/sign-out": {
      "post": {
        "operationId": "workspaces.enterprise.signOut.create",
        "summary": "Sign out one or all of the company's people",
        "description": "Needs company access `people` at `manage`. Ends every session and OAuth refresh token; signing out everyone, or the sessions outside the sign-in methods, also needs a recent re-authentication (403 `reauth_required`). 404 `not_a_person` for someone outside the company.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "userId": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  },
                  "everyone": {
                    "type": "boolean",
                    "const": true
                  },
                  "outsideMethods": {
                    "type": "boolean",
                    "const": true
                  }
                },
                "additionalProperties": false,
                "oneOf": [
                  {
                    "required": [
                      "userId"
                    ]
                  },
                  {
                    "required": [
                      "everyone"
                    ]
                  },
                  {
                    "required": [
                      "outsideMethods"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "people": {
                      "type": "integer"
                    },
                    "sessions": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "people": 0,
                  "sessions": 0
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.sessions_revoked"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/sso/routing": {
      "put": {
        "operationId": "workspaces.enterprise.sso.routing.update",
        "summary": "Replace which identity provider signs in each verified domain",
        "description": "Needs company access `setup` at `manage` and a recent re-authentication (403 `reauth_required`). Replaces the whole routing by compare-and-set on `version` (409 `sso_routing_conflict`; 400 `sso_routing_invalid`) and returns the SSO status.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "defaultConnection": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 32
                  },
                  "routes": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "object",
                      "properties": {
                        "domain": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 253
                        },
                        "connections": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 6,
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 32
                          }
                        }
                      },
                      "required": [
                        "domain",
                        "connections"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "labels": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "properties": {
                        "connection": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 32
                        },
                        "label": {
                          "type": "string",
                          "maxLength": 240
                        }
                      },
                      "required": [
                        "connection",
                        "label"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "version",
                  "defaultConnection",
                  "routes",
                  "labels"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "beyondLimit": {
                      "type": "integer"
                    },
                    "checkedAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "connectionState": {
                      "type": "string"
                    },
                    "connections": {
                      "items": {
                        "properties": {
                          "certificate": {},
                          "domains": {
                            "items": {
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "isDefault": {
                            "type": "boolean"
                          },
                          "label": {
                            "type": "string"
                          },
                          "provider": {
                            "type": "string"
                          },
                          "ref": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "limits": {
                      "properties": {
                        "connections": {
                          "type": "integer"
                        },
                        "labelMax": {
                          "type": "integer"
                        },
                        "perDomain": {
                          "type": "integer"
                        },
                        "routes": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "routing": {
                      "properties": {
                        "confirmed": {
                          "type": "boolean"
                        },
                        "defaultRef": {
                          "type": "string"
                        },
                        "routes": {
                          "items": {
                            "properties": {
                              "domain": {
                                "type": "string"
                              },
                              "refs": {
                                "items": {
                                  "type": "string"
                                },
                                "type": "array"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "unservedDomains": {
                          "type": "array"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "updatedBy": {
                          "type": "string"
                        },
                        "version": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "beyondLimit": 0,
                  "checkedAt": "2026-01-01T00:00:00.000Z",
                  "connectionState": "active",
                  "connections": [
                    {
                      "certificate": null,
                      "domains": [
                        "m20-conn-1767225600000.test"
                      ],
                      "isDefault": true,
                      "label": "Okta",
                      "provider": "okta",
                      "ref": "3ba2549547cce687",
                      "state": "active",
                      "type": "OktaSAML"
                    },
                    {
                      "certificate": null,
                      "domains": [
                        "umbrella-m20-conn-1767225600000.test"
                      ],
                      "isDefault": false,
                      "label": "Umbrella (Entra)",
                      "provider": "entra",
                      "ref": "3739e26a2b7b60d2",
                      "state": "active",
                      "type": "AzureSAML"
                    }
                  ],
                  "limits": {
                    "connections": 10,
                    "labelMax": 60,
                    "perDomain": 5,
                    "routes": 50
                  },
                  "routing": {
                    "confirmed": true,
                    "defaultRef": "3ba2549547cce687",
                    "routes": [
                      {
                        "domain": "umbrella-m20-conn-1767225600000.test",
                        "refs": [
                          "3739e26a2b7b60d2"
                        ]
                      }
                    ],
                    "unservedDomains": [],
                    "updatedAt": "2026-01-01T00:00:00.000Z",
                    "updatedBy": "Session User m20-conn-owner",
                    "version": 2
                  }
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.sso_routing_updated"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/unclaimed": {
      "get": {
        "operationId": "workspaces.enterprise.unclaimed.list",
        "summary": "List accounts on the company's domains that are not its people yet",
        "description": "Needs company access `people` at `view` (until a Company admin is named, `workspace:settings:edit`). Takes `search` and `page`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/workload-identity": {
      "get": {
        "operationId": "workspaces.enterprise.workloadIdentity.list",
        "summary": "List the company's workload credentials and exchange details",
        "description": "Needs company access `keys` at `view`. Narrow it to one service account with `serviceAccountId`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "audience": {
                      "type": "string"
                    },
                    "available": {
                      "type": "boolean"
                    },
                    "credentials": {
                      "items": {
                        "properties": {
                          "audience": {
                            "type": "string"
                          },
                          "conditions": {
                            "items": {
                              "properties": {
                                "claim": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": "string"
                                }
                              },
                              "type": "object"
                            },
                            "type": "array"
                          },
                          "createdAt": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "createdVia": {
                            "type": "string"
                          },
                          "credentialId": {
                            "type": "string"
                          },
                          "ipRanges": {
                            "type": "array"
                          },
                          "issuer": {
                            "type": "string"
                          },
                          "keys": {
                            "properties": {
                              "checkedAt": {
                                "type": "string"
                              },
                              "count": {
                                "type": "integer"
                              },
                              "error": {}
                            },
                            "type": "object"
                          },
                          "labels": {
                            "properties": {
                              "owner": {
                                "type": "string"
                              },
                              "repository": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "lastRefusal": {},
                          "lastUsedAt": {},
                          "liveTokens": {
                            "type": "integer"
                          },
                          "maxAssertionMinutes": {
                            "type": "integer"
                          },
                          "name": {
                            "type": "string"
                          },
                          "preset": {
                            "type": "string"
                          },
                          "reference": {
                            "type": "string"
                          },
                          "reusableTokens": {
                            "type": "boolean"
                          },
                          "scopes": {
                            "items": {
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "serviceAccount": {
                            "type": "string"
                          },
                          "serviceAccountId": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "subject": {
                            "properties": {
                              "prefix": {
                                "type": "boolean"
                              },
                              "value": {
                                "type": "string"
                              }
                            },
                            "type": [
                              "null",
                              "object"
                            ]
                          },
                          "tokenMinutes": {
                            "type": "integer"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "max": {
                      "properties": {
                        "perCompany": {
                          "type": "integer"
                        },
                        "perServiceAccount": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "tokenEndpoint": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "audience": "http://localhost:3000/org/000000000000000000000001",
                  "available": true,
                  "credentials": [
                    {
                      "audience": "http://localhost:3000/org/000000000000000000000001",
                      "conditions": [
                        {
                          "claim": "repository_owner_id",
                          "value": "1001"
                        },
                        {
                          "claim": "repository_id",
                          "value": "456789"
                        },
                        {
                          "claim": "ref",
                          "value": "refs/heads/main"
                        }
                      ],
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "createdVia": "app",
                      "credentialId": "MYnnTRfErf6iyHdh",
                      "ipRanges": [],
                      "issuer": "https://token.actions.githubusercontent.com",
                      "keys": {
                        "checkedAt": "[REDACTED]",
                        "count": 0,
                        "error": null
                      },
                      "labels": {
                        "owner": "globex-eng",
                        "repository": "deploy"
                      },
                      "lastRefusal": null,
                      "lastUsedAt": null,
                      "liveTokens": 0,
                      "maxAssertionMinutes": 60,
                      "name": "deploy",
                      "preset": "github_actions",
                      "reference": "bbwi_6af413602865c46d9a5f7511_MYnnTRfErf6iyHdh",
                      "reusableTokens": false,
                      "scopes": [
                        "audit:read",
                        "people:read"
                      ],
                      "serviceAccount": "deploy-bot",
                      "serviceAccountId": "000000000000000000000002",
                      "status": "active",
                      "subject": null,
                      "tokenMinutes": 0
                    },
                    {
                      "audience": "http://localhost:3000/org/000000000000000000000001",
                      "conditions": [
                        {
                          "claim": "namespace_id",
                          "value": "77"
                        },
                        {
                          "claim": "project_id",
                          "value": "4242"
                        },
                        {
                          "claim": "ref",
                          "value": "main"
                        }
                      ],
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "createdVia": "console",
                      "credentialId": "ihmeH0Zi6vcQ4O8B",
                      "ipRanges": [],
                      "issuer": "https://gitlab.com",
                      "keys": {
                        "checkedAt": "[REDACTED]",
                        "count": 0,
                        "error": null
                      },
                      "labels": {},
                      "lastRefusal": null,
                      "lastUsedAt": null,
                      "liveTokens": 0,
                      "maxAssertionMinutes": 60,
                      "name": "GitLab 1767225600000",
                      "preset": "gitlab",
                      "reference": "bbwi_6af413602865c46d9a5f7511_ihmeH0Zi6vcQ4O8B",
                      "reusableTokens": false,
                      "scopes": [
                        "audit:read"
                      ],
                      "serviceAccount": "deploy-bot",
                      "serviceAccountId": "000000000000000000000002",
                      "status": "active",
                      "subject": null,
                      "tokenMinutes": 0
                    },
                    {
                      "audience": "http://localhost:3000/org/000000000000000000000001",
                      "conditions": [
                        {
                          "claim": "email",
                          "value": "user@example.com"
                        }
                      ],
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "createdVia": "console",
                      "credentialId": "qJarPaHBxlpZwHZg",
                      "ipRanges": [],
                      "issuer": "https://accounts.google.com",
                      "keys": {
                        "checkedAt": "[REDACTED]",
                        "count": 0,
                        "error": null
                      },
                      "labels": {},
                      "lastRefusal": null,
                      "lastUsedAt": null,
                      "liveTokens": 0,
                      "maxAssertionMinutes": 60,
                      "name": "Google Cloud 1767225600000",
                      "preset": "google_cloud",
                      "reference": "bbwi_6af413602865c46d9a5f7511_qJarPaHBxlpZwHZg",
                      "reusableTokens": true,
                      "scopes": [
                        "audit:read"
                      ],
                      "serviceAccount": "deploy-bot",
                      "serviceAccountId": "000000000000000000000002",
                      "status": "active",
                      "subject": {
                        "prefix": false,
                        "value": "112233445566778899000"
                      },
                      "tokenMinutes": 0
                    },
                    {
                      "audience": "http://localhost:3000/org/000000000000000000000001",
                      "conditions": [],
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "createdVia": "console",
                      "credentialId": "DDOMbg5ZTu4i8JOu",
                      "ipRanges": [],
                      "issuer": "https://m21stub0000.tokens.sts.global.api.aws",
                      "keys": {
                        "checkedAt": "[REDACTED]",
                        "count": 0,
                        "error": null
                      },
                      "labels": {},
                      "lastRefusal": null,
                      "lastUsedAt": null,
                      "liveTokens": 0,
                      "maxAssertionMinutes": 60,
                      "name": "AWS 1767225600000",
                      "preset": "aws",
                      "reference": "bbwi_6af413602865c46d9a5f7511_DDOMbg5ZTu4i8JOu",
                      "reusableTokens": false,
                      "scopes": [
                        "audit:read"
                      ],
                      "serviceAccount": "deploy-bot",
                      "serviceAccountId": "000000000000000000000002",
                      "status": "active",
                      "subject": {
                        "prefix": false,
                        "value": "arn:aws:iam::123456789012:role/deploy"
                      },
                      "tokenMinutes": 0
                    },
                    {
                      "audience": "http://localhost:3000/org/000000000000000000000001",
                      "conditions": [
                        {
                          "claim": "tid",
                          "value": "00000000-0000-4000-8000-000000000001"
                        }
                      ],
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "createdVia": "console",
                      "credentialId": "JE5YjMtWPx842MUs",
                      "ipRanges": [],
                      "issuer": "https://login.microsoftonline.com/7c7f1a7e-2b4e-4d65-9a1f-3c1a2b3c4d5e/v2.0",
                      "keys": {
                        "checkedAt": "[REDACTED]",
                        "count": 0,
                        "error": null
                      },
                      "labels": {},
                      "lastRefusal": null,
                      "lastUsedAt": null,
                      "liveTokens": 0,
                      "maxAssertionMinutes": 1440,
                      "name": "Microsoft Entra 1767225600000",
                      "preset": "entra",
                      "reference": "bbwi_6af413602865c46d9a5f7511_JE5YjMtWPx842MUs",
                      "reusableTokens": true,
                      "scopes": [
                        "audit:read"
                      ],
                      "serviceAccount": "deploy-bot",
                      "serviceAccountId": "000000000000000000000002",
                      "status": "active",
                      "subject": {
                        "prefix": false,
                        "value": "00000000-0000-4000-8000-000000000002"
                      },
                      "tokenMinutes": 0
                    },
                    {
                      "audience": "http://localhost:3000/org/000000000000000000000001",
                      "conditions": [],
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "createdVia": "console",
                      "credentialId": "T84jX1lSWxzh0cgo",
                      "ipRanges": [],
                      "issuer": "http://127.0.0.1:4199/ci/custom/buildfarm",
                      "keys": {
                        "checkedAt": "[REDACTED]",
                        "count": 0,
                        "error": null
                      },
                      "labels": {},
                      "lastRefusal": null,
                      "lastUsedAt": null,
                      "liveTokens": 0,
                      "maxAssertionMinutes": 60,
                      "name": "another OIDC issuer 1767225600000",
                      "preset": "custom",
                      "reference": "bbwi_6af413602865c46d9a5f7511_T84jX1lSWxzh0cgo",
                      "reusableTokens": false,
                      "scopes": [
                        "audit:read"
                      ],
                      "serviceAccount": "deploy-bot",
                      "serviceAccountId": "000000000000000000000002",
                      "status": "active",
                      "subject": {
                        "prefix": false,
                        "value": "system:serviceaccount:ci:deploy"
                      },
                      "tokenMinutes": 0
                    }
                  ],
                  "max": {
                    "perCompany": 100,
                    "perServiceAccount": 20
                  },
                  "tokenEndpoint": "[REDACTED]"
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/workload-identity/check": {
      "post": {
        "operationId": "workspaces.enterprise.workloadIdentity.check.create",
        "summary": "Dry-run an issuer's discovery and keys for a workload credential",
        "description": "Needs company access `keys` at `manage`. Saves and records nothing; rate limited. 409 `workload_identity_off` when the app's team has not turned workload identity on.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preset": {
                    "type": "string",
                    "enum": [
                      "github_actions",
                      "gitlab",
                      "google_cloud",
                      "aws",
                      "entra",
                      "custom"
                    ]
                  },
                  "issuer": {
                    "type": "string",
                    "maxLength": 512
                  }
                },
                "required": [
                  "preset"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "keys": {
                      "type": "integer"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "sharedIssuer": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "keys": 0,
                  "ok": true,
                  "sharedIssuer": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "enterprise-workload-check",
            "windowMs": 60000,
            "max": 10,
            "per": "enterpriseLimiterKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/workload-identity/credentials": {
      "post": {
        "operationId": "workspaces.enterprise.workloadIdentity.credentials.create",
        "summary": "Trust a CI job or cloud workload for a company service account",
        "description": "Needs company access `keys` at `manage`, a recent re-authentication (403 `reauth_required`) and the Enterprise SSO plan feature (402). Scopes stay within the caller's own company role. 409 `workload_identity_off` or `workload_name_taken`; 422 `too_many_workload_credentials`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "serviceAccountId": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "preset": {
                    "type": "string",
                    "enum": [
                      "github_actions",
                      "gitlab",
                      "google_cloud",
                      "aws",
                      "entra",
                      "custom"
                    ]
                  },
                  "issuer": {
                    "type": "string",
                    "maxLength": 512
                  },
                  "audience": {
                    "type": "string",
                    "maxLength": 256
                  },
                  "subject": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "value": {
                        "type": "string",
                        "maxLength": 256
                      },
                      "prefix": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "value"
                    ],
                    "additionalProperties": false
                  },
                  "conditions": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "properties": {
                        "claim": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "value": {
                          "type": "string",
                          "maxLength": 256
                        }
                      },
                      "required": [
                        "claim",
                        "value"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "labels": {
                    "type": "object",
                    "maxProperties": 4,
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 100
                    }
                  },
                  "scopes": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 15,
                    "items": {
                      "type": "string",
                      "maxLength": 32
                    }
                  },
                  "tokenMinutes": {
                    "type": "integer",
                    "enum": [
                      5,
                      15,
                      30,
                      60
                    ]
                  },
                  "maxAssertionMinutes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1440
                  },
                  "ipRanges": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "string",
                      "maxLength": 64
                    }
                  }
                },
                "required": [
                  "serviceAccountId",
                  "name",
                  "preset",
                  "scopes"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "audience": {
                      "type": "string"
                    },
                    "conditions": {
                      "items": {
                        "properties": {
                          "claim": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "createdVia": {
                      "type": "string"
                    },
                    "credentialId": {
                      "type": "string"
                    },
                    "ipRanges": {
                      "type": "array"
                    },
                    "issuer": {
                      "type": "string"
                    },
                    "keys": {
                      "properties": {
                        "checkedAt": {
                          "type": "string"
                        },
                        "count": {
                          "type": "integer"
                        },
                        "error": {}
                      },
                      "type": "object"
                    },
                    "labels": {
                      "properties": {
                        "owner": {
                          "type": "string"
                        },
                        "repository": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "lastRefusal": {},
                    "lastUsedAt": {},
                    "liveTokens": {
                      "type": "integer"
                    },
                    "maxAssertionMinutes": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "preset": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string"
                    },
                    "reusableTokens": {
                      "type": "boolean"
                    },
                    "scopes": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "serviceAccount": {
                      "type": "string"
                    },
                    "serviceAccountId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "subject": {},
                    "tokenMinutes": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "audience": "http://localhost:3000/org/000000000000000000000001",
                  "conditions": [
                    {
                      "claim": "repository_owner_id",
                      "value": "1001"
                    },
                    {
                      "claim": "repository_id",
                      "value": "456789"
                    },
                    {
                      "claim": "ref",
                      "value": "refs/heads/main"
                    }
                  ],
                  "createdAt": "2026-01-01T00:00:00.000Z",
                  "createdVia": "app",
                  "credentialId": "MYnnTRfErf6iyHdh",
                  "ipRanges": [],
                  "issuer": "https://token.actions.githubusercontent.com",
                  "keys": {
                    "checkedAt": "[REDACTED]",
                    "count": 0,
                    "error": null
                  },
                  "labels": {
                    "owner": "globex-eng",
                    "repository": "deploy"
                  },
                  "lastRefusal": null,
                  "lastUsedAt": null,
                  "liveTokens": 0,
                  "maxAssertionMinutes": 60,
                  "name": "deploy",
                  "preset": "github_actions",
                  "reference": "bbwi_6af413602865c46d9a5f7511_MYnnTRfErf6iyHdh",
                  "reusableTokens": false,
                  "scopes": [
                    "audit:read",
                    "people:read"
                  ],
                  "serviceAccount": "deploy-bot",
                  "serviceAccountId": "000000000000000000000002",
                  "status": "active",
                  "subject": null,
                  "tokenMinutes": 0
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.workload_credential_updated"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/workload-identity/credentials/{credentialId}": {
      "delete": {
        "operationId": "workspaces.enterprise.workloadIdentity.credentials.delete",
        "summary": "Delete a workload credential and end its live tokens",
        "description": "Needs company access `keys` at `manage`; no re-authentication asked. Returns `deleted` and `tokensRevoked`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "credentialId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "deleted": {
                      "type": "boolean"
                    },
                    "tokensRevoked": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "deleted": true,
                  "tokensRevoked": 0
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.workload_credential_updated"
        ]
      },
      "patch": {
        "operationId": "workspaces.enterprise.workloadIdentity.credentials.update",
        "summary": "Update a workload credential",
        "description": "Needs company access `keys` at `manage`. A change that widens it (turning it on, issuer, audience, pins, scopes, lifetimes or ranges) also needs a recent re-authentication (403 `reauth_required`); turning it off, renaming and narrowing do not.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "credentialId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "issuer": {
                    "type": "string",
                    "maxLength": 512
                  },
                  "audience": {
                    "type": "string",
                    "maxLength": 256
                  },
                  "subject": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "value": {
                        "type": "string",
                        "maxLength": 256
                      },
                      "prefix": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "value"
                    ],
                    "additionalProperties": false
                  },
                  "conditions": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "properties": {
                        "claim": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "value": {
                          "type": "string",
                          "maxLength": 256
                        }
                      },
                      "required": [
                        "claim",
                        "value"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "labels": {
                    "type": "object",
                    "maxProperties": 4,
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 100
                    }
                  },
                  "scopes": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 15,
                    "items": {
                      "type": "string",
                      "maxLength": 32
                    }
                  },
                  "tokenMinutes": {
                    "type": "integer",
                    "enum": [
                      5,
                      15,
                      30,
                      60
                    ]
                  },
                  "maxAssertionMinutes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1440
                  },
                  "ipRanges": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "string",
                      "maxLength": 64
                    }
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "disabled"
                    ]
                  },
                  "endLiveTokens": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false,
                "minProperties": 1
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "audience": {
                      "type": "string"
                    },
                    "conditions": {
                      "items": {
                        "properties": {
                          "claim": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "createdVia": {
                      "type": "string"
                    },
                    "credentialId": {
                      "type": "string"
                    },
                    "ipRanges": {
                      "type": "array"
                    },
                    "issuer": {
                      "type": "string"
                    },
                    "keys": {
                      "properties": {
                        "checkedAt": {
                          "type": "string"
                        },
                        "count": {
                          "type": "integer"
                        },
                        "error": {}
                      },
                      "type": "object"
                    },
                    "labels": {
                      "properties": {
                        "owner": {
                          "type": "string"
                        },
                        "repository": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "lastRefusal": {
                      "properties": {
                        "at": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "claim": {
                          "type": "string"
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "type": [
                        "null",
                        "object"
                      ]
                    },
                    "lastUsedAt": {},
                    "liveTokens": {
                      "type": "integer"
                    },
                    "maxAssertionMinutes": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "preset": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string"
                    },
                    "reusableTokens": {
                      "type": "boolean"
                    },
                    "scopes": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "serviceAccount": {
                      "type": "string"
                    },
                    "serviceAccountId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "subject": {},
                    "tokenMinutes": {
                      "type": "integer"
                    },
                    "tokensRevoked": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "audience": "http://localhost:3000/org/000000000000000000000001",
                  "conditions": [
                    {
                      "claim": "repository_owner_id",
                      "value": "1001"
                    },
                    {
                      "claim": "repository_id",
                      "value": "456789"
                    },
                    {
                      "claim": "ref",
                      "value": "refs/heads/main"
                    }
                  ],
                  "createdAt": "2026-01-01T00:00:00.000Z",
                  "createdVia": "console",
                  "credentialId": "YbQkOkfBRflQ1d47",
                  "ipRanges": [],
                  "issuer": "https://token.actions.githubusercontent.com",
                  "keys": {
                    "checkedAt": "[REDACTED]",
                    "count": 0,
                    "error": null
                  },
                  "labels": {
                    "owner": "globex-eng",
                    "repository": "deploy"
                  },
                  "lastRefusal": {
                    "at": "2026-01-01T00:00:00.000Z",
                    "claim": "repository_owner_id",
                    "reason": "conditions_not_met"
                  },
                  "lastUsedAt": null,
                  "liveTokens": 0,
                  "maxAssertionMinutes": 60,
                  "name": "wide retarget 1767225600000",
                  "preset": "github_actions",
                  "reference": "bbwi_6af413602865c46d9a5f7511_YbQkOkfBRflQ1d47",
                  "reusableTokens": false,
                  "scopes": [
                    "audit:read"
                  ],
                  "serviceAccount": "deploy-bot",
                  "serviceAccountId": "000000000000000000000002",
                  "status": "active",
                  "subject": null,
                  "tokenMinutes": 0
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts",
        "x-events": [
          "enterprise.workload_credential_updated"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/workos-roles": {
      "get": {
        "operationId": "workspaces.enterprise.workosRoles.list",
        "summary": "Get the company's WorkOS roles sync status",
        "description": "Needs company access `admins` at `view`. Returns the state, what is published, the roles people carry and any issues, read from the app owner's own WorkOS account.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "checks": {
                      "properties": {
                        "multipleRolesSeen": {
                          "type": "boolean"
                        },
                        "roleAssignmentSeen": {
                          "type": "boolean"
                        }
                      },
                      "type": "object"
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "issues": {
                      "items": {
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "item": {
                            "type": "string"
                          },
                          "sentence": {
                            "type": "string"
                          },
                          "since": {
                            "format": "date-time",
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "lastGoodReadAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "published": {
                      "items": {
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "readAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "seen": {
                      "type": "array"
                    },
                    "state": {
                      "type": "string"
                    },
                    "workosRolesFrom": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "checks": {
                    "multipleRolesSeen": false,
                    "roleAssignmentSeen": false
                  },
                  "enabled": true,
                  "issues": [
                    {
                      "code": "[REDACTED]",
                      "item": "security-admin",
                      "sentence": "A published role is gone from WorkOS.",
                      "since": "2026-01-01T00:00:00.000Z"
                    },
                    {
                      "code": "[REDACTED]",
                      "item": "auditor",
                      "sentence": "A published role's name or description in WorkOS differs from the one in the app.",
                      "since": "2026-01-01T00:00:00.000Z"
                    }
                  ],
                  "lastGoodReadAt": "2026-01-01T00:00:00.000Z",
                  "published": [
                    {
                      "id": "security-admin",
                      "kind": "preset",
                      "name": "Security admin",
                      "slug": "org-bb-security-admin",
                      "state": "published"
                    },
                    {
                      "id": "auditor",
                      "kind": "preset",
                      "name": "Auditor",
                      "slug": "org-bb-auditor",
                      "state": "published"
                    },
                    {
                      "id": "000000000000000000000001",
                      "kind": "role",
                      "name": "Service desk",
                      "slug": "org-bb-service-desk",
                      "state": "published"
                    },
                    {
                      "id": "000000000000000000000002",
                      "kind": "group",
                      "name": "Design editors",
                      "slug": "org-bb-group-design-editors",
                      "state": "published"
                    }
                  ],
                  "readAt": "2026-01-01T00:00:00.000Z",
                  "seen": [],
                  "state": "needs_attention",
                  "workosRolesFrom": "auto"
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/enterprise/workos-roles/refresh": {
      "post": {
        "operationId": "workspaces.enterprise.workosRoles.refresh.create",
        "summary": "Refresh the company's roles from WorkOS",
        "description": "Needs company access `setup` at `manage`; rate limited. Reads the roles back and, with a directory, every person's roles. Callers without `admins` at `view` get only `enabled`, `state` and `readAt`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "checks": {
                      "properties": {
                        "multipleRolesSeen": {
                          "type": "boolean"
                        },
                        "roleAssignmentSeen": {
                          "type": "boolean"
                        }
                      },
                      "type": "object"
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "issues": {
                      "items": {
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "item": {
                            "type": "string"
                          },
                          "sentence": {
                            "type": "string"
                          },
                          "since": {
                            "format": "date-time",
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "lastGoodReadAt": {
                      "format": "date-time",
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "published": {
                      "items": {
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "readAt": {
                      "format": "date-time",
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "seen": {
                      "type": "array"
                    },
                    "state": {
                      "type": "string"
                    },
                    "workosRolesFrom": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "checks": {
                    "multipleRolesSeen": false,
                    "roleAssignmentSeen": false
                  },
                  "enabled": true,
                  "issues": [
                    {
                      "code": "[REDACTED]",
                      "item": "security-admin",
                      "sentence": "A published role is gone from WorkOS.",
                      "since": "2026-01-01T00:00:00.000Z"
                    },
                    {
                      "code": "[REDACTED]",
                      "item": "auditor",
                      "sentence": "A published role's name or description in WorkOS differs from the one in the app.",
                      "since": "2026-01-01T00:00:00.000Z"
                    }
                  ],
                  "lastGoodReadAt": "2026-01-01T00:00:00.000Z",
                  "published": [
                    {
                      "id": "security-admin",
                      "kind": "preset",
                      "name": "Security admin",
                      "slug": "org-bb-security-admin",
                      "state": "published"
                    },
                    {
                      "id": "auditor",
                      "kind": "preset",
                      "name": "Auditor",
                      "slug": "org-bb-auditor",
                      "state": "published"
                    }
                  ],
                  "readAt": "2026-01-01T00:00:00.000Z",
                  "seen": [],
                  "state": "needs_attention",
                  "workosRolesFrom": "auto"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "signed-in-write",
            "windowMs": 60000,
            "max": 60,
            "per": "signedInWriteKey",
            "counts": "some"
          },
          {
            "prefix": "enterprise-audit-read",
            "windowMs": 60000,
            "max": 60,
            "per": "enterpriseLimiterKey",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/enterprise/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/features": {
      "get": {
        "operationId": "workspaces.byWorkspaceId.features.list",
        "summary": "Get the workspace's feature flags",
        "description": "Any member. Returns a map of feature slug to boolean, resolved from the workspace's plan for plan-managed features and from the workspace's own values or defaults for the rest.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/features/index.ts"
      },
      "patch": {
        "operationId": "workspaces.features.update",
        "summary": "Toggle the workspace's user-managed features",
        "description": "Needs `workspace:features:edit`. Only user-managed features that are enabled and not plan-managed change; others are named in `ignoredFeatures`, or refused with 403 `FEATURE_NOT_USER_MANAGED` when none can change. Refused with 402 while the workspace's plan is read-only after a lapse.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "features": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "boolean"
                    },
                    "required": []
                  }
                },
                "required": [
                  "features"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/features/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/files": {
      "get": {
        "operationId": "workspaces.files.list",
        "summary": "List the workspace's files for buyers",
        "description": "Needs `workspace:selling:view`. Each file lists the releases that hold it.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/files/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/files/uploads": {
      "post": {
        "operationId": "workspaces.files.uploads.create",
        "summary": "Start an upload of a file for buyers",
        "description": "Needs `workspace:selling:manage`; rate limited. Returns a direct upload `url`, `method`, `headers` and `maxBytes`. When the app's plan refuses the upload it answers 503 `UPLOADS_UNAVAILABLE`, and 501 when direct uploads are not available.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 1024
                  },
                  "size": {
                    "type": "number"
                  },
                  "contentType": {
                    "type": "string",
                    "maxLength": 255
                  }
                },
                "required": [
                  "name",
                  "size",
                  "contentType"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "public-write",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/files/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/files/uploads/{uploadId}/complete": {
      "post": {
        "operationId": "workspaces.files.uploads.complete.create",
        "summary": "Finish a file upload and return the stored file",
        "description": "Needs `workspace:selling:manage`; rate limited. Answers 409 `UPLOAD_NOT_RECEIVED` while the file has not arrived and 409 `UPLOAD_FINALIZING` while it is being checked.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "uploadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "public-write",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/files/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/files/{fileId}": {
      "get": {
        "operationId": "workspaces.files.get",
        "summary": "Get one of the workspace's files for buyers",
        "description": "Needs `workspace:selling:view`. Includes the releases that hold the file.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/files/index.ts"
      },
      "delete": {
        "operationId": "workspaces.files.delete",
        "summary": "Delete a file that no release holds",
        "description": "Needs `workspace:selling:manage`. A file a release holds answers 409 `FILE_IN_USE`; a storage failure answers 502.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/files/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/grants": {
      "get": {
        "operationId": "workspaces.grants.list",
        "summary": "List what the workspace holds beyond its plan",
        "description": "Any member. Returns `grants` from every source (add-ons, credits and the like), for display only.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/grants/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/invitations": {
      "get": {
        "operationId": "workspaces.invitations.list",
        "summary": "List the workspace's invitations",
        "description": "Needs `workspace:members:view`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/invitations/index.ts"
      },
      "post": {
        "operationId": "workspaces.invitations.create",
        "summary": "Invite someone to the workspace by email",
        "description": "Needs `workspace:members:invite` (and admin when the org limits invitations to admins). Refused with 402 `SEAT_LIMIT_REACHED` when seats are full, 403 `WORKSPACE_INVITES_DISABLED` or `USER_BLOCKED`, 409 when the person is already a member or invited, 502 `INVITATION_EMAIL_FAILED` when the mail cannot be queued (nothing is kept), and 503 when the org has no email sender.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "role": {
                    "type": "string"
                  },
                  "landingUrl": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": [
                  "email",
                  "role"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "_id": {
                      "type": "string"
                    },
                    "clientId": {
                      "type": "string"
                    },
                    "createdAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean"
                    },
                    "email": {
                      "type": "string"
                    },
                    "invitedAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "invitedBy": {
                      "type": "string"
                    },
                    "landingUrl": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "resendAvailableAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "role": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "updatedAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "validTill": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "workspace": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "_id": "000000000000000000000001",
                  "clientId": "Ibu9DY7diz1Voakp3WtCJBJ88o3V6HxHyCXiZ3qn",
                  "createdAt": "2026-01-01T00:00:00.000Z",
                  "deleted": false,
                  "email": "user@example.com",
                  "invitedAt": "2026-01-01T00:00:00.000Z",
                  "invitedBy": "000000000000000000000002",
                  "landingUrl": "http://localhost:9999/callback",
                  "message": "Invitation sent to user@example.com",
                  "resendAvailableAt": "2026-01-01T00:00:00.000Z",
                  "role": "editor",
                  "status": "invited",
                  "updatedAt": "2026-01-01T00:00:00.000Z",
                  "validTill": "2026-01-01T00:00:00.000Z",
                  "workspace": "000000000000000000000003"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "ws-invite",
            "windowMs": 3600000,
            "max": 60,
            "per": "inviteLimiterKey"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/invitations/index.ts",
        "x-events": [
          "workspace.member_invited"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/invitations/{id}": {
      "delete": {
        "operationId": "workspaces.invitations.delete",
        "summary": "Revoke a pending invitation",
        "description": "Needs `workspace:members:invite` (and admin when the org limits invitations to admins). Answers 409 when the invitation is no longer pending.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/invitations/index.ts",
        "x-events": [
          "workspace.invitation_revoked"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/invitations/{id}/resend": {
      "post": {
        "operationId": "workspaces.invitations.resend.create",
        "summary": "Send an invitation email again",
        "description": "Needs `workspace:members:invite`. Issues a new link and validity, reviving an expired invitation. A revive asks everything `workspaces.invitations.create` asks (the role, the company's outsider policy, a blocked account with `USER_BLOCKED`, the member ceilings, and 402 `PLAN_LIMIT_REACHED` while the plan is read-only). Refused with 409 when it was already accepted or declined, also when that happens while the mail is being sent, 429 `INVITATION_RATE_LIMITED` within the resend cooldown, and 502 `INVITATION_EMAIL_FAILED` when the mail cannot be queued.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "ws-invite",
            "windowMs": 3600000,
            "max": 60,
            "per": "inviteLimiterKey"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/invitations/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/items": {
      "get": {
        "operationId": "workspaces.items.list",
        "summary": "List the workspace's items",
        "description": "Needs `workspace:selling:view`. Lists only the workspace's own items, filterable by `status`, `q` and `typeKey`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "sellerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "sellerType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "user",
                "workspace",
                "org"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "pending_review",
                "published",
                "unlisted",
                "archived",
                "rejected"
              ]
            }
          },
          {
            "name": "typeKey",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 48
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/items/index.ts"
      },
      "post": {
        "operationId": "workspaces.items.create",
        "summary": "Create a draft item sold by the workspace",
        "description": "Needs `workspace:selling:manage`. The item type must be published and sold by workspaces (422 `ITEM_TYPE_NOT_SELLABLE`); invalid content answers 422 `ITEM_INVALID`, a taken slug 409 `ITEM_SLUG_TAKEN`, and a seller that can no longer sell 409 `SELLER_TERMINAL`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "typeKey": {
                    "type": "string",
                    "maxLength": 48
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "slug": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "summary": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 20000
                  },
                  "media": {
                    "type": "array",
                    "maxItems": 8,
                    "items": {
                      "type": "string",
                      "maxLength": 64
                    }
                  },
                  "ctaText": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "variants": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 250,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "label": {
                          "type": "string",
                          "maxLength": 126
                        },
                        "optionValues": {
                          "type": "object",
                          "maxProperties": 3,
                          "propertyNames": {
                            "maxLength": 16
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 16
                          }
                        },
                        "rank": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 1000
                        },
                        "prices": {
                          "type": "array",
                          "maxItems": 40,
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[a-z]{3}$"
                              },
                              "mode": {
                                "type": "string",
                                "enum": [
                                  "fixed",
                                  "free",
                                  "pwyw"
                                ]
                              },
                              "amount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "compareAtAmount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "minimum": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "suggested": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "maximum": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "recurring": {
                                "type": "object",
                                "properties": {
                                  "interval": {
                                    "type": "string",
                                    "enum": [
                                      "day",
                                      "week",
                                      "month",
                                      "year"
                                    ]
                                  },
                                  "intervalCount": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 365
                                  },
                                  "trialDays": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 730
                                  },
                                  "endAfterPayments": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 1000
                                  },
                                  "intro": {
                                    "type": "object",
                                    "properties": {
                                      "amount": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 10000000000
                                      },
                                      "periods": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 100
                                      }
                                    },
                                    "required": [
                                      "amount",
                                      "periods"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "interval"
                                ],
                                "additionalProperties": false
                              },
                              "deposit": {
                                "type": "object",
                                "properties": {
                                  "percentBps": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 10000
                                  }
                                },
                                "required": [
                                  "percentBps"
                                ],
                                "additionalProperties": false
                              },
                              "milestones": {
                                "type": "array",
                                "maxItems": 6,
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "label": {
                                      "type": "string",
                                      "maxLength": 60
                                    },
                                    "percentBps": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 10000
                                    }
                                  },
                                  "required": [
                                    "label",
                                    "percentBps"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "installments": {
                                "type": "object",
                                "properties": {
                                  "count": {
                                    "type": "integer",
                                    "minimum": 2,
                                    "maximum": 60
                                  },
                                  "interval": {
                                    "type": "string",
                                    "enum": [
                                      "week",
                                      "month",
                                      "year"
                                    ]
                                  },
                                  "intervalCount": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 12
                                  }
                                },
                                "required": [
                                  "count",
                                  "interval"
                                ],
                                "additionalProperties": false
                              },
                              "retired": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "currency",
                              "mode"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "stock": {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "enum": [
                                "none",
                                "single",
                                "counted"
                              ]
                            },
                            "available": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 1000000
                            },
                            "perBuyerLimit": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1000000
                            }
                          },
                          "required": [
                            "mode"
                          ],
                          "additionalProperties": false
                        },
                        "benefitIds": {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "data": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "type": [
                              "string",
                              "number",
                              "boolean",
                              "null",
                              "array",
                              "object"
                            ],
                            "maxLength": 20000,
                            "maxItems": 100
                          }
                        },
                        "terms": {
                          "type": "string",
                          "maxLength": 5000
                        },
                        "salesWindow": {
                          "type": "object",
                          "properties": {
                            "startsAt": {
                              "type": "string",
                              "maxLength": 40
                            },
                            "endsAt": {
                              "type": "string",
                              "maxLength": 40
                            }
                          },
                          "additionalProperties": false
                        },
                        "quantity": {
                          "type": "object",
                          "properties": {
                            "min": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1000000
                            },
                            "max": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1000000
                            }
                          },
                          "additionalProperties": false
                        },
                        "grantsPerUnit": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100
                        },
                        "releasesAt": {
                          "type": "string",
                          "maxLength": 40
                        },
                        "bookingSlots": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "weightGrams": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000000
                        },
                        "dimsMm": {
                          "type": "object",
                          "properties": {
                            "length": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 5000
                            },
                            "width": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 5000
                            },
                            "height": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 5000
                            }
                          },
                          "required": [
                            "length",
                            "width",
                            "height"
                          ],
                          "additionalProperties": false
                        },
                        "customs": {
                          "type": "object",
                          "properties": {
                            "hsCode": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 20
                            },
                            "originCountry": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 2
                            },
                            "description": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 50
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "id",
                        "prices",
                        "stock"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "data": {
                    "type": "object",
                    "maxProperties": 100,
                    "additionalProperties": {
                      "type": [
                        "string",
                        "number",
                        "boolean",
                        "null",
                        "array",
                        "object"
                      ],
                      "maxLength": 20000,
                      "maxItems": 100
                    }
                  },
                  "benefits": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "file",
                            "link",
                            "message",
                            "license_key",
                            "access",
                            "manual",
                            "webhook_only",
                            "transfer",
                            "item"
                          ]
                        },
                        "title": {
                          "type": "string",
                          "maxLength": 120
                        },
                        "afterDays": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 3650
                        },
                        "availableAt": {
                          "type": "string",
                          "maxLength": 40
                        },
                        "uses": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        },
                        "seriesId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "updatePolicy": {
                          "type": "string",
                          "enum": [
                            "latest",
                            "purchased",
                            "until"
                          ]
                        },
                        "updateMonths": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 120
                        },
                        "downloadLimit": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        },
                        "url": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "durationDays": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 36500
                        },
                        "text": {
                          "type": "string",
                          "maxLength": 5000
                        },
                        "activationLimit": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        },
                        "expiresInDays": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 36500
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "generated",
                            "seller_list"
                          ]
                        },
                        "resourceType": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "resourceId": {
                          "type": "string",
                          "maxLength": 128
                        },
                        "instructions": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "itemId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "variantId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100
                        }
                      },
                      "required": [
                        "id",
                        "kind"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "resourceRef": {
                    "type": "string",
                    "maxLength": 128
                  },
                  "refundPolicy": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "addOns": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "label": {
                          "type": "string",
                          "maxLength": 60
                        },
                        "prices": {
                          "type": "array",
                          "maxItems": 40,
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[a-z]{3}$"
                              },
                              "mode": {
                                "type": "string",
                                "enum": [
                                  "fixed",
                                  "free",
                                  "pwyw"
                                ]
                              },
                              "amount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "compareAtAmount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "minimum": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "suggested": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "maximum": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "recurring": {
                                "type": "object",
                                "properties": {
                                  "interval": {
                                    "type": "string",
                                    "enum": [
                                      "day",
                                      "week",
                                      "month",
                                      "year"
                                    ]
                                  },
                                  "intervalCount": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 365
                                  },
                                  "trialDays": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 730
                                  },
                                  "endAfterPayments": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 1000
                                  },
                                  "intro": {
                                    "type": "object",
                                    "properties": {
                                      "amount": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 10000000000
                                      },
                                      "periods": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 100
                                      }
                                    },
                                    "required": [
                                      "amount",
                                      "periods"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "interval"
                                ],
                                "additionalProperties": false
                              },
                              "deposit": {
                                "type": "object",
                                "properties": {
                                  "percentBps": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 10000
                                  }
                                },
                                "required": [
                                  "percentBps"
                                ],
                                "additionalProperties": false
                              },
                              "milestones": {
                                "type": "array",
                                "maxItems": 6,
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "label": {
                                      "type": "string",
                                      "maxLength": 60
                                    },
                                    "percentBps": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 10000
                                    }
                                  },
                                  "required": [
                                    "label",
                                    "percentBps"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "installments": {
                                "type": "object",
                                "properties": {
                                  "count": {
                                    "type": "integer",
                                    "minimum": 2,
                                    "maximum": 60
                                  },
                                  "interval": {
                                    "type": "string",
                                    "enum": [
                                      "week",
                                      "month",
                                      "year"
                                    ]
                                  },
                                  "intervalCount": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 12
                                  }
                                },
                                "required": [
                                  "count",
                                  "interval"
                                ],
                                "additionalProperties": false
                              },
                              "retired": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "currency",
                              "mode"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "maxQuantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000
                        },
                        "benefitIds": {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "type": "string",
                            "maxLength": 64
                          }
                        }
                      },
                      "required": [
                        "id",
                        "label",
                        "prices"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "payees": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "properties": {
                        "sellerId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "shareBps": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 10000
                        }
                      },
                      "required": [
                        "sellerId",
                        "shareBps"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "eligibility": {
                    "type": "object",
                    "properties": {
                      "requiresItemId": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "minRank": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "buyerIds": {
                        "type": "array",
                        "maxItems": 100,
                        "items": {
                          "type": "string",
                          "maxLength": 254
                        }
                      }
                    },
                    "additionalProperties": false
                  },
                  "capacity": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "questions": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "object",
                      "properties": {
                        "slug": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "title": {
                          "type": "string",
                          "maxLength": 120
                        },
                        "helpText": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "type": {
                          "type": "string",
                          "maxLength": 20
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "defaultValue": {
                          "type": [
                            "string",
                            "number",
                            "boolean",
                            "null"
                          ],
                          "maxLength": 1000
                        },
                        "options": {
                          "type": "array",
                          "maxItems": 200,
                          "items": {
                            "type": "object",
                            "properties": {
                              "value": {
                                "type": "string",
                                "maxLength": 120
                              },
                              "label": {
                                "type": "string",
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "value",
                              "label"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "min": {
                          "type": "number"
                        },
                        "max": {
                          "type": "number"
                        },
                        "pattern": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[a-z]{3}$"
                        },
                        "visibility": {
                          "type": "string",
                          "enum": [
                            "public",
                            "after_purchase",
                            "seller_only",
                            "app_only"
                          ]
                        },
                        "filterable": {
                          "type": "boolean"
                        },
                        "sortable": {
                          "type": "boolean"
                        },
                        "uniquePerOwner": {
                          "type": "boolean"
                        },
                        "maxMb": {
                          "type": "number",
                          "minimum": 0.1,
                          "maximum": 100
                        },
                        "maxFiles": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10
                        },
                        "per": {
                          "type": "string",
                          "enum": [
                            "order",
                            "unit"
                          ]
                        },
                        "variantIds": {
                          "type": "array",
                          "maxItems": 250,
                          "items": {
                            "type": "string",
                            "maxLength": 64
                          }
                        }
                      },
                      "required": [
                        "slug",
                        "title",
                        "type"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "shipping": {
                    "type": "object",
                    "properties": {
                      "countries": {
                        "type": "array",
                        "maxItems": 250,
                        "items": {
                          "type": "string",
                          "maxLength": 2
                        }
                      },
                      "regions": {
                        "type": "array",
                        "maxItems": 500,
                        "items": {
                          "type": "string",
                          "maxLength": 10
                        }
                      },
                      "flatRate": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000000000
                      },
                      "additionalRate": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000000000
                      },
                      "packagingGrams": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000000
                      },
                      "pickup": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "countries"
                    ],
                    "additionalProperties": false
                  },
                  "taxCode": {
                    "type": "string",
                    "maxLength": 20
                  },
                  "buyerCountries": {
                    "type": "array",
                    "maxItems": 250,
                    "items": {
                      "type": "string",
                      "maxLength": 2
                    }
                  },
                  "customs": {
                    "type": "object",
                    "properties": {
                      "hsCode": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 20
                      },
                      "originCountry": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 2
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 50
                      }
                    },
                    "additionalProperties": false
                  },
                  "options": {
                    "type": "array",
                    "maxItems": 3,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 16
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 40
                        },
                        "values": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 16
                              },
                              "label": {
                                "type": "string",
                                "maxLength": 40
                              },
                              "retired": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "label"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "values"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "booking": {
                    "type": "object",
                    "properties": {
                      "calendarId": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{24}$"
                      },
                      "timeZone": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "slotMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 720
                      },
                      "bufferMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 240
                      },
                      "bufferBeforeMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 240
                      },
                      "seatsPerSlot": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "weekly": {
                        "type": "object",
                        "properties": {
                          "mon": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "tue": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "wed": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "thu": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "fri": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "sat": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "sun": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "additionalProperties": false
                      },
                      "exceptions": {
                        "type": "array",
                        "maxItems": 200,
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "maxLength": 10
                            },
                            "windows": {
                              "type": "array",
                              "maxItems": 6,
                              "items": {
                                "type": "object",
                                "properties": {
                                  "from": {
                                    "type": "string",
                                    "maxLength": 5
                                  },
                                  "to": {
                                    "type": "string",
                                    "maxLength": 5
                                  }
                                },
                                "required": [
                                  "from",
                                  "to"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "date",
                            "windows"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "minNoticeMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 43200
                      },
                      "maxDaysAhead": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 365
                      },
                      "buyerCancel": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "minutesBefore": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 43200
                          },
                          "refund": {
                            "type": "string",
                            "enum": [
                              "full",
                              "none"
                            ]
                          }
                        },
                        "required": [
                          "minutesBefore",
                          "refund"
                        ],
                        "additionalProperties": false
                      },
                      "buyerReschedule": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "minutesBefore": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 43200
                          },
                          "maxTimes": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 10
                          }
                        },
                        "required": [
                          "minutesBefore",
                          "maxTimes"
                        ],
                        "additionalProperties": false
                      },
                      "seatsPerUnit": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100
                      },
                      "seatsCap": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "bookingLimits": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "perDay": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "maximum": 1000
                          },
                          "perWeek": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "maximum": 1000
                          }
                        },
                        "additionalProperties": false
                      },
                      "reminders": {
                        "type": "array",
                        "maxItems": 3,
                        "items": {
                          "type": "object",
                          "properties": {
                            "minutesBefore": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 10080
                            }
                          },
                          "required": [
                            "minutesBefore"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "typeKey",
                  "title",
                  "slug",
                  "variants"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/items/index.ts",
        "x-events": [
          "item.created"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/items/{id}": {
      "get": {
        "operationId": "workspaces.items.get",
        "summary": "Get one of the workspace's items",
        "description": "Needs `workspace:selling:view`. Another seller's item answers 404 `ITEM_NOT_FOUND`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/items/index.ts"
      },
      "put": {
        "operationId": "workspaces.items.update",
        "summary": "Replace the content of one of the workspace's items",
        "description": "Needs `workspace:selling:manage`. Invalid content answers 422 `ITEM_INVALID`; a concurrent change answers 409 `ITEM_STATE_CONFLICT`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "slug": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "summary": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 20000
                  },
                  "media": {
                    "type": "array",
                    "maxItems": 8,
                    "items": {
                      "type": "string",
                      "maxLength": 64
                    }
                  },
                  "ctaText": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "variants": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 250,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "label": {
                          "type": "string",
                          "maxLength": 126
                        },
                        "optionValues": {
                          "type": "object",
                          "maxProperties": 3,
                          "propertyNames": {
                            "maxLength": 16
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 16
                          }
                        },
                        "rank": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 1000
                        },
                        "prices": {
                          "type": "array",
                          "maxItems": 40,
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[a-z]{3}$"
                              },
                              "mode": {
                                "type": "string",
                                "enum": [
                                  "fixed",
                                  "free",
                                  "pwyw"
                                ]
                              },
                              "amount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "compareAtAmount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "minimum": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "suggested": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "maximum": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "recurring": {
                                "type": "object",
                                "properties": {
                                  "interval": {
                                    "type": "string",
                                    "enum": [
                                      "day",
                                      "week",
                                      "month",
                                      "year"
                                    ]
                                  },
                                  "intervalCount": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 365
                                  },
                                  "trialDays": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 730
                                  },
                                  "endAfterPayments": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 1000
                                  },
                                  "intro": {
                                    "type": "object",
                                    "properties": {
                                      "amount": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 10000000000
                                      },
                                      "periods": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 100
                                      }
                                    },
                                    "required": [
                                      "amount",
                                      "periods"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "interval"
                                ],
                                "additionalProperties": false
                              },
                              "deposit": {
                                "type": "object",
                                "properties": {
                                  "percentBps": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 10000
                                  }
                                },
                                "required": [
                                  "percentBps"
                                ],
                                "additionalProperties": false
                              },
                              "milestones": {
                                "type": "array",
                                "maxItems": 6,
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "label": {
                                      "type": "string",
                                      "maxLength": 60
                                    },
                                    "percentBps": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 10000
                                    }
                                  },
                                  "required": [
                                    "label",
                                    "percentBps"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "installments": {
                                "type": "object",
                                "properties": {
                                  "count": {
                                    "type": "integer",
                                    "minimum": 2,
                                    "maximum": 60
                                  },
                                  "interval": {
                                    "type": "string",
                                    "enum": [
                                      "week",
                                      "month",
                                      "year"
                                    ]
                                  },
                                  "intervalCount": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 12
                                  }
                                },
                                "required": [
                                  "count",
                                  "interval"
                                ],
                                "additionalProperties": false
                              },
                              "retired": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "currency",
                              "mode"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "stock": {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "enum": [
                                "none",
                                "single",
                                "counted"
                              ]
                            },
                            "available": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 1000000
                            },
                            "perBuyerLimit": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1000000
                            }
                          },
                          "required": [
                            "mode"
                          ],
                          "additionalProperties": false
                        },
                        "benefitIds": {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "type": "string",
                            "maxLength": 64
                          }
                        },
                        "data": {
                          "type": "object",
                          "maxProperties": 100,
                          "additionalProperties": {
                            "type": [
                              "string",
                              "number",
                              "boolean",
                              "null",
                              "array",
                              "object"
                            ],
                            "maxLength": 20000,
                            "maxItems": 100
                          }
                        },
                        "terms": {
                          "type": "string",
                          "maxLength": 5000
                        },
                        "salesWindow": {
                          "type": "object",
                          "properties": {
                            "startsAt": {
                              "type": "string",
                              "maxLength": 40
                            },
                            "endsAt": {
                              "type": "string",
                              "maxLength": 40
                            }
                          },
                          "additionalProperties": false
                        },
                        "quantity": {
                          "type": "object",
                          "properties": {
                            "min": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1000000
                            },
                            "max": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1000000
                            }
                          },
                          "additionalProperties": false
                        },
                        "grantsPerUnit": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100
                        },
                        "releasesAt": {
                          "type": "string",
                          "maxLength": 40
                        },
                        "bookingSlots": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "weightGrams": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000000
                        },
                        "dimsMm": {
                          "type": "object",
                          "properties": {
                            "length": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 5000
                            },
                            "width": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 5000
                            },
                            "height": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 5000
                            }
                          },
                          "required": [
                            "length",
                            "width",
                            "height"
                          ],
                          "additionalProperties": false
                        },
                        "customs": {
                          "type": "object",
                          "properties": {
                            "hsCode": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 20
                            },
                            "originCountry": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 2
                            },
                            "description": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 50
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "id",
                        "prices",
                        "stock"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "data": {
                    "type": "object",
                    "maxProperties": 100,
                    "additionalProperties": {
                      "type": [
                        "string",
                        "number",
                        "boolean",
                        "null",
                        "array",
                        "object"
                      ],
                      "maxLength": 20000,
                      "maxItems": 100
                    }
                  },
                  "benefits": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "file",
                            "link",
                            "message",
                            "license_key",
                            "access",
                            "manual",
                            "webhook_only",
                            "transfer",
                            "item"
                          ]
                        },
                        "title": {
                          "type": "string",
                          "maxLength": 120
                        },
                        "afterDays": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 3650
                        },
                        "availableAt": {
                          "type": "string",
                          "maxLength": 40
                        },
                        "uses": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        },
                        "seriesId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "updatePolicy": {
                          "type": "string",
                          "enum": [
                            "latest",
                            "purchased",
                            "until"
                          ]
                        },
                        "updateMonths": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 120
                        },
                        "downloadLimit": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        },
                        "url": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "durationDays": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 36500
                        },
                        "text": {
                          "type": "string",
                          "maxLength": 5000
                        },
                        "activationLimit": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10000
                        },
                        "expiresInDays": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 36500
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "generated",
                            "seller_list"
                          ]
                        },
                        "resourceType": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "resourceId": {
                          "type": "string",
                          "maxLength": 128
                        },
                        "instructions": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "itemId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "variantId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100
                        }
                      },
                      "required": [
                        "id",
                        "kind"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "resourceRef": {
                    "type": "string",
                    "maxLength": 128
                  },
                  "refundPolicy": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "addOns": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "label": {
                          "type": "string",
                          "maxLength": 60
                        },
                        "prices": {
                          "type": "array",
                          "maxItems": 40,
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[a-z]{3}$"
                              },
                              "mode": {
                                "type": "string",
                                "enum": [
                                  "fixed",
                                  "free",
                                  "pwyw"
                                ]
                              },
                              "amount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "compareAtAmount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "minimum": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "suggested": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "maximum": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000000
                              },
                              "recurring": {
                                "type": "object",
                                "properties": {
                                  "interval": {
                                    "type": "string",
                                    "enum": [
                                      "day",
                                      "week",
                                      "month",
                                      "year"
                                    ]
                                  },
                                  "intervalCount": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 365
                                  },
                                  "trialDays": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 730
                                  },
                                  "endAfterPayments": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 1000
                                  },
                                  "intro": {
                                    "type": "object",
                                    "properties": {
                                      "amount": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 10000000000
                                      },
                                      "periods": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 100
                                      }
                                    },
                                    "required": [
                                      "amount",
                                      "periods"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "interval"
                                ],
                                "additionalProperties": false
                              },
                              "deposit": {
                                "type": "object",
                                "properties": {
                                  "percentBps": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 10000
                                  }
                                },
                                "required": [
                                  "percentBps"
                                ],
                                "additionalProperties": false
                              },
                              "milestones": {
                                "type": "array",
                                "maxItems": 6,
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "label": {
                                      "type": "string",
                                      "maxLength": 60
                                    },
                                    "percentBps": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 10000
                                    }
                                  },
                                  "required": [
                                    "label",
                                    "percentBps"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "installments": {
                                "type": "object",
                                "properties": {
                                  "count": {
                                    "type": "integer",
                                    "minimum": 2,
                                    "maximum": 60
                                  },
                                  "interval": {
                                    "type": "string",
                                    "enum": [
                                      "week",
                                      "month",
                                      "year"
                                    ]
                                  },
                                  "intervalCount": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 12
                                  }
                                },
                                "required": [
                                  "count",
                                  "interval"
                                ],
                                "additionalProperties": false
                              },
                              "retired": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "currency",
                              "mode"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "maxQuantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000
                        },
                        "benefitIds": {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "type": "string",
                            "maxLength": 64
                          }
                        }
                      },
                      "required": [
                        "id",
                        "label",
                        "prices"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "payees": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "properties": {
                        "sellerId": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "shareBps": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 10000
                        }
                      },
                      "required": [
                        "sellerId",
                        "shareBps"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "eligibility": {
                    "type": "object",
                    "properties": {
                      "requiresItemId": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "minRank": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "buyerIds": {
                        "type": "array",
                        "maxItems": 100,
                        "items": {
                          "type": "string",
                          "maxLength": 254
                        }
                      }
                    },
                    "additionalProperties": false
                  },
                  "capacity": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "questions": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "object",
                      "properties": {
                        "slug": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "title": {
                          "type": "string",
                          "maxLength": 120
                        },
                        "helpText": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "type": {
                          "type": "string",
                          "maxLength": 20
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "defaultValue": {
                          "type": [
                            "string",
                            "number",
                            "boolean",
                            "null"
                          ],
                          "maxLength": 1000
                        },
                        "options": {
                          "type": "array",
                          "maxItems": 200,
                          "items": {
                            "type": "object",
                            "properties": {
                              "value": {
                                "type": "string",
                                "maxLength": 120
                              },
                              "label": {
                                "type": "string",
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "value",
                              "label"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "min": {
                          "type": "number"
                        },
                        "max": {
                          "type": "number"
                        },
                        "pattern": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[a-z]{3}$"
                        },
                        "visibility": {
                          "type": "string",
                          "enum": [
                            "public",
                            "after_purchase",
                            "seller_only",
                            "app_only"
                          ]
                        },
                        "filterable": {
                          "type": "boolean"
                        },
                        "sortable": {
                          "type": "boolean"
                        },
                        "uniquePerOwner": {
                          "type": "boolean"
                        },
                        "maxMb": {
                          "type": "number",
                          "minimum": 0.1,
                          "maximum": 100
                        },
                        "maxFiles": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10
                        },
                        "per": {
                          "type": "string",
                          "enum": [
                            "order",
                            "unit"
                          ]
                        },
                        "variantIds": {
                          "type": "array",
                          "maxItems": 250,
                          "items": {
                            "type": "string",
                            "maxLength": 64
                          }
                        }
                      },
                      "required": [
                        "slug",
                        "title",
                        "type"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "shipping": {
                    "type": "object",
                    "properties": {
                      "countries": {
                        "type": "array",
                        "maxItems": 250,
                        "items": {
                          "type": "string",
                          "maxLength": 2
                        }
                      },
                      "regions": {
                        "type": "array",
                        "maxItems": 500,
                        "items": {
                          "type": "string",
                          "maxLength": 10
                        }
                      },
                      "flatRate": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000000000
                      },
                      "additionalRate": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000000000
                      },
                      "packagingGrams": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000000
                      },
                      "pickup": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "countries"
                    ],
                    "additionalProperties": false
                  },
                  "taxCode": {
                    "type": "string",
                    "maxLength": 20
                  },
                  "buyerCountries": {
                    "type": "array",
                    "maxItems": 250,
                    "items": {
                      "type": "string",
                      "maxLength": 2
                    }
                  },
                  "customs": {
                    "type": "object",
                    "properties": {
                      "hsCode": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 20
                      },
                      "originCountry": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 2
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 50
                      }
                    },
                    "additionalProperties": false
                  },
                  "options": {
                    "type": "array",
                    "maxItems": 3,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 16
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 40
                        },
                        "values": {
                          "type": "array",
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 16
                              },
                              "label": {
                                "type": "string",
                                "maxLength": 40
                              },
                              "retired": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "label"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "values"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "booking": {
                    "type": "object",
                    "properties": {
                      "calendarId": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{24}$"
                      },
                      "timeZone": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "slotMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 720
                      },
                      "bufferMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 240
                      },
                      "bufferBeforeMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 240
                      },
                      "seatsPerSlot": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "weekly": {
                        "type": "object",
                        "properties": {
                          "mon": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "tue": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "wed": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "thu": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "fri": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "sat": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "sun": {
                            "type": "array",
                            "maxItems": 6,
                            "items": {
                              "type": "object",
                              "properties": {
                                "from": {
                                  "type": "string",
                                  "maxLength": 5
                                },
                                "to": {
                                  "type": "string",
                                  "maxLength": 5
                                }
                              },
                              "required": [
                                "from",
                                "to"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "additionalProperties": false
                      },
                      "exceptions": {
                        "type": "array",
                        "maxItems": 200,
                        "items": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "maxLength": 10
                            },
                            "windows": {
                              "type": "array",
                              "maxItems": 6,
                              "items": {
                                "type": "object",
                                "properties": {
                                  "from": {
                                    "type": "string",
                                    "maxLength": 5
                                  },
                                  "to": {
                                    "type": "string",
                                    "maxLength": 5
                                  }
                                },
                                "required": [
                                  "from",
                                  "to"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "date",
                            "windows"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "minNoticeMinutes": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 43200
                      },
                      "maxDaysAhead": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 365
                      },
                      "buyerCancel": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "minutesBefore": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 43200
                          },
                          "refund": {
                            "type": "string",
                            "enum": [
                              "full",
                              "none"
                            ]
                          }
                        },
                        "required": [
                          "minutesBefore",
                          "refund"
                        ],
                        "additionalProperties": false
                      },
                      "buyerReschedule": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "minutesBefore": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 43200
                          },
                          "maxTimes": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 10
                          }
                        },
                        "required": [
                          "minutesBefore",
                          "maxTimes"
                        ],
                        "additionalProperties": false
                      },
                      "seatsPerUnit": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100
                      },
                      "seatsCap": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "bookingLimits": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "perDay": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "maximum": 1000
                          },
                          "perWeek": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "maximum": 1000
                          }
                        },
                        "additionalProperties": false
                      },
                      "reminders": {
                        "type": "array",
                        "maxItems": 3,
                        "items": {
                          "type": "object",
                          "properties": {
                            "minutesBefore": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 10080
                            }
                          },
                          "required": [
                            "minutesBefore"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "title",
                  "slug",
                  "variants"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/items/index.ts",
        "x-events": [
          "item.updated"
        ]
      },
      "delete": {
        "operationId": "workspaces.items.delete",
        "summary": "Delete an item that was never listed or sold",
        "description": "Needs `workspace:selling:manage`. Answers 204. An item that was listed or sold answers 409 `ITEM_STATE_CONFLICT`; archive it instead.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/items/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/items/{id}/archive": {
      "post": {
        "operationId": "workspaces.items.archive.create",
        "summary": "Archive one of the workspace's items",
        "description": "Needs `workspace:selling:manage`. Takes the item off sale; a status that cannot be archived answers 409 `ITEM_STATE_CONFLICT`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/items/index.ts",
        "x-events": [
          "item.archived"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/items/{id}/booking/calendar-move": {
      "post": {
        "operationId": "workspaces.items.booking.calendarMove.create",
        "summary": "Move an item's upcoming bookings onto one of the workspace's calendars",
        "description": "Needs `workspace:selling:manage`. Resumes a running move to the same calendar. Bookings off the target's grid, or over its seats when it does not overbook, answer 409 `CALENDAR_MOVE_CONFLICTS`; a move to another calendar already running answers 409 `BOOKING_CALENDAR_MOVING`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "calendarId": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  }
                },
                "required": [
                  "calendarId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/items/index.ts",
        "x-events": [
          "booking.updated"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/items/{id}/booking/calendar-move/preview": {
      "post": {
        "operationId": "workspaces.items.booking.calendarMove.preview.create",
        "summary": "Preview moving an item's bookings onto one of the workspace's calendars",
        "description": "Needs `workspace:selling:manage`. Reads only: says booking by booking which fit, which go over the seats and which are off the target's grid.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "calendarId": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  }
                },
                "required": [
                  "calendarId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/items/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/items/{id}/publish": {
      "post": {
        "operationId": "workspaces.items.publish.create",
        "summary": "Publish one of the workspace's items, or submit it for review",
        "description": "Needs `workspace:selling:manage`. Goes to review when the item type asks for it. Problems answer 422 `ITEM_INVALID` (kept on the item), the plan's listing limit 402 `ITEM_LISTING_LIMIT`, selling turned off 503 `SELLING_UNAVAILABLE`, and a status that cannot be published 409 `ITEM_STATE_CONFLICT`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/items/index.ts",
        "x-events": [
          "item.published",
          "item.updated"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/items/{id}/unlist": {
      "post": {
        "operationId": "workspaces.items.unlist.create",
        "summary": "Unlist one of the workspace's items",
        "description": "Needs `workspace:selling:manage`. A status that cannot be unlisted answers 409 `ITEM_STATE_CONFLICT`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/items/index.ts",
        "x-events": [
          "item.updated"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/limits/{slug}": {
      "get": {
        "operationId": "workspaces.limits.get",
        "summary": "Get one of the workspace's limits and its claims standing",
        "description": "Needs `workspace:billing:view`. Returns the ceiling (`limit`, `unlimited`), where it came from, and the active claims against it, optionally for one `partitionKey`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/limits/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/limits/{slug}/claim": {
      "post": {
        "operationId": "workspaces.limits.claim.create",
        "summary": "Claim one unit of a workspace limit for a resource",
        "description": "Needs `workspace:usage:record`. Answers 201 for a new claim and 200 when the resource already holds one. Refused with 402 `PLAN_LIMIT_REACHED` at the ceiling (403 neutral at an end-user boundary), 409 `CLAIM_LINKED` for a slug claimed elsewhere, and 429 `CLAIM_CAP_REACHED`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "resourceId": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  },
                  "partitionKey": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  },
                  "metadata": {
                    "type": "object",
                    "maxProperties": 20
                  }
                },
                "required": [
                  "resourceId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "entitlement-claims",
            "windowMs": 60000,
            "max": 120,
            "per": "claimLimiterKey"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/limits/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/limits/{slug}/claims": {
      "get": {
        "operationId": "workspaces.limits.claims.list",
        "summary": "List the active claims on a workspace limit",
        "description": "Needs `workspace:billing:view`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/limits/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/limits/{slug}/release": {
      "post": {
        "operationId": "workspaces.limits.release.create",
        "summary": "Release a claim on a workspace limit",
        "description": "Needs `workspace:usage:record`. Refused with 409 `CLAIM_LINKED` or `RELEASE_BUDGET_EXHAUSTED`, and 404 when there is no such claim.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "resourceId": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  },
                  "partitionKey": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$"
                  }
                },
                "required": [
                  "resourceId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "entitlement-claims",
            "windowMs": 60000,
            "max": 120,
            "per": "claimLimiterKey"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/limits/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/notification-events": {
      "get": {
        "operationId": "workspaces.notificationEvents.list",
        "summary": "List the notification events members can manage",
        "description": "Any member. Returns the enabled, user-managed events with their channels.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/notification-preferences": {
      "get": {
        "operationId": "workspaces.notificationPreferences.list",
        "summary": "Get the workspace's default notification preferences",
        "description": "Needs `workspace:settings:view`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/index.ts"
      },
      "patch": {
        "operationId": "workspaces.notificationPreferences.update",
        "summary": "Update the workspace's default notification preferences",
        "description": "Needs `workspace:settings:edit`. Merged per event; `required` makes an event one members cannot switch off. Only user-managed events are accepted, others get 400.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "notificationPreferences": {
                    "type": "object",
                    "patternProperties": {
                      "^.+$": {
                        "type": "object",
                        "properties": {
                          "email": {
                            "type": "boolean"
                          },
                          "push": {
                            "type": "boolean"
                          },
                          "required": {
                            "type": "boolean"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "notificationPreferences"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "notificationPreferences": {
                      "properties": {},
                      "additionalProperties": {
                        "properties": {
                          "email": {
                            "type": "boolean"
                          },
                          "required": {
                            "type": "boolean"
                          }
                        },
                        "type": "object"
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "notificationPreferences": {
                    "e2einbox1794380634533": {
                      "email": false,
                      "required": true
                    }
                  }
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/notification-preferences/me": {
      "get": {
        "operationId": "workspaces.notificationPreferences.me.list",
        "summary": "Get the caller's own notification preferences in the workspace",
        "description": "Any member. Returns the workspace `defaults` and the caller's own choices in `mine`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "defaults": {
                      "properties": {},
                      "type": "object"
                    },
                    "mine": {
                      "properties": {},
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "defaults": {},
                  "mine": {}
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/index.ts"
      },
      "patch": {
        "operationId": "workspaces.notificationPreferences.me.update",
        "summary": "Update the caller's own notification preferences in the workspace",
        "description": "Any member. `null` resets a channel to the workspace default. Refused with 409 `NOTIFICATION_PREFERENCE_REQUIRED` for an event the workspace marks required.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "notificationPreferences": {
                    "type": "object",
                    "patternProperties": {
                      "^.+$": {
                        "type": "object",
                        "properties": {
                          "email": {
                            "type": [
                              "boolean",
                              "null"
                            ]
                          },
                          "push": {
                            "type": [
                              "boolean",
                              "null"
                            ]
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "notificationPreferences"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "defaults": {
                      "properties": {},
                      "type": "object"
                    },
                    "mine": {
                      "properties": {},
                      "additionalProperties": {
                        "properties": {
                          "push": {
                            "type": "boolean"
                          }
                        },
                        "type": "object"
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "defaults": {},
                  "mine": {
                    "e2einbox1794380634533": {
                      "push": false
                    }
                  }
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/notifications/scheduled/{scheduledId}": {
      "delete": {
        "operationId": "workspaces.notifications.scheduled.delete",
        "summary": "Cancel a scheduled notification send",
        "description": "Any member. Answers 409 `SCHEDULED_SEND_NOT_PENDING` when it is already sending, sent, failed or cancelled.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "scheduledId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$",
              "maxLength": 24
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/notifications/send": {
      "post": {
        "operationId": "workspaces.notifications.send.create",
        "summary": "Send a notification event to one member or the whole workspace",
        "description": "Any member, rate limited. Delivers by email and push per the event's settings and members' preferences; a future `data.scheduledAt` stores it and returns a `scheduledId`. Refused with 403 `NOTIFICATION_EVENT_NOT_SET_UP` for an event the app has not set up, and 404 when `userId` is not a member.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "userId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "data": {
                    "type": "object"
                  }
                },
                "required": [
                  "event"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "channels": {
                      "properties": {
                        "email": {
                          "type": "boolean"
                        },
                        "push": {
                          "type": "boolean"
                        }
                      },
                      "type": "object"
                    },
                    "notifiedCount": {
                      "type": "integer"
                    },
                    "sent": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "channels": {
                    "email": false,
                    "push": false
                  },
                  "notifiedCount": 1,
                  "sent": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "ws-notify",
            "windowMs": 3600000,
            "max": 300,
            "per": "inviteLimiterKey"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/permissions": {
      "get": {
        "operationId": "workspaces.permissions.list",
        "summary": "Get the workspace's permission overrides by role",
        "description": "Needs `workspace:settings:view`. Returns `permissions`, or null when the workspace uses the org's matrix.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "permissions": {
                      "properties": {
                        "reviewer": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "permissions": {
                    "reviewer": [
                      "workspace:settings:view"
                    ]
                  }
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/index.ts"
      },
      "patch": {
        "operationId": "workspaces.permissions.update",
        "summary": "Set the workspace's permission overrides by role",
        "description": "Needs `workspace:settings:edit`. Unknown permissions or roles get 400, and granting more than the caller holds gets 403. The change is recorded in the workspace activity.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "permissions": {
                    "type": "object",
                    "maxProperties": 100,
                    "propertyNames": {
                      "maxLength": 64
                    },
                    "patternProperties": {
                      "^.+$": {
                        "type": "array",
                        "maxItems": 300,
                        "items": {
                          "type": "string",
                          "maxLength": 128
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "permissions"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "permissions": {
                      "properties": {
                        "reviewer": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "permissions": {
                    "reviewer": [
                      "workspace:settings:view",
                      "app:documents:publish"
                    ]
                  }
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/permissions/me": {
      "get": {
        "operationId": "workspaces.permissions.me.list",
        "summary": "Get the permissions the caller holds in the workspace",
        "description": "Any member. Returns the platform and app permissions resolved for the caller, with the role they come from.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "isOwner": {
                      "type": "boolean"
                    },
                    "permissions": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "role": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "isOwner": false,
                  "permissions": [
                    "workspace:settings:view",
                    "workspace:settings:edit",
                    "workspace:members:view",
                    "workspace:members:invite",
                    "workspace:members:remove",
                    "workspace:members:role-change",
                    "workspace:features:view",
                    "workspace:features:edit",
                    "workspace:billing:view",
                    "workspace:billing:manage"
                  ],
                  "role": "admin"
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/quotas/{slug}": {
      "get": {
        "operationId": "workspaces.quotas.get",
        "summary": "Get the workspace's standing on one quota",
        "description": "Needs `workspace:usage:view`. `member=1` adds the caller's own standing on a per-member quota, and `partitionKey` adds that partition's usage and cap.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/quotas/index.ts"
      },
      "patch": {
        "operationId": "workspaces.quotas.update",
        "summary": "Set the workspace's spend cap and partition caps on a quota",
        "description": "Needs `workspace:billing:manage`. Sets `maxOverageUnits`, `notifyAtPercent` and `partitionCaps`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "maxOverageUnits": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notifyAtPercent": {
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 100
                    },
                    "uniqueItems": true,
                    "maxItems": 5
                  },
                  "partitionCaps": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9._:-]{1,128}$",
                      "not": {
                        "anyOf": [
                          {
                            "const": "pool"
                          },
                          {
                            "pattern": "^member:"
                          }
                        ]
                      }
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "minProperties": 1,
                    "maxProperties": 100
                  }
                },
                "minProperties": 1,
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/quotas/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/releases": {
      "get": {
        "operationId": "workspaces.releases.list",
        "summary": "List the workspace's file releases",
        "description": "Needs `workspace:selling:view`. Filterable by `seriesId` and `status`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "seriesId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "published"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/releases/index.ts"
      },
      "post": {
        "operationId": "workspaces.releases.create",
        "summary": "Create a draft file release for the workspace",
        "description": "Needs `workspace:selling:manage`. An invalid version answers 422 `RELEASE_REFUSED`; a version the series already has answers 409 `RELEASE_VERSION_TAKEN`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "seriesId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "version": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "fileIds": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  }
                },
                "required": [
                  "seriesId",
                  "version"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/releases/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/releases/{id}": {
      "get": {
        "operationId": "workspaces.releases.get",
        "summary": "Get one of the workspace's file releases",
        "description": "Needs `workspace:selling:view`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/releases/index.ts"
      },
      "delete": {
        "operationId": "workspaces.releases.delete",
        "summary": "Delete a draft file release",
        "description": "Needs `workspace:selling:manage`. A published release answers 422 `RELEASE_REFUSED`, since buyers may hold it.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/releases/index.ts"
      },
      "patch": {
        "operationId": "workspaces.releases.update",
        "summary": "Update a file release",
        "description": "Needs `workspace:selling:manage`. A draft takes a new `version`, `notes` and `fileIds`; a published release takes `notes` only (422 `RELEASE_REFUSED` otherwise).",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "fileIds": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{24}$"
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/releases/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/releases/{id}/publish": {
      "post": {
        "operationId": "workspaces.releases.publish.create",
        "summary": "Publish a draft file release",
        "description": "Needs `workspace:selling:manage`. Every file must have passed the scan; otherwise, or when already published, it answers 422 `RELEASE_REFUSED`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/releases/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales": {
      "get": {
        "operationId": "workspaces.sales.list",
        "summary": "List the workspace's sales as a seller",
        "description": "Needs `workspace:selling:view`. Returns a page of the workspace's own orders, plus split sales it is paid a share of (showing only its share), filterable by `paymentStatus`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "paymentStatus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "unpaid",
                "partially_paid",
                "paid",
                "partially_refunded",
                "refunded"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/bookings": {
      "get": {
        "operationId": "workspaces.sales.bookings.list",
        "summary": "List the bookings made on the workspace's items",
        "description": "Needs `workspace:selling:view`. Filters by `status`, `itemId`, `calendarId` and a `from` / `to` range; a `from` or `to` that is not a date and time is refused with 400.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "calendarId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40
            }
          },
          {
            "name": "itemId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "start",
                "-start"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "held",
                "confirmed",
                "cancelled",
                "expired"
              ]
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/bookings/{id}": {
      "get": {
        "operationId": "workspaces.sales.bookings.get",
        "summary": "Get a booking made on one of the workspace's items",
        "description": "Needs `workspace:selling:view`. Another seller's booking answers 404.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/bookings/{id}/attendance": {
      "put": {
        "operationId": "workspaces.sales.bookings.attendance.update",
        "summary": "Mark whether the buyer attended a booking, or clear it",
        "description": "Needs `workspace:selling:manage`. Sets `attendance` (or null to clear) on a confirmed booking once it has started; nothing is refunded or charged. Refused with 422 `BOOKING_CHANGE_REFUSED`, or 409 `ORDER_STATE_CONFLICT` if the booking changed meanwhile.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "attendance": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "attended",
                      "no_show",
                      null
                    ]
                  }
                },
                "required": [
                  "attendance"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts",
        "x-events": [
          "booking.updated"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/bookings/{id}/cancel": {
      "post": {
        "operationId": "workspaces.sales.bookings.cancel.create",
        "summary": "Cancel a booking made on one of the workspace's items",
        "description": "Needs `workspace:selling:manage`. Frees its seats and refunds what is left of its order line (never for a time included in a bundle); if Stripe refuses the refund the booking stays cancelled and the answer carries `refundFailed`. Refused with 422 `BOOKING_CHANGE_REFUSED` or 409 `ORDER_STATE_CONFLICT`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts",
        "x-events": [
          "booking.cancelled"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/bookings/{id}/reschedule": {
      "post": {
        "operationId": "workspaces.sales.bookings.reschedule.create",
        "summary": "Move a booking to another slot of its item",
        "description": "Needs `workspace:selling:manage`. Takes the seats at `slotStart` and gives the old ones back; a seller may move it inside the notice period. Refused with 422 `BOOKING_CHANGE_REFUSED`, 409 `SLOT_UNAVAILABLE` when the time is full or at its limit, or 409 `BOOKING_CALENDAR_MOVING`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slotStart": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  }
                },
                "required": [
                  "slotStart"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts",
        "x-events": [
          "booking.rescheduled"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/export": {
      "get": {
        "operationId": "workspaces.sales.export.list",
        "summary": "Export the workspace's sales as a CSV file",
        "description": "Needs `workspace:selling:view`. Filters by `from`, `to` and `paymentStatus`, and includes split sales the workspace is paid a share of. The row count is in `X-Export-Rows`; `X-Export-Capped: true` marks a truncated export.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}",
              "maxLength": 30
            }
          },
          {
            "name": "paymentStatus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "unpaid",
                "partially_paid",
                "paid",
                "partially_refunded",
                "refunded"
              ]
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}",
              "maxLength": 30
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/subscriptions": {
      "get": {
        "operationId": "workspaces.sales.subscriptions.list",
        "summary": "List the subscriptions the workspace has sold",
        "description": "Needs `workspace:selling:view`. Filters by `status`, `itemId` and `groupId`; returns the seller's view of each subscription.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "groupId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "itemId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "incomplete",
                "trialing",
                "active",
                "past_due",
                "ended"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/subscriptions/{id}": {
      "get": {
        "operationId": "workspaces.sales.subscriptions.get",
        "summary": "Get a subscription the workspace has sold",
        "description": "Needs `workspace:selling:view`. Another seller's subscription answers 404.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/subscriptions/{id}/cancel": {
      "post": {
        "operationId": "workspaces.sales.subscriptions.cancel.create",
        "summary": "Cancel a subscription the workspace has sold",
        "description": "Needs `workspace:selling:manage`. `mode` is `at_period_end` (the default) or `now`. Refused with 409 `SUBSCRIPTION_CHANGE_REFUSED`, or 502 `SELLING_UNAVAILABLE` when Stripe will not cancel it.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "at_period_end",
                      "now"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts",
        "x-events": [
          "item_subscription.canceled"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/{id}": {
      "get": {
        "operationId": "workspaces.sales.get",
        "summary": "Get one of the workspace's sales",
        "description": "Needs `workspace:selling:view`. Returns the order with its payments; a split sale the workspace is paid a share of shows only its share.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/{id}/lines/{lineKey}/fulfil": {
      "post": {
        "operationId": "workspaces.sales.lines.fulfil.create",
        "summary": "Mark a sale's line fulfilled or in progress",
        "description": "Needs `workspace:selling:manage`. Only on the workspace's own order; `status` is `fulfilled` (the default) or `in_progress`, with an optional `note` to the buyer. Refused with 409 `FULFILMENT_REFUSED` when the order is unpaid or the line cannot move.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "lineKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,16}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "in_progress",
                      "fulfilled"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts",
        "x-events": [
          "order.fulfilled"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/{id}/parts/{index}/charge": {
      "post": {
        "operationId": "workspaces.sales.parts.charge.create",
        "summary": "Charge the balance of a sale paid by deposit",
        "description": "Needs `workspace:selling:manage`. Charges part `index` of the workspace's own order on the buyer's saved card; a seller may charge only a deposit's balance. Refused with 409 `PART_REFUSED`, 422 when no card was saved, or 502 `SELLING_UNAVAILABLE`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "index",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 35
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts",
        "x-events": [
          "order.part_paid",
          "order.part_failed",
          "order.paid"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/{id}/refund": {
      "post": {
        "operationId": "workspaces.sales.refund.create",
        "summary": "Refund one of the workspace's sales",
        "description": "Needs `workspace:selling:manage`. Only on the workspace's own order, and only in the storefront shape: otherwise 403 `REFUND_NOT_ALLOWED`. Accepts an `Idempotency-Key`; refused with 422 `REFUND_REFUSED` or 502 `REFUND_FAILED`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lines": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 50,
                    "items": {
                      "type": "object",
                      "properties": {
                        "lineKey": {
                          "type": "string",
                          "maxLength": 16
                        },
                        "amount": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 99999999
                        }
                      },
                      "required": [
                        "lineKey",
                        "amount"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "amount": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 99999999
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "paymentId": {
                    "type": "string",
                    "maxLength": 24
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts",
        "x-events": [
          "order.refunded"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/{id}/returns": {
      "get": {
        "operationId": "workspaces.sales.returns.list",
        "summary": "List the returns requested on one of the workspace's sales",
        "description": "Needs `workspace:selling:view`. Another seller's order answers 404.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/{id}/returns/{returnId}/approve": {
      "post": {
        "operationId": "workspaces.sales.returns.approve.create",
        "summary": "Approve a requested return on one of the workspace's sales",
        "description": "Needs `workspace:selling:manage`. Makes the shipment back (a bought return label or the seller's own) and emails the buyer how to send it; a refused label puts the return back to requested. Refused with 409 `RETURN_REFUSED` when the return is not requested.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "returnId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "provider": {
                    "type": "string",
                    "enum": [
                      "manual",
                      "easypost",
                      "shippo"
                    ]
                  },
                  "carrier": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 50
                  },
                  "trackingNumber": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 64
                  },
                  "labelFileId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-f0-9]{24}$"
                  },
                  "to": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      },
                      "line1": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "line2": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 200
                      },
                      "city": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      },
                      "state": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 50
                      },
                      "postalCode": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 20
                      },
                      "country": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 2
                      },
                      "phone": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 30
                      }
                    },
                    "required": [
                      "name",
                      "line1",
                      "city",
                      "postalCode",
                      "country"
                    ],
                    "additionalProperties": false
                  },
                  "parcel": {
                    "type": "object",
                    "properties": {
                      "weightOz": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 2400
                      },
                      "lengthIn": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 200
                      },
                      "widthIn": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 200
                      },
                      "heightIn": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 200
                      }
                    },
                    "required": [
                      "weightOz"
                    ],
                    "additionalProperties": false
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts",
        "x-events": [
          "return.updated"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/{id}/returns/{returnId}/refund": {
      "post": {
        "operationId": "workspaces.sales.returns.refund.create",
        "summary": "Refund a return on one of the workspace's sales",
        "description": "Needs `workspace:selling:manage`. Refunds the returned units' share of their lines, less the label when the buyer pays it, and marks the return refunded; a return already refunded is answered as it is. Who may refund follows the shape, as for a sale refund (403 `REFUND_NOT_ALLOWED`); 409 `RETURN_REFUSED` while another refund of it runs.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "returnId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts",
        "x-events": [
          "return.updated",
          "order.refunded"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/{id}/returns/{returnId}/reject": {
      "post": {
        "operationId": "workspaces.sales.returns.reject.create",
        "summary": "Reject a requested return on one of the workspace's sales",
        "description": "Needs `workspace:selling:manage`. Its lines are free to be returned again. Refused with 409 `RETURN_REFUSED` when the return is not requested.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "returnId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts",
        "x-events": [
          "return.updated"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/{id}/shipments": {
      "get": {
        "operationId": "workspaces.sales.shipments.list",
        "summary": "List the shipments of one of the workspace's sales",
        "description": "Needs `workspace:selling:view`. Another seller's order answers 404.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts"
      },
      "post": {
        "operationId": "workspaces.sales.shipments.create",
        "summary": "Create a shipment for one of the workspace's sales",
        "description": "Needs `workspace:selling:manage`. Ships the named units (or every unit left) by hand with a carrier and tracking number, or with a label bought from the app's shipping provider; the first shipment on its way marks the order shipped. Refused with 409 when the order is unpaid, collected, refused for its region, its address is held (`confirmAddress`) or another shipment is in progress, and 502 `SHIPPING_PROVIDER_UNAVAILABLE` when the label cannot be bought.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lines": {
                    "type": "array",
                    "maxItems": 100,
                    "items": {
                      "type": "object",
                      "properties": {
                        "lineKey": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000
                        }
                      },
                      "required": [
                        "lineKey",
                        "quantity"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "provider": {
                    "type": "string",
                    "enum": [
                      "manual",
                      "easypost",
                      "shippo"
                    ]
                  },
                  "carrier": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 50
                  },
                  "service": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 80
                  },
                  "trackingNumber": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 64
                  },
                  "trackingUrl": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500
                  },
                  "labelFileId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[a-f0-9]{24}$"
                  },
                  "from": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      },
                      "line1": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "line2": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 200
                      },
                      "city": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      },
                      "state": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 50
                      },
                      "postalCode": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 20
                      },
                      "country": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 2
                      },
                      "phone": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 30
                      }
                    },
                    "required": [
                      "name",
                      "line1",
                      "city",
                      "postalCode",
                      "country"
                    ],
                    "additionalProperties": false
                  },
                  "parcel": {
                    "type": "object",
                    "properties": {
                      "weightOz": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 2400
                      },
                      "lengthIn": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 200
                      },
                      "widthIn": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 200
                      },
                      "heightIn": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 200
                      }
                    },
                    "required": [
                      "weightOz"
                    ],
                    "additionalProperties": false
                  },
                  "contentsType": {
                    "type": "string",
                    "enum": [
                      "merchandise",
                      "gift",
                      "documents",
                      "sample",
                      "returned_goods",
                      "other"
                    ]
                  },
                  "confirmAddress": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts",
        "x-events": [
          "order.shipped"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/{id}/shipments/{shipmentId}/label": {
      "get": {
        "operationId": "workspaces.sales.shipments.label.list",
        "summary": "Download a shipment's label",
        "description": "Needs `workspace:selling:view`. Streams the seller's PDF label, or redirects (302) to the provider's label link; 404 `SHIPMENT_NOT_FOUND` when there is none.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "shipmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/sales/{id}/shipments/{shipmentId}/status": {
      "post": {
        "operationId": "workspaces.sales.shipments.status.create",
        "summary": "Set a shipment's status by hand",
        "description": "Needs `workspace:selling:manage`. A manual shipment may make any allowed move; a provider's shipment may only be cancelled, which asks the provider to refund its label. Refused with 422 for a move not allowed, or 409 `ORDER_STATE_CONFLICT` if it changed meanwhile.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          },
          {
            "name": "shipmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "label_created",
                      "in_transit",
                      "out_for_delivery",
                      "delivered",
                      "returned",
                      "failure",
                      "cancelled"
                    ]
                  },
                  "message": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 300
                  }
                },
                "required": [
                  "status"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/sales/index.ts",
        "x-events": [
          "shipment.updated"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/selling": {
      "get": {
        "operationId": "workspaces.selling.list",
        "summary": "Get the workspace's seller account and the app's selling settings",
        "description": "Needs `workspace:selling:view`. Returns `seller` (null before the workspace starts selling) and `selling`, what the Start selling screen shows.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/selling/index.ts"
      },
      "post": {
        "operationId": "workspaces.selling.create",
        "summary": "Start selling as the workspace",
        "description": "Needs `workspace:selling:manage`. Creates the workspace's seller and its Stripe account (201), or returns the existing one (200). Refused with 503 `SELLING_UNAVAILABLE` when selling is not open, 409 `SELLER_SUBJECT_NOT_ALLOWED` when the app does not let workspaces sell, 409 `SELLER_TERMINAL` for a closed account, and 400 for a country not allowed or a missing `contactEmail`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "displayName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "contactEmail": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  }
                },
                "required": [
                  "country",
                  "displayName"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/selling/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/selling/co-sellers": {
      "get": {
        "operationId": "workspaces.selling.coSellers.list",
        "summary": "List the workspace's co-seller invitations",
        "description": "Needs `workspace:selling:view`. `direction` is `received` (the default) or `sent`; 404 `SELLER_NOT_FOUND` before the workspace starts selling.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "direction",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "received",
                "sent"
              ]
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/selling/index.ts"
      },
      "post": {
        "operationId": "workspaces.selling.coSellers.create",
        "summary": "Invite another seller to share an item's sales",
        "description": "Needs `workspace:selling:manage`. Offers `shareBps` of the workspace's share of `itemId` to seller `sellerId`; nothing changes on the item until they accept. Refused with 403 `CO_SELLERS_OWNER_ONLY` unless the app owner lets sellers invite, 409 `CO_SELLER_REFUSED` outside the marketplace shape or when an invitation is already open, and 422 when the share or seller cannot be used.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "itemId": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  },
                  "sellerId": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  },
                  "shareBps": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9999
                  }
                },
                "required": [
                  "itemId",
                  "sellerId",
                  "shareBps"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/selling/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/selling/co-sellers/{invitationId}/accept": {
      "post": {
        "operationId": "workspaces.selling.coSellers.accept.create",
        "summary": "Accept a co-seller invitation sent to the workspace",
        "description": "Needs `workspace:selling:manage`. `consent` must be true; the item's payees gain the workspace, its share taken from the inviting seller's. Refused with 409 `CO_SELLER_REFUSED` when the invitation was answered, expired or the item's split changed.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invitationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "consent": {
                    "type": "boolean",
                    "const": true
                  }
                },
                "required": [
                  "consent"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/selling/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/selling/co-sellers/{invitationId}/decline": {
      "post": {
        "operationId": "workspaces.selling.coSellers.decline.create",
        "summary": "Decline a co-seller invitation sent to the workspace",
        "description": "Needs `workspace:selling:manage`. Nothing on the item changes; 409 `CO_SELLER_REFUSED` when the invitation was already answered.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invitationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/selling/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/selling/co-sellers/{invitationId}/withdraw": {
      "post": {
        "operationId": "workspaces.selling.coSellers.withdraw.create",
        "summary": "Withdraw a co-seller invitation the workspace sent",
        "description": "Needs `workspace:selling:manage`. 409 `CO_SELLER_REFUSED` when the invitation was already answered.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invitationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/selling/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/selling/debit-terms/accept": {
      "post": {
        "operationId": "workspaces.selling.debitTerms.accept.create",
        "summary": "Accept the app owner's account debit terms for the workspace",
        "description": "Needs `workspace:selling:manage`. `version` must be the version in force: otherwise 409 `DEBIT_TERMS_CHANGED`, or 409 `DEBIT_TERMS_NOT_SET` when there are none. The acceptance is recorded in the security audit log.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  }
                },
                "required": [
                  "version"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/selling/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/selling/session": {
      "post": {
        "operationId": "workspaces.selling.session.create",
        "summary": "Create a Stripe embedded components session for the seller",
        "description": "Needs `workspace:selling:view`; the onboarding and account management sections also need `workspace:selling:manage`, and sections the caller may not open come back in `denied`. Returns a short-lived client secret. Refused with 409 before selling starts or for a closed account, and 403 when no requested section is allowed.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sections": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 6,
                    "items": {
                      "type": "string",
                      "enum": [
                        "onboarding",
                        "management",
                        "payouts",
                        "payments",
                        "documents",
                        "tax"
                      ]
                    }
                  }
                },
                "required": [
                  "sections"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/selling/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/selling/shipping": {
      "get": {
        "operationId": "workspaces.selling.shipping.list",
        "summary": "Get the workspace's seller shipping settings",
        "description": "Needs `workspace:selling:view`. Returns how item rates combine, returns and customs settings, with defaults filled in; 404 `SELLER_NOT_FOUND` before the workspace starts selling.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/selling/index.ts"
      },
      "put": {
        "operationId": "workspaces.selling.shipping.update",
        "summary": "Save the workspace's seller shipping settings",
        "description": "Needs `workspace:selling:manage`. Each part sent is merged onto what is stored; refused with 422 `SHIPPING_RATE_REFUSED` for invalid settings.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "combine": {
                    "type": "string",
                    "enum": [
                      "sum",
                      "highest_plus_additional",
                      "flat_per_order"
                    ]
                  },
                  "addressMismatch": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "flag_hold",
                      "requote",
                      "ignore",
                      null
                    ]
                  },
                  "returns": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "windowDays": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 365
                      },
                      "labelPaidBy": {
                        "type": "string",
                        "enum": [
                          "seller",
                          "buyer"
                        ]
                      },
                      "autoRefundOn": {
                        "type": "string",
                        "enum": [
                          "none",
                          "delivered"
                        ]
                      }
                    },
                    "additionalProperties": false
                  },
                  "customs": {
                    "type": "object",
                    "properties": {
                      "contentsType": {
                        "type": "string",
                        "enum": [
                          "merchandise",
                          "gift",
                          "documents",
                          "sample",
                          "returned_goods",
                          "other"
                        ]
                      },
                      "incoterm": {
                        "type": "string",
                        "enum": [
                          "DAP",
                          "DDP"
                        ]
                      },
                      "nonDelivery": {
                        "type": "string",
                        "enum": [
                          "return",
                          "abandon"
                        ]
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/selling/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/selling/sync": {
      "post": {
        "operationId": "workspaces.selling.sync.create",
        "summary": "Refresh the workspace's seller account from Stripe",
        "description": "Needs `workspace:selling:manage`. Reads the Stripe account now (after onboarding) instead of waiting for Stripe's event; 404 `SELLER_NOT_FOUND` before selling starts.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/selling/index.ts",
        "x-events": [
          "seller.status_changed"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/selling/tax": {
      "get": {
        "operationId": "workspaces.selling.tax.list",
        "summary": "Get the workspace's own tax choice as a seller",
        "description": "Needs `workspace:selling:view`. Returns `appTaxMode` (the app owner's mode), `canChoose` (true only when the app's mode is `seller_choice` and both the app and this seller use the storefront shape), `taxMode` (the seller's choice, `off` until they choose), `effective` (what its sales run under now) and `stripeTax` (`active`, `pending` or `unknown` on its Stripe account, or null when it does not matter); 404 `SELLER_NOT_FOUND` before the workspace starts selling.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/selling/index.ts"
      },
      "put": {
        "operationId": "workspaces.selling.tax.update",
        "summary": "Choose whether Stripe Tax works out the tax on the workspace's sales",
        "description": "Needs `workspace:selling:manage`. Takes `taxMode`: `off` or `stripe_tax`, and returns the settings as the read does. Refused with 409 `SELLER_TAX_REFUSED` (problem `not_seller_choice`) unless the app leaves tax to sellers, and with 422 `SELLER_TAX_REFUSED` (problem `stripe_tax_inactive`) when `stripe_tax` is chosen before Stripe Tax is active on the workspace's Stripe account. `off` is always taken while the seller may choose; 404 `SELLER_NOT_FOUND` before the workspace starts selling.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "taxMode": {
                    "type": "string",
                    "enum": [
                      "off",
                      "stripe_tax"
                    ]
                  }
                },
                "required": [
                  "taxMode"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/selling/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/shipping-rates": {
      "get": {
        "operationId": "workspaces.shippingRates.list",
        "summary": "List the workspace's shipping rates",
        "description": "Needs `workspace:selling:view`. 404 `SELLER_NOT_FOUND` before the workspace starts selling.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/shipping-rates/index.ts"
      },
      "post": {
        "operationId": "workspaces.shippingRates.create",
        "summary": "Create a shipping rate for the workspace",
        "description": "Needs `workspace:selling:manage`. Refused with 422 `SHIPPING_RATE_REFUSED` for an invalid rate or when the seller already has the most rates allowed.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 50
                  },
                  "amount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  "currency": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 3
                  },
                  "countries": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 60,
                    "items": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 2
                    }
                  },
                  "minDays": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 365
                  },
                  "maxDays": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 365
                  },
                  "freeOver": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  "pickup": {
                    "type": "boolean"
                  },
                  "basis": {
                    "type": "string",
                    "enum": [
                      "flat",
                      "weight",
                      "subtotal",
                      "items",
                      "carrier"
                    ]
                  },
                  "brackets": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "properties": {
                        "upTo": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "amount": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 10000000
                        }
                      },
                      "required": [
                        "upTo",
                        "amount"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "perItem": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  "carrier": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "carriers": {
                        "type": "array",
                        "maxItems": 10,
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 50
                        }
                      },
                      "services": {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        }
                      },
                      "markupBps": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000
                      },
                      "markupFixed": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000000
                      },
                      "fallbackAmount": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "maximum": 10000000
                      },
                      "origin": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "line1": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "line2": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 200
                          },
                          "city": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "state": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 50
                          },
                          "postalCode": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 20
                          },
                          "country": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 2
                          },
                          "phone": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 30
                          }
                        },
                        "required": [
                          "name",
                          "line1",
                          "city",
                          "postalCode",
                          "country"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "carriers",
                      "services",
                      "markupBps",
                      "markupFixed",
                      "origin"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "name",
                  "amount",
                  "currency",
                  "countries"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/shipping-rates/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/shipping-rates/{id}": {
      "get": {
        "operationId": "workspaces.shippingRates.get",
        "summary": "Get one of the workspace's shipping rates",
        "description": "Needs `workspace:selling:view`. Another seller's rate answers 404.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/shipping-rates/index.ts"
      },
      "put": {
        "operationId": "workspaces.shippingRates.update",
        "summary": "Replace one of the workspace's shipping rates",
        "description": "Needs `workspace:selling:manage`. Saves the rate whole; orders keep the copy they were sold with. 422 `SHIPPING_RATE_REFUSED` for an invalid rate.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 50
                  },
                  "amount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  "currency": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 3
                  },
                  "countries": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 60,
                    "items": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 2
                    }
                  },
                  "minDays": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 365
                  },
                  "maxDays": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 365
                  },
                  "freeOver": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  "pickup": {
                    "type": "boolean"
                  },
                  "basis": {
                    "type": "string",
                    "enum": [
                      "flat",
                      "weight",
                      "subtotal",
                      "items",
                      "carrier"
                    ]
                  },
                  "brackets": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "properties": {
                        "upTo": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "amount": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 10000000
                        }
                      },
                      "required": [
                        "upTo",
                        "amount"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "perItem": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  "carrier": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "carriers": {
                        "type": "array",
                        "maxItems": 10,
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 50
                        }
                      },
                      "services": {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        }
                      },
                      "markupBps": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000
                      },
                      "markupFixed": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000000
                      },
                      "fallbackAmount": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "maximum": 10000000
                      },
                      "origin": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "line1": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "line2": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 200
                          },
                          "city": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "state": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 50
                          },
                          "postalCode": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 20
                          },
                          "country": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 2
                          },
                          "phone": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 30
                          }
                        },
                        "required": [
                          "name",
                          "line1",
                          "city",
                          "postalCode",
                          "country"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "carriers",
                      "services",
                      "markupBps",
                      "markupFixed",
                      "origin"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "name",
                  "amount",
                  "currency",
                  "countries"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/shipping-rates/index.ts"
      },
      "delete": {
        "operationId": "workspaces.shippingRates.delete",
        "summary": "Delete one of the workspace's shipping rates",
        "description": "Needs `workspace:selling:manage`. Another seller's rate answers 404.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{24}$"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/shipping-rates/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription": {
      "get": {
        "operationId": "workspaces.subscription.list",
        "summary": "Get the workspace's current subscription, plan and capabilities",
        "description": "Needs `workspace:billing:view`. Returns the subscription, its plan version, plan group, credits and what the customer may do to it (pause, cancel now, interval switch). A workspace that never held a plan is started on the org's onboarding plan on this first read.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "capabilities": {
                      "properties": {
                        "cancelNow": {
                          "properties": {
                            "enabled": {
                              "type": "boolean"
                            },
                            "refund": {
                              "type": "string"
                            },
                            "refundWhenAllowanceUsed": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "intervalSwitch": {
                          "properties": {
                            "enabled": {
                              "type": "boolean"
                            }
                          },
                          "type": "object"
                        },
                        "pause": {
                          "properties": {
                            "enabled": {
                              "type": "boolean"
                            },
                            "maxMonths": {
                              "type": "integer"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "credits": {
                      "properties": {
                        "available": {
                          "type": "integer"
                        },
                        "totalConsumed": {
                          "type": "integer"
                        },
                        "totalExpired": {
                          "type": "integer"
                        },
                        "totalGranted": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "entitlement": {
                      "properties": {
                        "decidedBy": {
                          "properties": {},
                          "additionalProperties": {
                            "type": "string"
                          },
                          "type": "object"
                        },
                        "features": {
                          "properties": {},
                          "additionalProperties": {
                            "type": "boolean"
                          },
                          "type": "object"
                        },
                        "grants": {
                          "type": "array"
                        },
                        "limits": {
                          "properties": {},
                          "type": "object"
                        },
                        "planSlug": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "planVersionId": {
                          "type": "string"
                        },
                        "quotas": {
                          "properties": {},
                          "additionalProperties": {
                            "properties": {
                              "allowOverage": {
                                "type": "boolean"
                              },
                              "monthly": {
                                "properties": {
                                  "included": {
                                    "type": "integer"
                                  }
                                },
                                "type": "object"
                              }
                            },
                            "type": "object"
                          },
                          "type": "object"
                        },
                        "standing": {
                          "type": "string"
                        },
                        "subject": {
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "type": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "featurePlanVersion": {},
                    "group": {
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "archived": {
                          "type": "boolean"
                        },
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "deleted": {
                          "type": "boolean"
                        },
                        "id": {
                          "type": "string"
                        },
                        "isDefault": {
                          "type": "boolean"
                        },
                        "latestVersion": {
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "archived": {
                              "type": "boolean"
                            },
                            "createdAt": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "deleted": {
                              "type": "boolean"
                            },
                            "isCurrent": {
                              "type": "boolean"
                            },
                            "isLegacy": {
                              "type": "boolean"
                            },
                            "planVersionIds": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "publishedAt": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "requiredItems": {
                              "type": "array"
                            },
                            "status": {
                              "type": "string"
                            },
                            "termsHash": {
                              "type": "string"
                            },
                            "termsHashVersion": {
                              "type": "integer"
                            },
                            "updatedAt": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "version": {
                              "type": "integer"
                            }
                          },
                          "type": "object"
                        },
                        "name": {
                          "type": "string"
                        },
                        "payerType": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        }
                      },
                      "type": [
                        "null",
                        "object"
                      ]
                    },
                    "groupVersion": {
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "archived": {
                          "type": "boolean"
                        },
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "deleted": {
                          "type": "boolean"
                        },
                        "group": {
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "id": {
                          "type": "string"
                        },
                        "isCurrent": {
                          "type": "boolean"
                        },
                        "isLegacy": {
                          "type": "boolean"
                        },
                        "planVersionIds": {
                          "items": {
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "features": {
                                "properties": {},
                                "type": "object"
                              },
                              "limits": {
                                "properties": {},
                                "type": "object"
                              },
                              "name": {
                                "type": "string"
                              },
                              "plan": {
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "isFreemium": {
                                    "type": "boolean"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "slug": {
                                    "type": "string"
                                  }
                                },
                                "type": "object"
                              },
                              "quotas": {
                                "properties": {},
                                "additionalProperties": {
                                  "properties": {
                                    "allowOverage": {
                                      "type": "boolean"
                                    },
                                    "monthly": {
                                      "properties": {
                                        "included": {
                                          "type": "integer"
                                        }
                                      },
                                      "type": "object"
                                    }
                                  },
                                  "type": "object"
                                },
                                "type": "object"
                              },
                              "version": {
                                "type": "integer"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "publishedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "requiredItems": {
                          "type": "array"
                        },
                        "status": {
                          "type": "string"
                        },
                        "termsHash": {
                          "type": "string"
                        },
                        "termsHashVersion": {
                          "type": "integer"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "version": {
                          "type": "integer"
                        }
                      },
                      "type": [
                        "null",
                        "object"
                      ]
                    },
                    "migration": {},
                    "plan": {
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "archived": {
                          "type": "boolean"
                        },
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "deleted": {
                          "type": "boolean"
                        },
                        "id": {
                          "type": "string"
                        },
                        "isFreemium": {
                          "type": "boolean"
                        },
                        "latestVersion": {
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "archived": {
                              "type": "boolean"
                            },
                            "createdAt": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "deleted": {
                              "type": "boolean"
                            },
                            "features": {
                              "properties": {},
                              "type": "object"
                            },
                            "isCurrent": {
                              "type": "boolean"
                            },
                            "isLegacy": {
                              "type": "boolean"
                            },
                            "limits": {
                              "properties": {},
                              "type": "object"
                            },
                            "name": {
                              "type": "string"
                            },
                            "pricingVariants": {
                              "items": {
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "basePricing": {
                                    "properties": {
                                      "monthly": {
                                        "type": "integer"
                                      }
                                    },
                                    "type": "object"
                                  },
                                  "currency": {
                                    "type": "string"
                                  },
                                  "quotaOverageMeters": {
                                    "properties": {},
                                    "type": "object"
                                  },
                                  "quotaOveragePriceIds": {
                                    "properties": {},
                                    "type": "object"
                                  },
                                  "quotaOverages": {
                                    "properties": {},
                                    "type": "object"
                                  },
                                  "seatPricing": {
                                    "properties": {
                                      "enabled": {
                                        "type": "boolean"
                                      },
                                      "includedSeats": {
                                        "type": "integer"
                                      },
                                      "perSeat": {
                                        "properties": {},
                                        "type": "object"
                                      }
                                    },
                                    "type": "object"
                                  },
                                  "seatStripePrices": {
                                    "properties": {},
                                    "type": "object"
                                  },
                                  "stripePrices": {
                                    "properties": {},
                                    "type": "object"
                                  }
                                },
                                "type": "object"
                              },
                              "type": "array"
                            },
                            "publishedAt": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "quotas": {
                              "properties": {},
                              "additionalProperties": {
                                "properties": {
                                  "allowOverage": {
                                    "type": "boolean"
                                  },
                                  "monthly": {
                                    "properties": {
                                      "included": {
                                        "type": "integer"
                                      }
                                    },
                                    "type": "object"
                                  }
                                },
                                "type": "object"
                              },
                              "type": "object"
                            },
                            "status": {
                              "type": "string"
                            },
                            "subscriptionItems": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "termsHash": {
                              "type": "string"
                            },
                            "termsHashVersion": {
                              "type": "integer"
                            },
                            "updatedAt": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "version": {
                              "type": "integer"
                            }
                          },
                          "type": "object"
                        },
                        "name": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "versionMoves": {
                          "properties": {
                            "mode": {
                              "type": "string"
                            },
                            "noticeDays": {
                              "type": "integer"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": [
                        "null",
                        "object"
                      ]
                    },
                    "planRequired": {
                      "type": "boolean"
                    },
                    "planVersion": {
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "archived": {
                          "type": "boolean"
                        },
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "deleted": {
                          "type": "boolean"
                        },
                        "features": {
                          "properties": {},
                          "type": "object"
                        },
                        "id": {
                          "type": "string"
                        },
                        "isCurrent": {
                          "type": "boolean"
                        },
                        "isLegacy": {
                          "type": "boolean"
                        },
                        "limits": {
                          "properties": {},
                          "type": "object"
                        },
                        "name": {
                          "type": "string"
                        },
                        "plan": {
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "archived": {
                              "type": "boolean"
                            },
                            "isFreemium": {
                              "type": "boolean"
                            },
                            "name": {
                              "type": "string"
                            },
                            "slug": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "pricingVariants": {
                          "items": {
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "basePricing": {
                                "properties": {
                                  "monthly": {
                                    "type": "integer"
                                  }
                                },
                                "type": "object"
                              },
                              "currency": {
                                "type": "string"
                              },
                              "quotaOverageMeters": {
                                "properties": {},
                                "type": "object"
                              },
                              "quotaOveragePriceIds": {
                                "properties": {},
                                "type": "object"
                              },
                              "quotaOverages": {
                                "properties": {},
                                "type": "object"
                              },
                              "seatPricing": {
                                "properties": {
                                  "enabled": {
                                    "type": "boolean"
                                  },
                                  "includedSeats": {
                                    "type": "integer"
                                  },
                                  "perSeat": {
                                    "properties": {},
                                    "type": "object"
                                  }
                                },
                                "type": "object"
                              },
                              "seatStripePrices": {
                                "properties": {},
                                "type": "object"
                              },
                              "stripePrices": {
                                "properties": {},
                                "type": "object"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "publishedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "quotas": {
                          "properties": {},
                          "additionalProperties": {
                            "properties": {
                              "allowOverage": {
                                "type": "boolean"
                              },
                              "monthly": {
                                "properties": {
                                  "included": {
                                    "type": "integer"
                                  }
                                },
                                "type": "object"
                              }
                            },
                            "type": "object"
                          },
                          "type": "object"
                        },
                        "status": {
                          "type": "string"
                        },
                        "subscriptionItems": {
                          "items": {
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "category": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "slug": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "termsHash": {
                          "type": "string"
                        },
                        "termsHashVersion": {
                          "type": "integer"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "version": {
                          "type": "integer"
                        }
                      },
                      "type": [
                        "null",
                        "object"
                      ]
                    },
                    "scheduledAddOnChanges": {
                      "type": "array"
                    },
                    "scheduledVersionChange": {},
                    "subscription": {
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "cancelAtPeriodEnd": {
                          "type": "boolean"
                        },
                        "canceledAt": {},
                        "cancellation": {},
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "currency": {},
                        "currentSeatCount": {},
                        "discounts": {
                          "type": "array"
                        },
                        "dunningState": {
                          "type": "string"
                        },
                        "featurePlanVersionUntil": {},
                        "lastPaidInvoiceAt": {},
                        "pause": {},
                        "plan": {
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "currency": {},
                            "description": {},
                            "isFreemium": {
                              "type": "boolean"
                            },
                            "name": {
                              "type": "string"
                            },
                            "slug": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "retentionUsed": {
                          "type": "boolean"
                        },
                        "seatPricingEnabled": {
                          "type": "boolean"
                        },
                        "stripeCurrentPeriodEnd": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "subscriptionId": {},
                        "subscriptionStatus": {
                          "type": "string"
                        },
                        "trialEnd": {},
                        "trialStart": {},
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "usageCurrentPeriodEnd": {
                          "format": "date-time",
                          "type": "string"
                        }
                      },
                      "type": [
                        "null",
                        "object"
                      ]
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "capabilities": {
                    "cancelNow": {
                      "enabled": false,
                      "refund": "none",
                      "refundWhenAllowanceUsed": "prorate_by_time"
                    },
                    "intervalSwitch": {
                      "enabled": true
                    },
                    "pause": {
                      "enabled": false,
                      "maxMonths": 3
                    }
                  },
                  "credits": {
                    "available": 0,
                    "totalConsumed": 0,
                    "totalExpired": 0,
                    "totalGranted": 0
                  },
                  "entitlement": {
                    "decidedBy": {
                      "onb-calls-1794380639113": "plan",
                      "sso-1794380633736": "default"
                    },
                    "features": {
                      "sso-1794380633736": false
                    },
                    "grants": [],
                    "limits": {},
                    "planSlug": "onboarding-free-1767225600000",
                    "planVersionId": "000000000000000000000001",
                    "quotas": {
                      "onb-calls-1794380639113": {
                        "allowOverage": false,
                        "monthly": {
                          "included": 100
                        }
                      }
                    },
                    "standing": "entitled",
                    "subject": {
                      "id": "000000000000000000000002",
                      "type": "workspace"
                    }
                  },
                  "featurePlanVersion": null,
                  "group": {
                    "_id": "000000000000000000000003",
                    "archived": false,
                    "createdAt": "2026-01-01T00:00:00.000Z",
                    "deleted": false,
                    "id": "000000000000000000000003",
                    "isDefault": false,
                    "latestVersion": {
                      "_id": "000000000000000000000004",
                      "archived": false,
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "deleted": false,
                      "isCurrent": true,
                      "isLegacy": false,
                      "planVersionIds": [
                        "000000000000000000000001"
                      ],
                      "publishedAt": "2026-01-01T00:00:00.000Z",
                      "requiredItems": [],
                      "status": "published",
                      "termsHash": "2b405ef8c061c9a1bc71684181c8b72ab7e28a2d4f3beb31e921c62c80c528be",
                      "termsHashVersion": 1,
                      "updatedAt": "2026-01-01T00:00:00.000Z",
                      "version": 1
                    },
                    "name": "Onboarding 1767225600000",
                    "payerType": "workspace",
                    "slug": "onboarding-1767225600000",
                    "updatedAt": "2026-01-01T00:00:00.000Z"
                  },
                  "groupVersion": {
                    "_id": "000000000000000000000004",
                    "archived": false,
                    "createdAt": "2026-01-01T00:00:00.000Z",
                    "deleted": false,
                    "group": {
                      "_id": "000000000000000000000003",
                      "name": "Onboarding 1767225600000"
                    },
                    "id": "000000000000000000000004",
                    "isCurrent": true,
                    "isLegacy": false,
                    "planVersionIds": [
                      {
                        "_id": "000000000000000000000001",
                        "features": {},
                        "limits": {},
                        "name": "Version 1",
                        "plan": {
                          "_id": "000000000000000000000005",
                          "isFreemium": true,
                          "name": "Onboarding Free 1767225600000",
                          "slug": "onboarding-free-1767225600000"
                        },
                        "quotas": {
                          "onb-calls-1794380639113": {
                            "allowOverage": false,
                            "monthly": {
                              "included": 100
                            }
                          }
                        },
                        "version": 1
                      }
                    ],
                    "publishedAt": "2026-01-01T00:00:00.000Z",
                    "requiredItems": [],
                    "status": "published",
                    "termsHash": "2b405ef8c061c9a1bc71684181c8b72ab7e28a2d4f3beb31e921c62c80c528be",
                    "termsHashVersion": 1,
                    "updatedAt": "2026-01-01T00:00:00.000Z",
                    "version": 1
                  },
                  "migration": null,
                  "plan": {
                    "_id": "000000000000000000000005",
                    "archived": false,
                    "createdAt": "2026-01-01T00:00:00.000Z",
                    "deleted": false,
                    "id": "000000000000000000000005",
                    "isFreemium": true,
                    "latestVersion": {
                      "_id": "000000000000000000000001",
                      "archived": false,
                      "createdAt": "2026-01-01T00:00:00.000Z",
                      "deleted": false,
                      "features": {},
                      "isCurrent": true,
                      "isLegacy": false,
                      "limits": {},
                      "name": "Version 1",
                      "pricingVariants": [
                        {
                          "_id": "000000000000000000000006",
                          "basePricing": {
                            "monthly": 0
                          },
                          "currency": "usd",
                          "quotaOverageMeters": {},
                          "quotaOveragePriceIds": {},
                          "quotaOverages": {},
                          "seatPricing": {
                            "enabled": false,
                            "includedSeats": 0,
                            "perSeat": {}
                          },
                          "seatStripePrices": {},
                          "stripePrices": {}
                        }
                      ],
                      "publishedAt": "2026-01-01T00:00:00.000Z",
                      "quotas": {
                        "onb-calls-1794380639113": {
                          "allowOverage": false,
                          "monthly": {
                            "included": 100
                          }
                        }
                      },
                      "status": "published",
                      "subscriptionItems": [
                        "000000000000000000000007"
                      ],
                      "termsHash": "f26fec2b01c5a8f44302f84dd3b5355cda9f6a2bb165534be753751541de6810",
                      "termsHashVersion": 1,
                      "updatedAt": "2026-01-01T00:00:00.000Z",
                      "version": 1
                    },
                    "name": "Onboarding Free 1767225600000",
                    "slug": "onboarding-free-1767225600000",
                    "updatedAt": "2026-01-01T00:00:00.000Z",
                    "versionMoves": {
                      "mode": "off",
                      "noticeDays": 30
                    }
                  },
                  "planVersion": {
                    "_id": "000000000000000000000001",
                    "archived": false,
                    "createdAt": "2026-01-01T00:00:00.000Z",
                    "deleted": false,
                    "features": {},
                    "id": "000000000000000000000001",
                    "isCurrent": true,
                    "isLegacy": false,
                    "limits": {},
                    "name": "Version 1",
                    "plan": {
                      "_id": "000000000000000000000005",
                      "archived": false,
                      "isFreemium": true,
                      "name": "Onboarding Free 1767225600000",
                      "slug": "onboarding-free-1767225600000"
                    },
                    "pricingVariants": [
                      {
                        "_id": "000000000000000000000006",
                        "basePricing": {
                          "monthly": 0
                        },
                        "currency": "usd",
                        "quotaOverageMeters": {},
                        "quotaOveragePriceIds": {},
                        "quotaOverages": {},
                        "seatPricing": {
                          "enabled": false,
                          "includedSeats": 0,
                          "perSeat": {}
                        },
                        "seatStripePrices": {},
                        "stripePrices": {}
                      }
                    ],
                    "publishedAt": "2026-01-01T00:00:00.000Z",
                    "quotas": {
                      "onb-calls-1794380639113": {
                        "allowOverage": false,
                        "monthly": {
                          "included": 100
                        }
                      }
                    },
                    "status": "published",
                    "subscriptionItems": [
                      {
                        "_id": "000000000000000000000007",
                        "category": "000000000000000000000008",
                        "name": "Onboarding calls 1767225600000",
                        "slug": "onb-calls-1767225600000",
                        "type": "quota"
                      }
                    ],
                    "termsHash": "f26fec2b01c5a8f44302f84dd3b5355cda9f6a2bb165534be753751541de6810",
                    "termsHashVersion": 1,
                    "updatedAt": "2026-01-01T00:00:00.000Z",
                    "version": 1
                  },
                  "scheduledAddOnChanges": [],
                  "scheduledVersionChange": null,
                  "subscription": {
                    "_id": "000000000000000000000009",
                    "cancelAtPeriodEnd": false,
                    "canceledAt": null,
                    "cancellation": null,
                    "createdAt": "2026-01-01T00:00:00.000Z",
                    "currency": null,
                    "currentSeatCount": null,
                    "discounts": [],
                    "dunningState": "none",
                    "featurePlanVersionUntil": null,
                    "lastPaidInvoiceAt": null,
                    "pause": null,
                    "plan": {
                      "_id": "000000000000000000000005",
                      "currency": null,
                      "description": null,
                      "isFreemium": true,
                      "name": "Onboarding Free 1767225600000",
                      "slug": "onboarding-free-1767225600000"
                    },
                    "retentionUsed": false,
                    "seatPricingEnabled": false,
                    "stripeCurrentPeriodEnd": "2026-01-01T00:00:00.000Z",
                    "subscriptionId": null,
                    "subscriptionStatus": "active",
                    "trialEnd": null,
                    "trialStart": null,
                    "updatedAt": "2026-01-01T00:00:00.000Z",
                    "usageCurrentPeriodEnd": "2026-01-01T00:00:00.000Z"
                  }
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      },
      "patch": {
        "operationId": "workspaces.subscription.update",
        "summary": "Change the workspace's plan",
        "description": "Needs `workspace:billing:manage`. With a Stripe subscription the plan is changed in place (an upgrade invoiced now, a downgrade at the period end); without one it opens a checkout and answers `checkoutUrl`. Only plan versions in the current group are allowed; another interval answers 403 `INTERVAL_SWITCH_OFF` when the org turned the switch off, and a change already waiting on its payment answers 409.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "planVersionId": {
                    "type": "string",
                    "format": "ObjectID"
                  },
                  "billingInterval": {
                    "type": "string",
                    "enum": [
                      "monthly",
                      "yearly",
                      "quarterly"
                    ]
                  },
                  "currency": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 3
                  },
                  "successUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "cancelUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "promotionCode": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "prorationDate": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "uiMode": {
                    "type": "string",
                    "enum": [
                      "hosted",
                      "embedded"
                    ]
                  },
                  "returnUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "locale": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 35,
                    "pattern": "^[A-Za-z]{2,3}([-_][A-Za-z0-9]{1,8})*$"
                  }
                },
                "required": [
                  "planVersionId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/billing-contacts": {
      "get": {
        "operationId": "workspaces.subscription.billingContacts.list",
        "summary": "List the workspace's billing contacts",
        "description": "Needs `workspace:billing:view`. Returns the members besides the owner who receive the workspace's payment mail, leaving out any who lost access to billing, and the `max` allowed.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      },
      "put": {
        "operationId": "workspaces.subscription.billingContacts.update",
        "summary": "Replace the workspace's billing contacts",
        "description": "Needs `workspace:billing:manage`. Each user must be a member who can view the workspace's billing; one who cannot refuses the whole list with a 400 and its `code`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "userIds": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-fA-F0-9]{24}$"
                    }
                  }
                },
                "required": [
                  "userIds"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/billing-portal": {
      "post": {
        "operationId": "workspaces.subscription.billingPortal.create",
        "summary": "Create a Stripe Customer Portal session for the workspace",
        "description": "Needs `workspace:billing:manage`. Returns the portal `url` to redirect to. An optional `returnUrl` and portal `flow` are checked; an unknown `flow` is refused.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "returnUrl": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "flow": {
                    "type": "string",
                    "maxLength": 64
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/cancel-at-period-end": {
      "post": {
        "operationId": "workspaces.subscription.cancelAtPeriodEnd.create",
        "summary": "Cancel the workspace's subscription at the end of the billing period",
        "description": "Needs `workspace:billing:manage`. The workspace keeps access until the period ends; optional cancellation feedback is stored. Refused with 400 when the subscription state does not allow it, and 409 while another change is in progress.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "feedback": {
                    "type": "string",
                    "enum": [
                      "customer_service",
                      "low_quality",
                      "missing_features",
                      "other",
                      "switched_service",
                      "too_complex",
                      "too_expensive",
                      "unused"
                    ]
                  },
                  "comment": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "retention": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "offerId",
                      "outcome"
                    ],
                    "properties": {
                      "offerId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      },
                      "outcome": {
                        "type": "string",
                        "enum": [
                          "declined"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts",
        "x-events": [
          "subscription.cancel_scheduled"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/cancel-now": {
      "post": {
        "operationId": "workspaces.subscription.cancelNow.create",
        "summary": "Cancel the workspace's subscription immediately",
        "description": "Needs `workspace:billing:manage`. Only when the org lets customers cancel immediately, otherwise 403 `CANCEL_NOW_OFF`; applies the org's refund setting and answers the `refund` given.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "feedback": {
                    "type": "string",
                    "enum": [
                      "customer_service",
                      "low_quality",
                      "missing_features",
                      "other",
                      "switched_service",
                      "too_complex",
                      "too_expensive",
                      "unused"
                    ]
                  },
                  "comment": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "retention": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "offerId",
                      "outcome"
                    ],
                    "properties": {
                      "offerId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      },
                      "outcome": {
                        "type": "string",
                        "enum": [
                          "declined"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/checkout": {
      "post": {
        "operationId": "workspaces.subscription.checkout.create",
        "summary": "Create a Stripe checkout session for the workspace",
        "description": "Needs `workspace:billing:manage`. Returns `checkoutUrl` (or a client secret for an embedded checkout). An optional `payer` names who pays; 409 `STRIPE_NOT_CONNECTED` when the org has not connected Stripe.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "planVersionId": {
                    "type": "string",
                    "format": "ObjectID"
                  },
                  "billingInterval": {
                    "type": "string",
                    "enum": [
                      "monthly",
                      "yearly",
                      "quarterly"
                    ]
                  },
                  "currency": {
                    "type": "string",
                    "minLength": 2
                  },
                  "successUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "cancelUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "uiMode": {
                    "type": "string",
                    "enum": [
                      "hosted",
                      "embedded"
                    ]
                  },
                  "returnUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "payer": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "workspace",
                          "user"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "format": "ObjectID"
                      }
                    },
                    "required": [
                      "type",
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  "locale": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 35,
                    "pattern": "^[A-Za-z]{2,3}([-_][A-Za-z0-9]{1,8})*$"
                  },
                  "stripeOptions": {
                    "type": "object",
                    "properties": {
                      "metadata": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string"
                        }
                      },
                      "clientReferenceId": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "subscriptionMetadata": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string"
                        }
                      },
                      "promotionCode": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "planVersionId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/convert-to-paid": {
      "post": {
        "operationId": "workspaces.subscription.convertToPaid.create",
        "summary": "End the workspace's trial now and pay for the plan",
        "description": "Needs `workspace:billing:manage`. Charges the payment method on file; if payment is declined or needs authentication the trial keeps running and `paymentUrl` is the invoice to pay. A trial with no card or on a bank debit is refused.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prorationDate": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 64
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/invoices": {
      "get": {
        "operationId": "workspaces.subscription.invoices.list",
        "summary": "List the workspace's invoices",
        "description": "Needs `workspace:billing:view`. Paginated with `limit` and `starting_after`; an empty list when the org has not connected Stripe.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/invoices/{invoiceId}": {
      "get": {
        "operationId": "workspaces.subscription.invoices.get",
        "summary": "Get one of the workspace's invoices",
        "description": "Needs `workspace:billing:view`. Includes `hosted_invoice_url`, the Stripe payment page or receipt.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/invoices/{invoiceId}/pay": {
      "post": {
        "operationId": "workspaces.subscription.invoices.pay.create",
        "summary": "Pay an open invoice of the workspace's subscription",
        "description": "Needs `workspace:billing:manage`. Optionally names the card to use; a card that needs 3-D Secure answers `paymentAction` for the SDK to finish.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "paymentMethodId": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 255,
                    "pattern": "^pm_[A-Za-z0-9]+$"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "payment-method",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/move-to-user": {
      "post": {
        "operationId": "workspaces.subscription.moveToUser.create",
        "summary": "Move the workspace's plan onto the signed-in user",
        "description": "Needs `workspace:billing:manage`. Opens a checkout on the user's own customer that starts at the current period end with no proration; the workspace plan is cancelled once it completes. Refused unless the subscription is active, and with 403 `INTERVAL_SWITCH_OFF` for another interval when the org turned the switch off.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "planVersionId": {
                    "type": "string",
                    "format": "ObjectID"
                  },
                  "billingInterval": {
                    "type": "string",
                    "enum": [
                      "monthly",
                      "yearly",
                      "quarterly"
                    ]
                  },
                  "successUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "cancelUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "uiMode": {
                    "type": "string",
                    "enum": [
                      "hosted",
                      "embedded"
                    ]
                  },
                  "returnUrl": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/pause": {
      "post": {
        "operationId": "workspaces.subscription.pause.create",
        "summary": "Pause the workspace's subscription after the paid period ends",
        "description": "Needs `workspace:billing:manage`. Pauses for `months` cycles; 403 `PAUSE_NOT_ENABLED` when the org does not let customers pause, 400 `PAUSE_MONTHS_INVALID` past the org's cap.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "months"
                ],
                "properties": {
                  "months": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/plan-group": {
      "get": {
        "operationId": "workspaces.subscription.planGroup.list",
        "summary": "Get the plan group shown in the workspace's plan picker",
        "description": "Needs `workspace:billing:view`. The group of the current subscription, else the latest published group version, with each plan version's features, limits, quotas and pricing. 404 `NO_PLANS_AVAILABLE` when the org sells no plans.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/plan-group/versions": {
      "get": {
        "operationId": "workspaces.subscription.planGroup.versions.list",
        "summary": "List the workspace's plan group version and any newer versions",
        "description": "Needs `workspace:billing:view`. Without a subscription returns the latest published group version.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/preview": {
      "post": {
        "operationId": "workspaces.subscription.preview.create",
        "summary": "Preview what a plan change or ending the trial now will cost",
        "description": "Needs `workspace:billing:manage`. Changes nothing on the subscription and refuses where the change itself would. Returns a `kind` and, where relevant, a `prorationDate` to send back on the change.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "planVersionId": {
                    "type": "string",
                    "format": "ObjectID"
                  },
                  "billingInterval": {
                    "type": "string",
                    "enum": [
                      "monthly",
                      "yearly",
                      "quarterly"
                    ]
                  },
                  "currency": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 3
                  },
                  "trialEnd": {
                    "type": "string",
                    "enum": [
                      "now"
                    ]
                  },
                  "promotionCode": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "oneOf": [
                  {
                    "required": [
                      "planVersionId"
                    ]
                  },
                  {
                    "required": [
                      "trialEnd"
                    ],
                    "not": {
                      "anyOf": [
                        {
                          "required": [
                            "billingInterval"
                          ]
                        },
                        {
                          "required": [
                            "currency"
                          ]
                        },
                        {
                          "required": [
                            "promotionCode"
                          ]
                        }
                      ]
                    }
                  }
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "subscription-preview",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/resume": {
      "post": {
        "operationId": "workspaces.subscription.resume.create",
        "summary": "Resume the workspace's subscription",
        "description": "Needs `workspace:billing:manage`. Undoes a scheduled cancel at period end and ends a pause. Refused with 400 when the subscription state does not allow it.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "x-emptyBody": true,
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts",
        "x-events": [
          "subscription.resumed"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/retention-offer": {
      "get": {
        "operationId": "workspaces.subscription.retentionOffer.list",
        "summary": "Get what the cancel dialog shows before cancelling",
        "description": "Needs `workspace:billing:manage`. Whether to ask why, the retention offer this subscription may still take (null for none), and the Free plan it falls to.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/retention-offer/accept": {
      "post": {
        "operationId": "workspaces.subscription.retentionOffer.accept.create",
        "summary": "Accept the retention offer instead of cancelling",
        "description": "Needs `workspace:billing:manage`. Once per subscription: a second accept answers 409 `RETENTION_ALREADY_USED`, an offer that changed since it was shown 400 `RETENTION_OFFER_CHANGED`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "offerId"
                ],
                "properties": {
                  "offerId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "feedback": {
                    "type": "string",
                    "enum": [
                      "customer_service",
                      "low_quality",
                      "missing_features",
                      "other",
                      "switched_service",
                      "too_complex",
                      "too_expensive",
                      "unused"
                    ]
                  },
                  "comment": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/select-free-plan": {
      "post": {
        "operationId": "workspaces.subscription.selectFreePlan.create",
        "summary": "Put the workspace on a free plan without checkout",
        "description": "Needs `workspace:billing:manage`. Assigns the free `planVersionId` locally, with no payment method or Stripe call. Answers `alreadyAssigned` when the workspace is already on it.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "planVersionId": {
                    "type": "string",
                    "format": "ObjectID"
                  }
                },
                "required": [
                  "planVersionId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "message": "Free plan assigned successfully.",
                  "success": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/transfer-payer": {
      "post": {
        "operationId": "workspaces.subscription.transferPayer.create",
        "summary": "Move the workspace's subscription to another payer",
        "description": "Needs `workspace:billing:manage`. Opens a checkout on the new payer's customer for the same plan, starting at the current period end with no proration; the old subscription is cancelled on completion. Refused with a payer code such as `NO_PAID_SUBSCRIPTION`, `SAME_PAYER` or `TRANSFER_NOT_POSSIBLE`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "payer": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "workspace",
                          "user"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "format": "ObjectID"
                      }
                    },
                    "required": [
                      "type",
                      "id"
                    ],
                    "additionalProperties": false
                  },
                  "successUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "cancelUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "uiMode": {
                    "type": "string",
                    "enum": [
                      "hosted",
                      "embedded"
                    ]
                  },
                  "returnUrl": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": [
                  "payer"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/trial-eligibility": {
      "get": {
        "operationId": "workspaces.subscription.trialEligibility.list",
        "summary": "Check whether the signed-in user would get a trial in this workspace",
        "description": "Needs `workspace:billing:view`. Answers `eligible` and on which of the picker's plans, with `reason` and `usedAt` when not.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/upcoming-invoice": {
      "get": {
        "operationId": "workspaces.subscription.upcomingInvoice.list",
        "summary": "Get the workspace's next invoice",
        "description": "Needs `workspace:billing:view`. `kind` is `none` with no Stripe subscription or one cancelling at the period end, and `paused` with `resumesAt` during a pause.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "subscription-preview",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/usage": {
      "post": {
        "operationId": "workspaces.subscription.usage.create",
        "summary": "Record quota usage for the workspace",
        "description": "Needs `workspace:usage:record`. Returns the consumed, available and overage amounts; Stripe sync happens in the background. A quota refusal answers 402, as does 402 `PLAN_REQUIRED` when the app requires a plan and the workspace has none.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "quotaSlug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000000
                  },
                  "metadata": {
                    "type": "object"
                  },
                  "source": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "partitionKey": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9._:-]{1,128}$",
                    "not": {
                      "anyOf": [
                        {
                          "const": "pool"
                        },
                        {
                          "pattern": "^member:"
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "quotaSlug",
                  "quantity"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "available": {
                      "type": "integer"
                    },
                    "billedAsync": {
                      "type": "boolean"
                    },
                    "consumed": {
                      "type": "integer"
                    },
                    "coveredByGrants": {
                      "type": "integer"
                    },
                    "included": {
                      "type": "integer"
                    },
                    "overage": {
                      "type": "integer"
                    },
                    "resetsAt": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "used": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "available": 99,
                  "billedAsync": false,
                  "consumed": 1,
                  "coveredByGrants": 0,
                  "included": 100,
                  "overage": 0,
                  "resetsAt": "2026-01-01T00:00:00.000Z",
                  "used": 1
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "usage",
            "windowMs": 60000,
            "max": 60,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/usage/all": {
      "get": {
        "operationId": "workspaces.subscription.usage.all.list",
        "summary": "Get usage status for every quota of the workspace",
        "description": "Needs `workspace:usage:view`. Covers the quotas of the current plan and any a grant carries.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/usage/batch": {
      "post": {
        "operationId": "workspaces.subscription.usage.batch.create",
        "summary": "Record several quota usage entries in one request",
        "description": "Needs `workspace:usage:record`. Each item is recorded separately and gets its own result, so one failed item does not fail the batch. 402 `PLAN_REQUIRED` when the app requires a plan and the workspace has none.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "quotaSlug": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000000
                        },
                        "metadata": {
                          "type": "object"
                        },
                        "source": {
                          "type": "string",
                          "maxLength": 100
                        },
                        "idempotencyKey": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "partitionKey": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9._:-]{1,128}$",
                          "not": {
                            "anyOf": [
                              {
                                "const": "pool"
                              },
                              {
                                "pattern": "^member:"
                              }
                            ]
                          }
                        }
                      },
                      "required": [
                        "quotaSlug",
                        "quantity"
                      ],
                      "additionalProperties": false
                    },
                    "minItems": 1,
                    "maxItems": 100
                  }
                },
                "required": [
                  "items"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "usage",
            "windowMs": 60000,
            "max": 60,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/usage/logs": {
      "get": {
        "operationId": "workspaces.subscription.usage.logs.list",
        "summary": "List the workspace's usage log entries",
        "description": "Needs `workspace:usage:view`. Paginated, filtered by `quotaSlug`, `source`, `from` and `to`, and limited to the org plan's log retention window.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1
            }
          },
          {
            "name": "quotaSlug",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/subscription/usage/status": {
      "get": {
        "operationId": "workspaces.subscription.usage.status.list",
        "summary": "Get the usage status of one quota",
        "description": "Needs `workspace:usage:view`. Returns consumed, included, available and overage for `quotaSlug`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "quotaSlug",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/subscription/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/users": {
      "get": {
        "operationId": "workspaces.users.list",
        "summary": "List the members of a workspace",
        "description": "Needs `workspace:members:view`. Returns each member with their role.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/users/index.ts"
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/users/add": {
      "post": {
        "operationId": "workspaces.users.add.create",
        "summary": "Add a user to the workspace by email, or invite them",
        "description": "Needs `workspace:members:invite` (and admin when the org limits invitations to admins). When the org's workspace settings say `directAdd: \"invite\"` (the default for an org created since 13 November 2026), it adds at once (200) someone who already shares a workspace with the caller, or any account when the session was opened by the app's team; anyone else, and an address with no account, is sent the invitation `workspaces.invitations.create` sends and joins when they accept: 202 with `invited: true` and the `invitation`, the same answer whether or not the address has an account. With `directAdd: \"instant\"` (an org created before), an existing account is added at once and an address with no account answers 404. Answers 409 when already a member, 402 `SEAT_LIMIT_REACHED` when seats or the org's member limit are full, 403 when inviting is disabled or the role is above the caller's, and, for an invitation, the refusals `workspaces.invitations.create` gives.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string"
                  },
                  "role": {
                    "type": "string"
                  }
                },
                "required": [
                  "email",
                  "role"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "userId": {
                      "type": "string"
                    },
                    "workspace": {
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "createdBy": {
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            },
                            "image": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "creditBalance": {
                          "type": "integer"
                        },
                        "deleted": {
                          "type": "boolean"
                        },
                        "entitlement": {
                          "properties": {
                            "decidedBy": {
                              "properties": {},
                              "additionalProperties": {
                                "type": "string"
                              },
                              "type": "object"
                            },
                            "features": {
                              "properties": {},
                              "additionalProperties": {
                                "type": "boolean"
                              },
                              "type": "object"
                            },
                            "grants": {
                              "type": "array"
                            },
                            "limits": {
                              "properties": {},
                              "type": "object"
                            },
                            "planSlug": {},
                            "quotas": {
                              "properties": {},
                              "type": "object"
                            },
                            "standing": {
                              "type": "string"
                            },
                            "subject": {
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "type": {
                                  "type": "string"
                                }
                              },
                              "type": "object"
                            }
                          },
                          "type": "object"
                        },
                        "features": {
                          "properties": {},
                          "additionalProperties": {
                            "type": "boolean"
                          },
                          "type": "object"
                        },
                        "id": {
                          "type": "string"
                        },
                        "image": {
                          "type": "string"
                        },
                        "limits": {
                          "properties": {},
                          "type": "object"
                        },
                        "memberCount": {
                          "type": "integer"
                        },
                        "name": {
                          "type": "string"
                        },
                        "permissions": {
                          "properties": {
                            "reviewer": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          },
                          "type": "object"
                        },
                        "quotas": {
                          "properties": {
                            "email_sends": {
                              "properties": {
                                "allowOverage": {
                                  "type": "boolean"
                                },
                                "consumed": {
                                  "type": "boolean"
                                },
                                "included": {
                                  "type": "integer"
                                },
                                "limits": {
                                  "type": "integer"
                                },
                                "remaining": {
                                  "type": "integer"
                                },
                                "used": {
                                  "type": "integer"
                                }
                              },
                              "type": "object"
                            }
                          },
                          "type": "object"
                        },
                        "roles": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "users": {
                          "items": {
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "email": {
                                "type": "string"
                              },
                              "image": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "role": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "workflowsDisabled": {
                          "type": "boolean"
                        },
                        "workspaceId": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "message": "Workspace user added successfully",
                  "userId": "000000000000000000000001",
                  "workspace": {
                    "_id": "000000000000000000000002",
                    "createdAt": "2026-01-01T00:00:00.000Z",
                    "createdBy": {
                      "_id": "000000000000000000000003",
                      "email": "user@example.com",
                      "image": "",
                      "name": "Session User m13-owner"
                    },
                    "creditBalance": 0,
                    "deleted": false,
                    "entitlement": {
                      "decidedBy": {
                        "sso-1794380633736": "default"
                      },
                      "features": {
                        "sso-1794380633736": false
                      },
                      "grants": [],
                      "limits": {},
                      "planSlug": null,
                      "quotas": {},
                      "standing": "none",
                      "subject": {
                        "id": "000000000000000000000002",
                        "type": "workspace"
                      }
                    },
                    "features": {
                      "sso-1794380633736": false
                    },
                    "id": "000000000000000000000002",
                    "image": "",
                    "limits": {},
                    "memberCount": 8,
                    "name": "Joining 1767225600000",
                    "quotas": {
                      "email_sends": {
                        "allowOverage": false,
                        "consumed": true,
                        "included": 0,
                        "limits": 0,
                        "remaining": 0,
                        "used": 0
                      }
                    },
                    "roles": [
                      "admin",
                      "editor",
                      "viewer"
                    ],
                    "updatedAt": "2026-01-01T00:00:00.000Z",
                    "users": [
                      {
                        "_id": "000000000000000000000003",
                        "email": "user@example.com",
                        "image": "",
                        "name": "Session User m13-owner",
                        "role": "admin"
                      },
                      {
                        "_id": "000000000000000000000004",
                        "email": "user@example.com",
                        "image": "",
                        "name": "Session User m13-outsider",
                        "role": "viewer"
                      },
                      {
                        "_id": "000000000000000000000005",
                        "email": "user@example.com",
                        "image": "",
                        "name": "Session User m13-early",
                        "role": "viewer"
                      },
                      {
                        "_id": "000000000000000000000006",
                        "email": "user@example.com",
                        "image": "",
                        "name": "Session User m13-joiner",
                        "role": "viewer"
                      },
                      {
                        "_id": "000000000000000000000007",
                        "email": "user@example.com",
                        "image": "",
                        "name": "Session User m13-asker",
                        "role": "viewer"
                      },
                      {
                        "_id": "000000000000000000000008",
                        "email": "user@example.com",
                        "image": "",
                        "name": "Session User m13-late",
                        "role": "viewer"
                      },
                      {
                        "_id": "000000000000000000000009",
                        "email": "user@example.com",
                        "image": "",
                        "name": "Session User m13-guest",
                        "role": "viewer"
                      },
                      {
                        "_id": "000000000000000000000001",
                        "email": "user@example.com",
                        "image": "",
                        "name": "Session User m13-lead",
                        "role": "admin"
                      }
                    ],
                    "workflowsDisabled": false,
                    "workspaceId": "P1xdNFhfjpnFUkw"
                  }
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/users/index.ts",
        "x-events": [
          "workspace.member_added",
          "workspace.member_invited"
        ]
      }
    },
    "/api/v1/public/workspaces/{workspaceId}/users/{userId}": {
      "delete": {
        "operationId": "workspaces.users.delete",
        "summary": "Remove a member from the workspace, or leave it",
        "description": "Needs `workspace:members:remove`, except to remove yourself. The owner leaving is refused with 409 `WORKSPACE_OWNER_CANNOT_LEAVE`, removing the owner or the last admin with 400, and removing a member whose card pays for the subscription with 409 `PAYER_STILL_PAYS`.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "userId": {
                      "type": "string"
                    },
                    "workspace": {
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "createdBy": {
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            },
                            "image": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "creditBalance": {
                          "type": "integer"
                        },
                        "deleted": {
                          "type": "boolean"
                        },
                        "features": {
                          "properties": {},
                          "type": "object"
                        },
                        "id": {
                          "type": "string"
                        },
                        "image": {
                          "type": "string"
                        },
                        "limits": {
                          "properties": {},
                          "type": "object"
                        },
                        "name": {
                          "type": "string"
                        },
                        "quotas": {
                          "properties": {},
                          "type": "object"
                        },
                        "roles": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "users": {
                          "items": {
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "email": {
                                "type": "string"
                              },
                              "image": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "workflowsDisabled": {
                          "type": "boolean"
                        },
                        "workspaceId": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "message": "Workspace user removed successfully",
                  "userId": "000000000000000000000001",
                  "workspace": {
                    "_id": "000000000000000000000002",
                    "createdAt": "2026-01-01T00:00:00.000Z",
                    "createdBy": {
                      "_id": "000000000000000000000003",
                      "email": "user@example.com",
                      "image": "",
                      "name": "Session User bound-owner"
                    },
                    "creditBalance": 0,
                    "deleted": false,
                    "features": {},
                    "id": "000000000000000000000002",
                    "image": "",
                    "limits": {},
                    "name": "Bound 1767225600000",
                    "quotas": {},
                    "roles": [
                      "admin",
                      "editor",
                      "viewer"
                    ],
                    "updatedAt": "2026-01-01T00:00:00.000Z",
                    "users": [
                      {
                        "_id": "000000000000000000000003",
                        "email": "user@example.com",
                        "image": "",
                        "name": "Session User bound-owner"
                      },
                      {
                        "_id": "000000000000000000000004",
                        "email": "user@example.com",
                        "image": "",
                        "name": "Session User bound-viewer"
                      },
                      {
                        "_id": "000000000000000000000005",
                        "email": "user@example.com",
                        "image": "",
                        "name": "Ada Lovelace"
                      },
                      {
                        "_id": "000000000000000000000006",
                        "email": "user@example.com",
                        "image": "",
                        "name": "Existing Person"
                      },
                      {
                        "_id": "000000000000000000000001",
                        "email": "user@example.com",
                        "image": "",
                        "name": "Ada Lovelace"
                      }
                    ],
                    "workflowsDisabled": false,
                    "workspaceId": "hz0P6XeyVUJt3hk"
                  }
                },
                "x-observed": true
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/users/index.ts",
        "x-events": [
          "workspace.member_removed"
        ]
      },
      "patch": {
        "operationId": "workspaces.users.update",
        "summary": "Change a member's role",
        "description": "Needs `workspace:members:role-change`. Refused with 409 `WORKSPACE_OWNER_ROLE_FIXED` for the owner, 403 for a role above the caller's, and 402 `SEAT_LIMIT_REACHED` when the new role needs a seat the plan lacks.",
        "tags": [
          "Workspaces"
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "role": {
                    "type": "string"
                  }
                },
                "required": [
                  "role"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "userId": {
                      "type": "string"
                    },
                    "workspace": {
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "createdBy": {
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            },
                            "image": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        },
                        "creditBalance": {
                          "type": "integer"
                        },
                        "deleted": {
                          "type": "boolean"
                        },
                        "features": {
                          "properties": {},
                          "type": "object"
                        },
                        "id": {
                          "type": "string"
                        },
                        "image": {
                          "type": "string"
                        },
                        "limits": {
                          "properties": {},
                          "type": "object"
                        },
                        "name": {
                          "type": "string"
                        },
                        "quotas": {
                          "properties": {},
                          "type": "object"
                        },
                        "roles": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "users": {
                          "items": {
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "email": {
                                "type": "string"
                              },
                              "image": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "workflowsDisabled": {
                          "type": "boolean"
                        },
                        "workspaceId": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "message": "Workspace user updated successfully",
                  "userId": "000000000000000000000001",
                  "workspace": {
                    "_id": "000000000000000000000002",
                    "createdAt": "2026-01-01T00:00:00.000Z",
                    "createdBy": {
                      "_id": "000000000000000000000003",
                      "email": "user@example.com",
                      "image": "",
                      "name": "Session User m10-owner"
                    },
                    "creditBalance": 0,
                    "deleted": false,
                    "features": {},
                    "id": "000000000000000000000002",
                    "image": "",
                    "limits": {},
                    "name": "Admins 1767225600000",
                    "quotas": {},
                    "roles": [
                      "admin",
                      "editor",
                      "viewer"
                    ],
                    "updatedAt": "2026-01-01T00:00:00.000Z",
                    "users": [
                      {
                        "_id": "000000000000000000000003",
                        "email": "user@example.com",
                        "image": "",
                        "name": "Session User m10-owner"
                      },
                      {
                        "_id": "000000000000000000000004",
                        "email": "user@example.com",
                        "image": "",
                        "name": "Session User m10-alice"
                      },
                      {
                        "_id": "000000000000000000000001",
                        "email": "user@example.com",
                        "image": "",
                        "name": "Session User m10-guest"
                      }
                    ],
                    "workflowsDisabled": false,
                    "workspaceId": "ejm0sle6ylEw3eY"
                  }
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [
          {
            "sessionId": []
          }
        ],
        "x-auth": "session",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/workspaces/users/index.ts",
        "x-events": [
          "workspace.member_role_changed"
        ]
      }
    },
    "/api/v1/public/{orgId}/ad-conversions/google-ads-adjustments.csv": {
      "get": {
        "operationId": "adConversions.googleAdsAdjustmentsCsv.list",
        "summary": "Export conversion adjustments as a Google Ads import CSV",
        "description": "No session: protected by the org's export token, sent as a Basic-auth password or `?token=`. A wrong or missing token answers 401 with a `WWW-Authenticate` header.",
        "tags": [
          "Ad conversions"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                },
                "example": "Google Click ID,Conversion Name,Conversion Time,Adjustment Type,Adjustment Time,Adjusted Value,Adjusted Value Currency,Order ID\r\nCj0KCQjwE2E-e2e-click-id_123456,Paid subscription,2026-11-11 07:05:43+0000,RETRACT,2026-11-11 07:05:43+0000,,,sub_e2e_1\r\n",
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "public-org-lookup",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/index.ts"
      }
    },
    "/api/v1/public/{orgId}/ad-conversions/google-ads.csv": {
      "get": {
        "operationId": "adConversions.googleAdsCsv.list",
        "summary": "Export server-side conversions as a Google Ads import CSV",
        "description": "No session: protected by the org's export token, sent as a Basic-auth password or `?token=`. A wrong or missing token answers 401 with a `WWW-Authenticate` header.",
        "tags": [
          "Ad conversions"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                },
                "example": "Google Click ID,Conversion Name,Conversion Time,Conversion Value,Conversion Currency,Order ID\r\nCj0KCQjwE2E-e2e-click-id_123456,Paid subscription,2026-11-11 07:05:43+0000,49.00,USD,sub_e2e_1\r\n",
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "public-org-lookup",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/index.ts"
      }
    },
    "/api/v1/public/{orgId}/add-ons": {
      "get": {
        "operationId": "addOns.list",
        "summary": "List the organization's add-ons on sale",
        "description": "Public, no session. Lists published, unarchived, public offers in catalog order, without Stripe ids; `?currency=` keeps only offers priced in that currency. Cached for five minutes; answers 400 for a currency that is not a three-letter code.",
        "tags": [
          "Add ons"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/index.ts"
      }
    },
    "/api/v1/public/{orgId}/agent-readiness": {
      "get": {
        "operationId": "agentReadiness.list",
        "summary": "Get the organization's agent-readiness configuration",
        "description": "Public, no session, cached for five minutes. Answers `enabled: false` when agent readiness is off, otherwise the org's authorization server issuer and metadata URL.",
        "tags": [
          "Agent readiness"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "authorizationServer": {
                      "properties": {
                        "issuer": {
                          "type": "string"
                        },
                        "metadataUrl": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "enabled": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "authorizationServer": {
                    "issuer": "[REDACTED]",
                    "metadataUrl": "[REDACTED]"
                  },
                  "enabled": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/index.ts"
      }
    },
    "/api/v1/public/{orgId}/checkout/{sessionId}": {
      "get": {
        "operationId": "checkout.get",
        "summary": "Get what a completed Stripe checkout session charged",
        "description": "Public, no session: the checkout session id is the credential. Reads the session from Stripe with the org's key and answers amounts in minor units, and the line items once complete. A malformed id, a session for another org or any Stripe error answers 404.",
        "tags": [
          "Checkout"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "public-org-lookup",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/index.ts"
      }
    },
    "/api/v1/public/{orgId}/checkout/{sessionId}/reported": {
      "post": {
        "operationId": "checkout.reported.create",
        "summary": "Record that the browser already reported a purchase to a provider",
        "description": "Public, no session. Marks the purchase as reported so the server does not send the same conversion to that provider again; answers `recorded: false` for an unknown provider or malformed session id, never an error.",
        "tags": [
          "Checkout"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "provider": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 64
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "public-write",
            "windowMs": 60000,
            "max": 10,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/index.ts"
      }
    },
    "/api/v1/public/{orgId}/checkout/{sessionId}/status": {
      "get": {
        "operationId": "checkout.status.list",
        "summary": "Get whether a checkout the buyer returned from is complete",
        "description": "Public, no session: the checkout session id is the credential. Every state, `not_found` included, is a 200; `?nudge=1` skips the cached answer. Answers 429 or 503 with `retryAfterMs` when the caller should keep waiting.",
        "tags": [
          "Checkout"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "checkout-status",
            "windowMs": 60000,
            "max": 60,
            "per": "checkoutSessionLimiterKey"
          },
          {
            "prefix": "checkout-status-ip",
            "windowMs": 60000,
            "max": 600,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/index.ts"
      }
    },
    "/api/v1/public/{orgId}/consent": {
      "post": {
        "operationId": "consent.create",
        "summary": "Record a visitor's consent choices",
        "description": "Public, no session needed; a session or auth state, when present, files the record under the account. Rate limited per IP, sized for many visitors behind one address. Answers 429 when the org's daily ceiling is reached; a failed write answers `recorded: false`, not an error.",
        "tags": [
          "Consent"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clientId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "visitorId": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{16,64}$"
                  },
                  "choices": {
                    "type": "object",
                    "properties": {
                      "analytics": {
                        "type": "boolean"
                      },
                      "marketing": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "analytics",
                      "marketing"
                    ],
                    "additionalProperties": false
                  },
                  "manifestVersion": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "consentString": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "source": {
                    "type": "string",
                    "pattern": "^[a-z0-9_:-]{1,40}$"
                  }
                },
                "required": [
                  "clientId",
                  "visitorId",
                  "choices"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "recorded": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "recorded": true
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "consent-record",
            "windowMs": 60000,
            "max": 120,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/index.ts"
      }
    },
    "/api/v1/public/{orgId}/credit-packages": {
      "get": {
        "operationId": "creditPackages.list",
        "summary": "List the organization's credit packages on sale",
        "description": "Public, no session, cached for five minutes. Sorted by sort order, with prices in minor units and no Stripe ids.",
        "tags": [
          "Credit packages"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/index.ts"
      }
    },
    "/api/v1/public/{orgId}/e": {
      "post": {
        "operationId": "e.create",
        "summary": "Send a web analytics beacon for an organization",
        "description": "Public and unauthenticated: takes one beacon as a `text/plain` JSON body from the SDK or script tag and buffers it for ingestion, answering 202. Answers 404 for a tenant key this server does not serve or one whose collection is turned off, which tells the sender to stop, and 400 for a body that is not a JSON object. Rate limited by IP.",
        "tags": [
          "Web analytics beacon"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "text/plain": {
              "schema": {
                "type": "string",
                "contentMediaType": "application/json"
              },
              "x-contentSchema": {
                "type": "object",
                "properties": {
                  "v": {
                    "type": "integer",
                    "enum": [
                      1
                    ]
                  },
                  "t": {
                    "type": "string",
                    "enum": [
                      "pv",
                      "goal",
                      "out",
                      "ping"
                    ]
                  },
                  "eid": {
                    "type": "string",
                    "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
                    "maxLength": 36
                  },
                  "u": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 1000
                  },
                  "r": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500
                  },
                  "vid": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
                    "maxLength": 36
                  },
                  "sid": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
                    "maxLength": 36
                  },
                  "pc": {
                    "type": "boolean"
                  },
                  "sw": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000
                  },
                  "n": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "p": {
                    "type": "object",
                    "maxProperties": 10,
                    "propertyNames": {
                      "pattern": "^[a-z0-9_]{1,40}$"
                    },
                    "additionalProperties": {
                      "type": [
                        "string",
                        "number",
                        "boolean"
                      ],
                      "maxLength": 255
                    }
                  },
                  "d": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 600000
                  },
                  "a": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "string",
                      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
                      "maxLength": 36
                    }
                  }
                },
                "required": [
                  "v",
                  "t",
                  "eid",
                  "u"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "c": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "c": "denied"
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "analytics-ip",
            "windowMs": 60000,
            "max": 300,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/analytics.ts"
      }
    },
    "/api/v1/public/{orgId}/invitations/preview/{token}": {
      "get": {
        "operationId": "invitations.preview.get",
        "summary": "Preview an invitation by its emailed token before sign-in",
        "description": "Public, no session. Answers the workspace, inviter, role, scrambled address, status and whether joining is possible; an unknown token or org answers 404. Changes nothing.",
        "tags": [
          "Invitations"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "public-org-lookup",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/index.ts"
      }
    },
    "/api/v1/public/{orgId}/plan-group-versions/{groupVersionId}": {
      "get": {
        "operationId": "planGroupVersions.get",
        "summary": "Get a published pricing group version by id",
        "description": "Public, no session, cached for five minutes. A draft, archived or unknown version answers 404; archived plans are left out and the rest keep the version's order.",
        "tags": [
          "Plan group versions"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "groupVersionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/index.ts"
      }
    },
    "/api/v1/public/{orgId}/plans/{groupSlug}": {
      "get": {
        "operationId": "plans.get",
        "summary": "Get the current published plans of a pricing group by slug",
        "description": "Public, no session, cached for five minutes. Answers the group's current published version's plans in their configured order, without archived plans, with prices in minor units. Answers 404 for an unknown group or one with no current published version.",
        "tags": [
          "Plans"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "groupSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/index.ts"
      }
    },
    "/api/v1/public/{orgId}/promotions/{code}": {
      "get": {
        "operationId": "promotions.get",
        "summary": "Check whether a promotion code applies to a plan or credit package",
        "description": "Public, no session. An unknown or invalid code answers 200 with `valid: false`. Answers 400 without a currency or without a plan version or credit package, and 503 when codes cannot be checked. Lookups that reach the organization's Stripe account have a per-organization budget a minute; past it the check answers 429 with `Retry-After`. An unknown code is remembered for a short while.",
        "tags": [
          "Promotions"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "The handler's own answer. Not described yet: response bodies come from captured responses (server/openapi/captured) and overlays (server/openapi/overlays)."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          },
          {
            "prefix": "auth",
            "windowMs": 60000,
            "max": 30,
            "per": "ip"
          }
        ],
        "x-source": "server/src/routes/v1/public/index.ts"
      }
    },
    "/api/v1/public/{orgId}/settings": {
      "get": {
        "operationId": "settings.list",
        "summary": "Get the organization's public app settings",
        "description": "Public, no session, cached for five minutes. Answers the workspace settings with each role's permissions, billing onboarding mode, upload policy, enterprise sign-in flags, and the environment and selling settings when present.",
        "tags": [
          "Settings"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "billing": {
                      "properties": {
                        "onboarding": {
                          "properties": {
                            "mode": {
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "enterprise": {
                      "properties": {
                        "provisioning": {
                          "type": "boolean"
                        },
                        "sso": {
                          "type": "boolean"
                        }
                      },
                      "type": "object"
                    },
                    "uploads": {
                      "properties": {
                        "enabled": {
                          "type": "boolean"
                        },
                        "maxFileBytes": {
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "workspace": {
                      "properties": {
                        "autoCreateFirst": {
                          "type": "boolean"
                        },
                        "canCreateWorkspace": {
                          "type": "boolean"
                        },
                        "canInviteMembers": {
                          "type": "boolean"
                        },
                        "customPermissions": {
                          "items": {
                            "properties": {
                              "group": {
                                "type": "string"
                              },
                              "key": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "defaultRole": {
                          "type": "string"
                        },
                        "maxWorkspaceUsers": {
                          "type": "integer"
                        },
                        "maxWorkspaces": {
                          "type": "integer"
                        },
                        "maxWorkspacesPerUser": {
                          "type": "integer"
                        },
                        "mode": {
                          "type": "string"
                        },
                        "permissions": {
                          "properties": {
                            "admin": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "editor": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "reviewer": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "viewer": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            }
                          },
                          "type": "object"
                        },
                        "roles": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "showSwitcher": {
                          "type": "boolean"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "billing": {
                    "onboarding": {
                      "mode": "require_plan"
                    }
                  },
                  "enterprise": {
                    "provisioning": true,
                    "sso": true
                  },
                  "uploads": {
                    "enabled": true,
                    "maxFileBytes": 5242880
                  },
                  "workspace": {
                    "autoCreateFirst": true,
                    "canCreateWorkspace": true,
                    "canInviteMembers": true,
                    "customPermissions": [],
                    "defaultRole": "viewer",
                    "maxWorkspaceUsers": 10000,
                    "maxWorkspaces": 50,
                    "maxWorkspacesPerUser": 0,
                    "mode": "platform",
                    "permissions": {
                      "admin": [
                        "workspace:settings:view",
                        "workspace:settings:edit",
                        "workspace:members:view",
                        "workspace:members:invite",
                        "workspace:members:remove",
                        "workspace:members:role-change",
                        "workspace:features:view",
                        "workspace:features:edit",
                        "workspace:billing:view",
                        "workspace:billing:manage"
                      ],
                      "editor": [
                        "workspace:settings:view",
                        "workspace:members:view",
                        "workspace:features:view",
                        "workspace:billing:view",
                        "workspace:usage:view",
                        "workspace:usage:record",
                        "workspace:selling:view"
                      ],
                      "reviewer": [
                        "workspace:settings:view",
                        "workspace:members:view",
                        "workspace:features:view",
                        "workspace:billing:view",
                        "workspace:usage:view",
                        "workspace:usage:record",
                        "workspace:selling:view"
                      ],
                      "viewer": [
                        "workspace:settings:view",
                        "workspace:members:view"
                      ]
                    },
                    "roles": [
                      "admin",
                      "editor",
                      "viewer",
                      "reviewer"
                    ],
                    "showSwitcher": true
                  }
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/index.ts"
      }
    },
    "/api/v1/public/{orgId}/tracking": {
      "get": {
        "operationId": "tracking.list",
        "summary": "Get the tracking scripts configured for an app client",
        "description": "Public, no session. Keyed on `?clientId=`; an unknown client or none answers an empty config. The shared part is cached for five minutes and the visitor's country and consent default are added per request.",
        "tags": [
          "Tracking"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "consent": {
                      "properties": {
                        "defaults": {
                          "properties": {
                            "default": {
                              "type": "string"
                            },
                            "regions": {
                              "properties": {
                                "denied": {
                                  "items": {
                                    "type": "string"
                                  },
                                  "type": "array"
                                }
                              },
                              "type": "object"
                            }
                          },
                          "type": "object"
                        },
                        "manifest": {
                          "items": {
                            "properties": {
                              "category": {
                                "type": "string"
                              },
                              "key": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "privacyUrl": {
                                "type": "string"
                              },
                              "vendor": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "manifestVersion": {
                          "format": "date-time",
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "country": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "enhancedConversions": {
                      "type": "boolean"
                    },
                    "region": {},
                    "resolvedConsentDefault": {
                      "type": "string"
                    },
                    "scripts": {
                      "items": {
                        "properties": {
                          "consentCategory": {
                            "type": "string"
                          },
                          "conversionIds": {
                            "properties": {
                              "purchase": {
                                "type": "string"
                              },
                              "sign_up": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "key": {
                            "type": "string"
                          },
                          "provider": {
                            "type": "string"
                          },
                          "providerId": {
                            "type": "string"
                          },
                          "recordsSessions": {
                            "type": "boolean"
                          },
                          "src": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "consent": {
                    "defaults": {
                      "default": "granted",
                      "regions": {
                        "denied": [
                          "EEA",
                          "GB",
                          "CH"
                        ]
                      }
                    },
                    "manifest": [
                      {
                        "category": "marketing",
                        "key": "[REDACTED]",
                        "name": "Google Ads",
                        "privacyUrl": "https://policies.google.com/privacy",
                        "vendor": "Google LLC"
                      }
                    ],
                    "manifestVersion": "2026-01-01T00:00:00.000Z"
                  },
                  "country": "US",
                  "enabled": true,
                  "enhancedConversions": true,
                  "region": null,
                  "resolvedConsentDefault": "granted",
                  "scripts": [
                    {
                      "consentCategory": "marketing",
                      "conversionIds": {
                        "sign_up": "Z7n-CKvtmv0cELPU_d5E"
                      },
                      "key": "[REDACTED]",
                      "provider": "google_ads",
                      "providerId": "AW-18452802099"
                    }
                  ]
                },
                "x-observed": true
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "global",
            "windowMs": 3000,
            "max": 500,
            "per": "ip"
          },
          {
            "prefix": "apikey",
            "windowMs": 60000,
            "max": 1000,
            "per": "key",
            "counts": "some"
          }
        ],
        "x-source": "server/src/routes/v1/public/index.ts"
      }
    },
    "/org/{orgId}": {
      "get": {
        "operationId": "discovery.get",
        "summary": "Get an organization's issuer landing document",
        "description": "Public. Answers the organization's issuer identifier and the URL of its authorization server metadata, so a person or tool that opens the issuer URL is pointed at the metadata. Answers 404 only for an id that is not shaped like an org key; it does not look the organization up.",
        "tags": [
          "Discovery"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "issuer": {
                      "type": "string"
                    },
                    "oauth_authorization_server_metadata": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "example": {
                  "issuer": "http://localhost:3000/org/000000000000000000000001",
                  "oauth_authorization_server_metadata": "[REDACTED]"
                },
                "x-observed": true
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "discovery",
            "windowMs": 60000,
            "max": 120,
            "per": "ip"
          }
        ],
        "x-source": "server/src/app.ts"
      }
    },
    "/org/{orgId}/auth.md": {
      "get": {
        "operationId": "discovery.authMd.list",
        "summary": "Get an organization's auth.md instructions for agents",
        "description": "Public. Answers a Markdown document that tells an agent how to register by email and get a token for this organization, cacheable for five minutes. Answers 404 `not_found` for an unknown organization or when the organization has not turned on agent registration with a usable agent client.",
        "tags": [
          "Discovery"
        ],
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                },
                "example": "# auth.md: registering an agent for a person who uses this app\n\nYou are an agent. This tells you how to get an access token to act for one person on this app when all you know is their email address. Follow the steps in order.\n\n## 1. Discover\n\nThe authorization server metadata (RFC 8414) is at http://localhost:3000/.well-known/oauth-authorization-server/org/000000000000000000000001. Its `agent_auth` block names the endpoints below, and its `token_endpoint` is where you poll.\n\n## 2. Register\n\n```",
                "x-observed": true
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "description": "Any other answer the handler sends itself (its own refusals). Not described yet."
          }
        },
        "security": [],
        "x-auth": "none-at-router",
        "x-rateLimit": [
          {
            "prefix": "discovery",
            "windowMs": 60000,
            "max": 120,
            "per": "ip"
          }
        ],
        "x-source": "server/src/app.ts"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "loginToken": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "An app end user's login token from hosted sign-in, for the same org as the request."
      },
      "orgQuery": {
        "type": "apiKey",
        "in": "query",
        "name": "org",
        "description": "The org id the request is for, when there is no sign-in state. Not a credential."
      },
      "sessionId": {
        "type": "apiKey",
        "in": "header",
        "name": "x-session-id",
        "description": "An end user's session id, as the SDK sends it. `POST /api/v1/public/token/exchange` issues one for an org API token."
      },
      "signInState": {
        "type": "apiKey",
        "in": "header",
        "name": "state",
        "description": "The hosted sign-in state id. Names the org the request is for; not a credential."
      }
    },
    "responses": {
      "InvalidInput": {
        "description": "The request failed a `validate()` schema, or an id in the path is not a valid id. `path` names the field.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "boolean",
                  "const": true
                },
                "success": {
                  "type": "boolean",
                  "const": false
                },
                "path": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "message"
              ]
            }
          }
        }
      },
      "OAuthError": {
        "description": "The request was refused in the OAuth 2.0 error shape (RFC 6749 section 5.2): `error` is a code such as `invalid_request`, `invalid_grant`, `unsupported_grant_type` or `invalid_scope`, and `error_description` says why in words. Branch on `error`, never on the description.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string",
                  "description": "An OAuth 2.0 error code (RFC 6749, RFC 7009, RFC 7662, RFC 8628), such as `invalid_request` or `invalid_client`."
                },
                "error_description": {
                  "type": "string"
                }
              },
              "required": [
                "error"
              ]
            }
          }
        }
      },
      "OAuthInvalidClient": {
        "description": "Client authentication failed (RFC 6749 section 5.2): `error` is `invalid_client`. When the client sent its credentials with HTTP Basic, the answer carries a `WWW-Authenticate` header.",
        "headers": {
          "WWW-Authenticate": {
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string",
                  "description": "An OAuth 2.0 error code (RFC 6749, RFC 7009, RFC 7662, RFC 8628), such as `invalid_request` or `invalid_client`."
                },
                "error_description": {
                  "type": "string"
                }
              },
              "required": [
                "error"
              ]
            }
          }
        }
      },
      "Unauthorized": {
        "description": "The credential is missing, expired or not accepted here, or the caller's role has no grant for `x-permission` (refused with 401 too). The body is the plain text `Unauthorized`, or a JSON body with a `code` where the gate says why."
      },
      "NotFound": {
        "description": "An id in the path names nothing in this org.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "const": false
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "message"
              ]
            }
          }
        }
      },
      "RateLimited": {
        "description": "A rate limit in `x-rateLimit` was reached. `retryAfter` and the `Retry-After` header say how many seconds until the window resets.",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            }
          },
          "RateLimit-Limit": {
            "schema": {
              "type": "integer"
            }
          },
          "RateLimit-Remaining": {
            "schema": {
              "type": "integer"
            }
          },
          "RateLimit-Reset": {
            "schema": {
              "type": "integer"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "const": false
                },
                "message": {
                  "type": "string"
                },
                "reason": {
                  "type": "string",
                  "const": "rate_limited"
                },
                "retryAfter": {
                  "type": "integer"
                }
              },
              "required": [
                "success",
                "message",
                "reason"
              ]
            }
          }
        }
      }
    }
  }
}
