Create a short-lived JWT
https://pyth.dourolabs.app/auth/tokenAn API key, in an Authorization: Bearer <API_KEY> header. An access token cannot create another token.
Creates a short-lived access token, a JWT, from an API key. Servers send the API key directly. Use this endpoint only to give a browser or other untrusted client a short-lived token, so the API key stays on the server: a server calls this endpoint and passes the token to the client.
The Hermes-compatible API does not accept access tokens.
/auth/tokencurl "https://pyth.dourolabs.app/auth/token" \
-H "Authorization: Bearer $PYTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'{
"access_token": "eyJhbGciOiJIUzI1NiJ9.eyJ9.c2ln",
"expires_at": "2026-01-01T00:00:00Z",
"token_type": "Bearer"
}Request body
application/jsonSend a JSON object with these fields.
ttl_secondsinteger | nullOptionalRequested token lifetime, in seconds. The server caps it at its maximum lifetime, and uses the maximum when this field is omitted.
Response
200 · application/jsonReturns a JSON object with the following fields.
access_tokenstringThe access token. For REST requests, send it in the Authorization: Bearer <access_token> header.
expires_atstringToken expiration time as an RFC 3339 date-time string in UTC.
token_typestringThe authentication scheme for this token. Always Bearer.
Status codes returned when a request fails.
- 400
- The Authorization header does not contain a correctly formatted bearer token.
- 401
- Authentication is missing, the API key is invalid, or the request carries an access token instead of an API key.
- 404
- Access token creation is unavailable on this deployment.