Skip to content

POST /api/v1/auth/service-token

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 Service Token

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

Terminal window
curl -sS -X POST "https://entherium.duckdns.org:8443/api/v1/auth/service-token" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"email":"<email>","expires_days":"<expires_days>","full_name":"<full_name>","revoke_prior":"<revoke_prior>"}'
{
"access_token": "eyJhbGciOiJIUzI1NiJ9.<payload>.<signature>",
"api_scope": "agent",
"email": "agent@entherium.dev",
"expires_in": 7776000,
"token_type": "bearer",
"user_guid": 5
}

ServiceTokenResponse — Successful Response

FieldTypeDescription
access_tokenstring
api_scopestring
emailstring
expires_ininteger
token_typestring (opt.)
user_guidinteger
ParameterInRequiredTypeDefaultConstraintsDescription
Idempotency-Keyheadernostring—uuidOptional.
FieldTypeRequiredDescription
emailstringno
expires_daysintegerno
full_namestring | nullno
revoke_priorbooleanno
CodeMeaningBody
401Missing or invalid authentication credentialsErrorResponse
409The e-mail belongs to an existing non-read-only user; refusing to convertErrorResponse
422Validation ErrorHTTPValidationError

Every error body is {detail, code?, request_id, doc_url} — request_id is the value to quote, doc_url points at the Errors reference.