- Exchange your API key for a JWT token
- Use the JWT token to authenticate all subsequent requests
Obtaining an API key
API keys are provisioned through the Trellis admin dashboard. Contact your organization administrator or reach out to Trellis support to obtain one.Authentication flow
Step 1: Exchange API key for JWT
To start a session, send your API key and the user’s email address to the authenticate endpoint.- cURL
- Python
- JavaScript
If the email address doesn’t exist in your organization, Trellis will automatically create a new user account.
Step 2: Use the JWT token
Include the JWT token in theAuthorization header for all API requests:
Token expiration
JWT tokens expire 6 hours after they are issued. Theexpires_at field in the authentication response tells you exactly when.
When a token expires, you’ll receive a 401 Unauthorized response. Simply re-authenticate to get a new token.
Error responses
| Status | Error | Description |
|---|---|---|
| 400 | Invalid email format | The email address is not properly formatted |
| 401 | Missing X-API-Key header | No API key was provided |
| 401 | Invalid API key | The API key is incorrect or revoked |
| 500 | JWT signing not configured | Server-side configuration error |