{"components":{"parameters":{"endUserHeader":{"description":"End-user reference for live billing with secret keys (required for sb_live_ secret keys)","in":"header","name":"X-Switchboard-End-User","required":false,"schema":{"type":"string"}},"endUserSessionHeader":{"description":"End-user session token (sb_eusr_...) required for publishable chat, checkout, profile, and billing portal routes","in":"header","name":"X-Switchboard-End-User-Session","required":false,"schema":{"type":"string"}}},"securitySchemes":{"accountSession":{"description":"Account session token (sb_sess_...)","scheme":"bearer","type":"http"},"bearerAuth":{"description":"Project key. Use publishable keys from clients; secret keys are trusted-server only.","scheme":"bearer","type":"http"}}},"info":{"description":"Hosted backend for LLM calls, end-user auth, usage metering, and Stripe Connect billing.\n\n**Publishable keys** (`sb_pub_test_`, `sb_pub_live_`): client-safe project identifiers for hosted end-user auth, chat, checkout, billing portals, models, and catalog pricing. Publishable chat, checkout, profile, and billing portal routes require `X-Switchboard-End-User-Session` and an allowed project origin.\n**Secret keys** (`sb_test_`, `sb_live_`): advanced trusted-server compatibility, including legacy `POST /v1/end_users`.\n\nSee `docs/no-backend.md` in the Switchboard repository.\n","title":"Switchboard API","version":"0.1.0"},"openapi":"3.1.0","paths":{"/account/cli/exchange":{"post":{"description":"Consumes a short-lived one-time code created by `/auth/cli/start` and returns an account session token.","operationId":"accountCliExchange","responses":{"200":{"description":"Account session token"},"400":{"description":"Invalid, expired, reused, or wrong-state code"},"429":{"description":"Rate limited"}},"summary":"Exchange browser CLI login code"}},"/account/integration_kit":{"get":{"operationId":"accountIntegrationKit","security":[{"accountSession":[]}],"summary":"Integration kit (account auth)"}},"/account/keys":{"get":{"operationId":"accountListKeys","security":[{"accountSession":[]}],"summary":"List API keys"},"post":{"description":"Pass `key_type`: `publishable` for browser/mobile apps or `secret` for trusted-server compatibility.","operationId":"accountCreateKey","security":[{"accountSession":[]}],"summary":"Create API key"}},"/account/keys/sandbox/regenerate-publishable":{"post":{"operationId":"accountRegeneratePublishableSandbox","security":[{"accountSession":[]}],"summary":"Regenerate sandbox publishable key"}},"/account/me":{"delete":{"operationId":"accountDelete","security":[{"accountSession":[]}],"summary":"Schedule account deletion"},"get":{"operationId":"accountMe","responses":{"200":{"description":"User, organization, project"}},"security":[{"accountSession":[]}],"summary":"Current account profile"},"patch":{"operationId":"accountUpdateProfile","security":[{"accountSession":[]}],"summary":"Update account profile"}},"/account/me/restore":{"post":{"operationId":"accountRestore","security":[{"accountSession":[]}],"summary":"Cancel scheduled account deletion"}},"/account/projects":{"get":{"operationId":"accountListProjects","security":[{"accountSession":[]}],"summary":"List projects"},"post":{"operationId":"accountCreateProject","security":[{"accountSession":[]}],"summary":"Create project"}},"/account/projects/{id}":{"delete":{"operationId":"accountDeleteProject","security":[{"accountSession":[]}],"summary":"Move project to trash"},"get":{"operationId":"accountShowProject","security":[{"accountSession":[]}],"summary":"Show project"},"patch":{"description":"May include `billing_mode` (`developer_paid`, `end_user_paid`, `credit_wallet`), `credit_wallet_monthly_amount_micros`, `allowed_origins`, mobile allowlists, and customer legal/support fields: `end_user_terms_url`, `end_user_privacy_url`, `support_url`, `support_email`.","operationId":"accountUpdateProject","security":[{"accountSession":[]}],"summary":"Update project"}},"/account/projects/{id}/restore":{"post":{"operationId":"accountRestoreProject","security":[{"accountSession":[]}],"summary":"Restore project from trash"}},"/account/register":{"post":{"operationId":"accountRegister","responses":{"410":{"description":"Account registration is browser-only"}},"summary":"Browser-only account registration notice"}},"/account/session":{"delete":{"operationId":"accountLogout","responses":{"204":{"description":"Session revoked"}},"security":[{"accountSession":[]}],"summary":"Revoke account session"},"post":{"operationId":"accountLogin","responses":{"410":{"description":"Account login is browser-only"}},"summary":"Browser-only account login notice"}},"/account/usage":{"get":{"operationId":"accountUsage","security":[{"accountSession":[]}],"summary":"Usage summary"}},"/account/workspaces":{"get":{"operationId":"accountListWorkspaces","security":[{"accountSession":[]}],"summary":"List workspaces"},"post":{"operationId":"accountCreateWorkspace","security":[{"accountSession":[]}],"summary":"Create workspace"}},"/account/workspaces/{id}":{"delete":{"operationId":"accountDeleteWorkspace","security":[{"accountSession":[]}],"summary":"Move workspace to trash"},"get":{"operationId":"accountShowWorkspace","security":[{"accountSession":[]}],"summary":"Show workspace"},"patch":{"operationId":"accountUpdateWorkspace","security":[{"accountSession":[]}],"summary":"Update workspace"}},"/account/workspaces/{id}/restore":{"post":{"operationId":"accountRestoreWorkspace","security":[{"accountSession":[]}],"summary":"Restore workspace from trash"}},"/catalog/models":{"get":{"operationId":"listCatalogModels","responses":{"200":{"description":"Switchboard catalog with per-million-token rates (micro-dollars and USD strings)"}},"summary":"List models with catalog pricing"}},"/chat/completions":{"post":{"operationId":"createChatCompletion","parameters":[{"$ref":"#/components/parameters/endUserHeader"},{"$ref":"#/components/parameters/endUserSessionHeader"}],"responses":{"200":{"description":"Completion response (OpenAI-compatible)"},"401":{"description":"End-user session required for publishable chat"},"402":{"description":"Billing gate"},"403":{"description":"Forbidden route or origin (publishable keys)"},"429":{"description":"Rate limited"}},"security":[{"bearerAuth":[]}],"summary":"Create chat completion"}},"/end_user_auth/billing-portal":{"post":{"operationId":"endUserAuthBillingPortal","parameters":[{"$ref":"#/components/parameters/endUserSessionHeader"}],"responses":{"200":{"description":"Portal URL"},"422":{"description":"Stripe not connected or no customer"}},"security":[{"bearerAuth":[]}],"summary":"Stripe billing portal for signed-in end user"}},"/end_user_auth/checkout":{"post":{"operationId":"endUserAuthCheckout","parameters":[{"$ref":"#/components/parameters/endUserSessionHeader"}],"responses":{"200":{"description":"checkout_url and optional hosted_url"},"422":{"description":"Stripe not connected, developer billing missing for Credit wallet, or live checkout blocked by missing project legal links"}},"security":[{"bearerAuth":[]}],"summary":"Create checkout for signed-in end user"}},"/end_user_auth/me":{"get":{"operationId":"endUserAuthMe","parameters":[{"$ref":"#/components/parameters/endUserSessionHeader"}],"responses":{"200":{"description":"End user profile and billing_status"},"401":{"description":"Invalid or missing session"}},"security":[{"bearerAuth":[]}],"summary":"Current signed-in end user"}},"/end_user_auth/password":{"patch":{"operationId":"endUserAuthChangePassword","parameters":[{"$ref":"#/components/parameters/endUserSessionHeader"}],"responses":{"200":{"description":"Password updated"},"401":{"description":"Invalid credentials or missing session"}},"security":[{"bearerAuth":[]}],"summary":"Change signed-in end-user password"}},"/end_user_auth/password/forgot":{"post":{"operationId":"endUserAuthForgotPassword","responses":{"200":{"description":"Always succeeds if reset_url is valid"}},"security":[{"bearerAuth":[]}],"summary":"Request end-user password reset email"}},"/end_user_auth/password/reset":{"post":{"operationId":"endUserAuthResetPassword","responses":{"200":{"description":"Password updated"},"400":{"description":"Invalid or expired token"}},"security":[{"bearerAuth":[]}],"summary":"Complete end-user password reset"}},"/end_user_auth/register":{"post":{"description":"Requires a publishable project key. Returns `sb_eusr_` session token and project legal metadata.","operationId":"endUserAuthRegister","responses":{"201":{"description":"Session token and end user"},"422":{"description":"Validation error"}},"security":[{"bearerAuth":[]}],"summary":"Register end user (publishable keys)"}},"/end_user_auth/session":{"delete":{"operationId":"endUserAuthLogout","parameters":[{"$ref":"#/components/parameters/endUserSessionHeader"}],"responses":{"200":{"description":"Session revoked"},"401":{"description":"Invalid or missing session"}},"security":[{"bearerAuth":[]}],"summary":"Sign out end user"},"post":{"operationId":"endUserAuthSession","responses":{"200":{"description":"Session token"},"401":{"description":"Invalid credentials"}},"security":[{"bearerAuth":[]}],"summary":"Sign in end user (publishable keys)"}},"/end_user_auth/session/refresh":{"post":{"operationId":"endUserAuthRefresh","parameters":[{"$ref":"#/components/parameters/endUserSessionHeader"}],"responses":{"200":{"description":"New session token"},"401":{"description":"Invalid or expired session"}},"security":[{"bearerAuth":[]}],"summary":"Refresh end-user session"}},"/end_users":{"post":{"description":"Advanced trusted-server compatibility route. Requires a secret project key (`sb_test_` or `sb_live_`). Not available to publishable keys; no-backend apps should use `/end_user_auth/checkout`.","operationId":"createEndUserCheckout","responses":{"200":{"description":"Checkout URL and end user id"},"422":{"description":"Stripe not connected (setup_required)"}},"security":[{"bearerAuth":[]}],"summary":"Create end user checkout session (trusted-server secret keys only)"}},"/integration_kit":{"get":{"operationId":"getIntegrationKit","responses":{"200":{"description":"Env and snippets JSON"}},"security":[{"bearerAuth":[]}],"summary":"Integration Kit manifest"}},"/models":{"get":{"operationId":"listModels","responses":{"200":{"description":"OpenAI-compatible model ids"}},"summary":"List models"}}},"servers":[{"url":"https://switchboard.spot/v1"}],"x-publishableRoutes":[{"method":"GET","path":"/v1/models","session_required":false},{"method":"GET","path":"/v1/catalog/models","session_required":false},{"method":"POST","path":"/v1/chat/completions","session_required":true},{"method":"POST","path":"/v1/end_user_auth/register","session_required":false},{"method":"POST","path":"/v1/end_user_auth/session","session_required":false},{"method":"DELETE","path":"/v1/end_user_auth/session","session_required":true},{"method":"POST","path":"/v1/end_user_auth/session/refresh","session_required":true},{"method":"GET","path":"/v1/end_user_auth/me","session_required":true},{"method":"POST","path":"/v1/end_user_auth/password/forgot","session_required":false},{"method":"POST","path":"/v1/end_user_auth/password/reset","session_required":false},{"method":"PATCH","path":"/v1/end_user_auth/password","session_required":true},{"method":"POST","path":"/v1/end_user_auth/checkout","session_required":true},{"method":"POST","path":"/v1/end_user_auth/billing-portal","session_required":true}]}