Skip to content
Select themeSelect language

GET /api/oauth/:provider/callback — provider redirects here after user authorizes

GET
/api/oauth/{provider}/callback
curl --request GET \
--url 'https://example.com/api/oauth/example/callback?state=example'
provider
required
string

OAuth provider name (e.g. anthropic, openai, google, copilot, openrouter)

code
string

Optional so a provider denial / stale-reload (which reaches the server-hosted callback without a code) yields the friendly ?oauth_error= page instead of a raw 400 from the extractor. The handler rejects an absent/blank code before use. (OpenRouter is the first provider to actually exercise this callback in prod.)

state
required
string

Redirect to settings page on success or with error query parameter

Structured client error

Media typeapplication/json

The canonical JSON body of every error response — the single source of truth the frontend binds to. Every AppError serializes as this exact shape, and the generated OpenAPI component ApiErrorBody (with its ErrorCode enum) is what the frontend error schema is generated from, so there is no hand-written error schema on either end.

object
code
required

Machine-readable, stable error code.

string
Allowed values: not_found unauthorized forbidden bad_request unprocessable precondition_failed conflict method_not_allowed rate_limited quota_exceeded database_error docker_error vault_error internal_error
details
One of:
null
error
required

Human-readable message (the server’s English text; the client may localize by code).

string
Example
{
"code": "not_found"
}

Structured server error

Media typeapplication/json

The canonical JSON body of every error response — the single source of truth the frontend binds to. Every AppError serializes as this exact shape, and the generated OpenAPI component ApiErrorBody (with its ErrorCode enum) is what the frontend error schema is generated from, so there is no hand-written error schema on either end.

object
code
required

Machine-readable, stable error code.

string
Allowed values: not_found unauthorized forbidden bad_request unprocessable precondition_failed conflict method_not_allowed rate_limited quota_exceeded database_error docker_error vault_error internal_error
details
One of:
null
error
required

Human-readable message (the server’s English text; the client may localize by code).

string
Example
{
"code": "not_found"
}