ThoughtBox Auth API
The auth API from ThoughtBox — 14 operation(s) for auth.
The auth API from ThoughtBox — 14 operation(s) for auth.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/thoughtbox-ai:thoughtbox-ai-auth-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: ThoughtBox Auth API
description: Document proxy and AI chat platform with MCP support
version: 0.1.0
tags:
- name: Auth
paths:
/api/auth/me:
get:
tags:
- Auth
summary: Me
description: Return the current user's identity from their JWT claims.
operationId: me_api_auth_me_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
security:
- HTTPBearer: []
/api/auth/link-external-identity:
post:
tags:
- Auth
summary: Link External Identity Endpoint
description: 'Link an external application''s identity (MPC today; any third-party
app per thoughtbox#227''s design) to the caller''s native ThoughtBox
account. The one real chokepoint for thoughtbox#55: only reachable with
a genuine, currently-held native ThoughtBox Cognito session or its
cookie-backed equivalent (thoughtbox#228) — never with a tenant-issued
credential of any kind — so no tenant admin can trigger this on a
user''s behalf.
thoughtbox#229: a durable session means a kiosk mistake is no longer
self-correcting the way a one-shot pick was — link_mpc_identity''s
steal-on-relink behavior (moving the (tenant, mpc_sub) pair off
whichever account held it) is only safe as an *immediate* consequence
of #151''s fresh-login proof, not as a silent background effect of an
ambient session someone left signed in. So this distinguishes outcomes
instead of always linking: already linked to the caller (no-op, falls
through to the existing path below), linked to a *different* ThoughtBox
account (stops, conflict=True), or a genuine first link — never linked
to anyone — made with only an *ambient* cookie session rather than a
fresh Bearer obtained in this window (stops too, same conflict=True
shape, different conflict_reason). Either stop requires the caller to
already have confirm_relink=True on this exact request.
PR #239 review: the first-link case was originally missing entirely —
an ambient cookie silently bound a brand-new external identity to
whichever account held it, on a shared machine, with no interactive
step at all. That''s exactly the risk the removed forced-login-every-
open gate existed to prevent, for the one case the original conflict
check didn''t cover (it only fired for an *already*-linked pair).'
operationId: link_external_identity_endpoint_api_auth_link_external_identity_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/LinkExternalIdentityRequest'
required: true
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/LinkExternalIdentityResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
security:
- HTTPBearer: []
/api/auth/native-session:
post:
tags:
- Auth
summary: Create Native Session Endpoint
description: 'Mint a durable, ThoughtBox-origin cookie session from a freshly
completed native Cognito login.
thoughtbox#229: JSON in, JSON out — a plain fetch() call, not the
original #228 spike''s hidden-form-and-redirect trick. That trick
existed only because credentialed cross-origin fetch didn''t work yet;
now that CORS allows it (this same issue), a redirect response is just
awkward for a caller (AuthProvider, on every native login — see
components/AuthProvider.tsx) that wants to stay on the same page.'
operationId: create_native_session_endpoint_api_auth_native_session_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/NativeSessionExchangeRequest'
required: true
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/auth/native-session/tokens:
post:
tags:
- Auth
summary: Native Session Tokens
description: 'thoughtbox#678: Cognito ID and access tokens for the person whose
cookie this is, so a tab with nothing in sessionStorage (a relaunched
home-screen app, a new tab) is signed in without a password.
The refresh token stays here; only the short-lived tokens go back, the
same ones a login leaves in sessionStorage. A refresh keeps the
original auth_time, so these never count as a fresh login
(_is_fresh_login). GlobalSignOut revokes the stored refresh token, and
sign-out and password change revoke the session row, so either one
ends restores.'
operationId: native_session_tokens_api_auth_native_session_tokens_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
/api/auth/native-session/signout:
post:
tags:
- Auth
summary: Native Session Signout
description: 'Revoke the caller''s native session, if any, and clear the cookie.
Reads the cookie directly rather than depending on get_current_user —
there is no Bearer for a cookie-only session, and sign-out should
succeed even against an already-expired session (it just reports
nothing was revoked in the audit log).
No Origin check here (thoughtbox#229: considered and deliberately not
added alongside the CORS change — traced through every case it could
add protection in and found none SameSite=Lax + the CORS allowlist
don''t already cover). The only state a forged cross-site call could
change is signing the legitimate user out, which is unwanted but not
harmful.'
operationId: native_session_signout_api_auth_native_session_signout_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
/api/auth/sessions/revoke-others:
post:
tags:
- Auth
summary: Revoke Other Sessions Endpoint
description: 'Revoke every native session for the caller except the one (if any)
on this same request — the server side of ASVS 3.3.1''s "a password
change invalidates every other session" guarantee.
thoughtbox#228 wave 2: password change itself still goes straight
from the browser to Cognito (`lib/auth.ts`''s `changePassword`) — the
backend-owned login that would let it happen server-side, where this
could just be folded in, isn''t built yet. Until then, this is a
second call the frontend makes right after Cognito''s own call
succeeds. Deliberately its own endpoint rather than bolted onto
something else: nothing about it depends on *why* the caller wants
every other session gone, so it also works standing alone if a
"sign out everywhere" affordance shows up before BFF login does.'
operationId: revoke_other_sessions_endpoint_api_auth_sessions_revoke_others_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
security:
- HTTPBearer: []
/api/auth/profile:
get:
tags:
- Auth
summary: Get Profile
operationId: get_profile_api_auth_profile_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
security:
- HTTPBearer: []
put:
tags:
- Auth
summary: Update Profile
operationId: update_profile_api_auth_profile_put
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ProfileUpdate'
required: true
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
security:
- HTTPBearer: []
/api/auth/avatar:
post:
tags:
- Auth
summary: Upload Avatar
description: Upload a custom avatar image (max 2 MB, JPEG/PNG/GIF/WebP).
operationId: upload_avatar_api_auth_avatar_post
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/Body_upload_avatar_api_auth_avatar_post'
required: true
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
security:
- HTTPBearer: []
delete:
tags:
- Auth
summary: Delete Avatar
description: Remove the custom avatar (reverts to Gravatar).
operationId: delete_avatar_api_auth_avatar_delete
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
security:
- HTTPBearer: []
/api/auth/avatar/keep:
post:
tags:
- Auth
summary: Keep Avatar
description: 'Keep the picture we picked: "We picked this for you" goes away (#617).'
operationId: keep_avatar_api_auth_avatar_keep_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
security:
- HTTPBearer: []
/api/auth/avatar/make:
post:
tags:
- Auth
summary: Make Avatar
description: 'Make a picture to try (#617): "tell us what you want to look like", optionally with an inspiration picture.'
operationId: make_avatar_api_auth_avatar_make_post
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/Body_make_avatar_api_auth_avatar_make_post'
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
security:
- HTTPBearer: []
/api/auth/avatar/use:
post:
tags:
- Auth
summary: Use Avatar
description: Use a picture /avatar/make made for this user.
operationId: use_avatar_api_auth_avatar_use_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UseAvatar'
required: true
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
security:
- HTTPBearer: []
/api/auth/set-slack-tenant-default:
post:
tags:
- Auth
summary: Set Slack Tenant Default Endpoint
description: 'Registers the tenant-default Slack identity (mpcentral#936) — the
fallback attribution for every inbound Slack message with no individual
link of its own. Called directly by the mpcentral admin''s own browser
session, exactly the way every other tenant-local ThoughtBox call
already works (aiCompletionService.ts''s streamThoughtBoxCompletion et
al.) — no /connect, no ThoughtBox Central, no identity-linking step.
There is nothing to *link* here: a tenant-local mpcentral deployment''s
ThoughtBox container is configured with that same tenant''s own Cognito
pool as its native login (assistant.ts injects COGNITO_USER_POOL_ID =
auth.userPool.userPoolId — the identical pool mpcentral''s frontend
itself authenticates against), so an mpcentral admin''s own Cognito ID
token already *is* a legitimate native login here, not a separate
"MPC identity" that needs bridging to a distinct "ThoughtBox identity."
The earlier version of this endpoint assumed a split-plane topology
(a separate central ThoughtBox account requiring /connect + forced
re-login) that doesn''t describe this deployment shape at all — caught
live, 2026-08-23, mpcentral#936.
The default identity is deliberately picked, not the calling admin by
default (2nd revision, caught live 2026-08-24): the tenant-default
identity answers every unattributed Slack message, so defaulting it to
whichever admin happened to click the button hands cloud-admin-level
context to arbitrary Slack senders — an under-privileged account should
usually be picked instead. require_admin (not get_current_user) gates
this precisely because it now lets the caller name a DIFFERENT account:
naming an arbitrary existing account here is not a privilege escalation
for an admin who can already create/delete/reset-password any account
in this same pool — but it must still be restricted to admins, since a
non-admin naming an arbitrary account would be new exposure.
mpc_tenant_id comes from this container''s own configured
cognito_user_pool_id, never a client-supplied value — matches slack.ts''s
own documented convention for MPC_TENANT_ID (the pool ID used as an
opaque tenant-scoping string) and how /internal/slack-completion already
trusts a plain mpc_tenant_id once its own auth passes. target_cognito_sub/
target_email are trustworthy specifically because this is the monolith
deployment shape: they come from mpcentral''s own admin-authenticated
Cognito ListUsers call against this exact same pool, not arbitrary
unverified client input asserting a foreign identity.'
operationId: set_slack_tenant_default_endpoint_api_auth_set_slack_tenant_default_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/SetSlackTenantDefaultRequest'
required: true
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/SetSlackTenantDefaultResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
security:
- HTTPBearer: []
/api/auth/slack-tenant-default:
get:
tags:
- Auth
summary: Get Slack Tenant Default Endpoint
description: 'Live status for the tenant-default Slack identity -- the read side of
set_slack_tenant_default_endpoint above. Queried directly rather than
cached, so the admin panel can''t drift from what actually resolves an
inbound Slack message (see get_slack_tenant_default''s docstring for the
drift this replaces). Same mpc_tenant_id derivation and require_admin
gate as the POST for consistency, even though a GET here is lower
stakes than naming an arbitrary account.'
operationId: get_slack_tenant_default_endpoint_api_auth_slack_tenant_default_get
security:
- HTTPBearer: []
parameters:
- name: slack_team_id
in: query
required: true
schema:
type: string
title: Slack Team Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/SlackTenantDefaultStatus'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/auth/account:
delete:
tags:
- Auth
summary: Delete Own Account
description: Self-serve account deletion. Removes the Cognito user and all DB data.
operationId: delete_own_account_api_auth_account_delete
responses:
'204':
description: Successful Response
security:
- HTTPBearer: []
components:
schemas:
UseAvatar:
properties:
path:
type: string
title: Path
type: object
required:
- path
title: UseAvatar
SetSlackTenantDefaultResponse:
properties:
ok:
type: boolean
title: Ok
default: true
type: object
title: SetSlackTenantDefaultResponse
LinkExternalIdentityResponse:
properties:
linked:
type: boolean
title: Linked
conflict:
type: boolean
title: Conflict
default: false
conflict_reason:
anyOf:
- type: string
- type: 'null'
title: Conflict Reason
external_email:
anyOf:
- type: string
- type: 'null'
title: External Email
thoughtbox_email:
anyOf:
- type: string
- type: 'null'
title: Thoughtbox Email
tenant_id:
anyOf:
- type: string
- type: 'null'
title: Tenant Id
type: object
required:
- linked
title: LinkExternalIdentityResponse
ProfileUpdate:
properties:
display_name:
type: string
maxLength: 255
minLength: 1
title: Display Name
full_name:
anyOf:
- type: string
maxLength: 255
- type: 'null'
title: Full Name
default_storage:
anyOf:
- type: string
maxLength: 50
- type: 'null'
title: Default Storage
default_ai:
anyOf:
- type: string
maxLength: 50
- type: 'null'
title: Default Ai
default_email_provider:
anyOf:
- type: string
maxLength: 50
- type: 'null'
title: Default Email Provider
type: object
required:
- display_name
title: ProfileUpdate
SlackTenantDefaultStatus:
properties:
registered:
type: boolean
title: Registered
email:
anyOf:
- type: string
- type: 'null'
title: Email
type: object
required:
- registered
title: SlackTenantDefaultStatus
NativeSessionExchangeRequest:
properties:
id_token:
type: string
title: Id Token
refresh_token:
anyOf:
- type: string
- type: 'null'
title: Refresh Token
type: object
required:
- id_token
title: NativeSessionExchangeRequest
SetSlackTenantDefaultRequest:
properties:
slack_team_id:
type: string
title: Slack Team Id
target_cognito_sub:
type: string
title: Target Cognito Sub
target_email:
type: string
title: Target Email
type: object
required:
- slack_team_id
- target_cognito_sub
- target_email
title: SetSlackTenantDefaultRequest
Body_upload_avatar_api_auth_avatar_post:
properties:
file:
type: string
contentMediaType: application/octet-stream
title: File
type: object
required:
- file
title: Body_upload_avatar_api_auth_avatar_post
LinkExternalIdentityRequest:
properties:
external_token:
type: string
title: External Token
confirm_relink:
type: boolean
title: Confirm Relink
default: false
type: object
required:
- external_token
title: LinkExternalIdentityRequest
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
input:
title: Input
ctx:
type: object
title: Context
type: object
required:
- loc
- msg
- type
title: ValidationError
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
Body_make_avatar_api_auth_avatar_make_post:
properties:
wanted:
type: string
title: Wanted
default: ''
inspiration:
anyOf:
- type: string
contentMediaType: application/octet-stream
- type: 'null'
title: Inspiration
type: object
title: Body_make_avatar_api_auth_avatar_make_post
securitySchemes:
HTTPBearer:
type: http
scheme: bearer