Skip to content

API: auth

Status: GA Access: token required API contract: 0.3.0 · capability 2026-09-03.1 View as Markdown Open in Claude Open in ChatGPT

Mint Agent Token

Open as a page →

mint (or rotate) a scoped AGENT token + its contract grants.

Superuser-only. Creates (or reuses) the agent identity and REPLACES its grant pool with body.grants (default-deny — a contract not listed is inaccessible). Changing the pool or capabilities later is a grant edit, no re-mint needed. publish is granted only when listed explicitly: withhold on prod contracts by default).

Auth: Authorization: Bearer <token> required

ParameterInRequiredTypeDescription
Idempotency-KeyheadernostringOptional.

Request body: application/json — schema AgentTokenRequest

FieldTypeRequiredDescription
emailstringno
expires_daysintegerno
full_namestring | nullno
grantsarray of AgentGrantSpecyes
revoke_priorbooleanno

Example:

{
"email": "agent@entherium.dev",
"expires_days": 90,
"full_name": "Partner agent",
"grants": [
{
"capabilities": [
"submit",
"launch",
"cancel",
"edit_config"
],
"salescontract": 40
}
],
"revoke_prior": true
}

Responses:

CodeMeaningBody
200Successful ResponseServiceTokenResponse
401Missing or invalid authentication credentialsErrorResponse
409The e-mail belongs to a non-agent user; refusing to convertErrorResponse
422Validation ErrorHTTPValidationError

Example response (200):

{
"access_token": "eyJhbGciOiJIUzI1NiJ9.<payload>.<signature>",
"api_scope": "agent",
"email": "agent@entherium.dev",
"expires_in": 7776000,
"token_type": "bearer",
"user_guid": 5
}

Login

Open as a page →

OAuth2 password flow. username field is the user’s email.

Auth: no token required

ParameterInRequiredTypeDescription
Idempotency-KeyheadernostringOptional.

Request body: application/x-www-form-urlencoded — schema Body_login_api_v1_auth_login_post

FieldTypeRequiredDescription
client_idstring | nullno
client_secretstring | nullno
grant_typestring | nullno
passwordstringyes
scopestringno
usernamestringyes

Responses:

CodeMeaningBody
200Successful ResponseTokenPair
422Validation ErrorHTTPValidationError

Me

Open as a page →

Auth: Authorization: Bearer <token> required

Responses:

CodeMeaningBody
200Successful ResponseMeResponse
401Missing or invalid authentication credentialsErrorResponse

Example response (200):

{
"email": "agent@entherium.dev",
"full_name": "Partner agent",
"guid": 5,
"is_active": true,
"is_superuser": false,
"is_team": false,
"last_login": "2026-09-03T08:12:41Z"
}

Refresh

Open as a page →

Exchange a refresh token for a new access token.

Auth: no token required

ParameterInRequiredTypeDescription
Idempotency-KeyheadernostringOptional.

Request body: application/json — schema RefreshRequest

FieldTypeRequiredDescription
refresh_tokenstringyes

Example:

{
"refresh_token": "<refresh token from /api/v1/auth/login>"
}

Responses:

CodeMeaningBody
200Successful ResponseAccessOnly
422Validation ErrorHTTPValidationError

Mint Service Token

Open as a page →

Mint (or rotate) a long-lived READ-ONLY access token for an external agent.

Superuser-only. The endpoint can only create/serve users with read-only agent scope — it is structurally unable to hand out full-access tokens. Re-minting reactivates a previously revoked user.

Auth: Authorization: Bearer <token> required

ParameterInRequiredTypeDescription
Idempotency-KeyheadernostringOptional.

Request body: application/json — schema ServiceTokenRequest

FieldTypeRequiredDescription
emailstringno
expires_daysintegerno
full_namestring | nullno
revoke_priorbooleanno

Responses:

CodeMeaningBody
200Successful ResponseServiceTokenResponse
401Missing or invalid authentication credentialsErrorResponse
409The e-mail belongs to an existing non-read-only user; refusing to convertErrorResponse
422Validation ErrorHTTPValidationError

Example response (200):

{
"access_token": "eyJhbGciOiJIUzI1NiJ9.<payload>.<signature>",
"api_scope": "agent",
"email": "agent@entherium.dev",
"expires_in": 7776000,
"token_type": "bearer",
"user_guid": 5
}

Revoke Service Token

Open as a page →

Revoke a read-only service user: deactivate + kill all minted tokens.

Effective immediately — auth re-reads the user row on every request. Only read-only agent identities are addressable here (404 otherwise), so a typo’d guid can never lock out a human/admin account.

Auth: Authorization: Bearer <token> required

ParameterInRequiredTypeDescription
guidpathyesinteger
Idempotency-KeyheadernostringOptional.

Responses:

CodeMeaningBody
204Successful Response—
401Missing or invalid authentication credentialsErrorResponse
422Validation ErrorHTTPValidationError