Authentication methods
Hexel supports two credential types: an API key for development and quick scripts, and OAuth client credentials for production services that need scoped, rotatable secrets.
Create both in the Console under IAM → Service Users.
API key
Provide the key and the client handles token exchange and refresh.- Python
- TypeScript
- CLI
- curl
OAuth client credentials
Recommended for production and any server-to-server integration.- Python
- TypeScript
- CLI
- curl
Token exchange flow
1
Provide credentials
Send an API key (
X-API-Key header) or client credentials (grant_type=client_credentials) to POST https://sts.hexelstudio.com/token.2
Receive tokens
STS returns a Bearer token (
access_token) and a refresh token.3
Authenticate requests
Send
Authorization: Bearer <token> on every API request.Token response
string
Short-lived Bearer token. Valid for 15 minutes.
string
Used to obtain a new access token without re-authenticating.
integer
Seconds until the access token expires (900).
string
Always
Bearer.Environment variables
The SDKs and CLI read these automatically:Base URLs
Service endpoints for direct API use. The SDKs and CLI route to these automatically.Common mistakes
- Hardcoding keys in source. Use environment variables or a secret manager.
- Sharing one key across environments. Use a separate key per environment to limit blast radius.
- Using API keys in production services. Prefer OAuth client credentials for server-to-server traffic.
- Embedding keys in client-side code. Credentials must never reach a browser or mobile client.
Best practices
- Rotate keys periodically and immediately if one is exposed.
- Scope credentials to the narrowest workspace and environment needed.
- Store secrets in a managed secret store, not in version control.
- Let the SDKs manage token refresh rather than handling tokens yourself.
Related pages
API Keys
Create and manage API keys.
Service Accounts
Set up OAuth clients for production.
Organizations
How org, workspace, and environment scoping works.
Quickstart
Make your first authenticated request.

