Skip to main content

POST /auth/api/token

Issue a new access + refresh token pair.

Exchange the API key for a short-lived accessToken (used on every other endpoint) and a refreshToken. Call once at process boot, not per-request.

Use case

Service startup: read API_KEY from secrets, call this, cache accessToken in memory, persist refreshToken for restarts.

Headers

HeaderRequiredDescription
x-api-keyyesYour client API key.

Body

None.

Response 200

{
"accessToken": "<jwt>",
"refreshToken": "<string>",
"expiresIn": 900,
"tokenType": "Bearer"
}
FieldDescription
accessTokenJWT to send as Authorization: Bearer … on every other request.
refreshTokenUse on POST /auth/api/refresh.
expiresInAccess-token lifetime in seconds.
tokenTypeAlways Bearer.

Errors

StatusMeaning
401Missing x-api-key.
403API key invalid or inactive.

Example

curl -X POST "$BASE_URL/auth/api/token" \
-H "x-api-key: $API_KEY"