Trillet AI logo

API keys and workspace authentication

Authenticate Trillet API requests with an API key in the x-api-key header and a workspace ID in x-workspace-id. How to create keys and keep them secure.

Trillet API requests use API keys and workspace authentication: send your API key in the x-api-key header and the workspace ID in the x-workspace-id header on every request.

curl https://api.trillet.ai/v1/api/workspaces \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-workspace-id: YOUR_WORKSPACE_ID" \
  -H "Content-Type: application/json"
x-api-keystringrequired

API key for the call. Generate it in the Trillet settings dashboard.

x-workspace-idstringrequired

Workspace the request applies to. Required on customer API calls.

Content-Typestring

Set to application/json when you send a JSON body. File uploads use multipart/form-data. Leave it off requests with no body, such as DELETE: an empty body sent as application/json is rejected with 400.

Authorization: Bearer carries dashboard session tokens and connected-app (OAuth) tokens. Voice Engine partner keys (tpk_...) also use Authorization: Bearer. Your API key belongs in x-api-key.

Obtaining API Keys

Generate an API key under the Settings tab.

An API key belongs to the user who created it. It has no permissions or limits of its own: every request made with it acts as that user, with that user's role, in whichever workspace x-workspace-id names. The key works in every workspace the user belongs to. If the user isn't a member of the workspace you name, the request fails with 403.

To limit what an integration can do, create a dedicated team member with a narrow role in the workspaces it needs, and generate the key while signed in as that user.

Get your API key from the Trillet Settings Dashboard.

Security Best Practices

  1. Keep API keys on your server. A browser or mobile app should use a short-lived SDK token from Create SDK Token.
  2. Rotate API keys periodically.
  3. Use different API keys for development and production.
  4. Watch key usage for unexpected traffic.

Last updated on