All requests to the Toknix API require authentication using your secret API key. Unauthenticated requests or calls with expired credentials return an HTTP 401 Unauthorized response.
Authorization Headers
Depending on which wire format you are calling, provide your key in the standard header:
| Wire Protocol | Header Name | Format Example |
|---|---|---|
| OpenAI Compatible | Authorization | Authorization: Bearer tk_live_... |
| Anthropic Compatible | x-api-key | x-api-key: tk_live_... |
| Universal Fallback | Authorization | Authorization: Bearer tk_live_... |
Universal Bearer Support
Authorization: Bearer tk_live_... across all endpoints, including POST /v1/messages. If your client supports Bearer tokens, you can use it uniformly.API Key Format
Toknix keys are cryptographically random strings prefixed to facilitate automated secret scanning in repositories:
tk_live_7b19a32c0f4981d6e82c5a0b731f92e4860d1e39a5c847e2b10f8491c287a934- Prefix:
tk_live_ - Entropy: 32 bytes (64 hex characters) generated via secure Web Crypto pseudo-random number generator (CSPRNG).
- Storage: Stored securely as SHA-256 hashes on Toknix databases; raw keys are only revealed once upon creation.
Key Rotation
You can provision additional API keys or subkeys from your dashboard at any time. When rotating credentials:
- Generate a new API key in the Toknix console.
- Update your production secrets or environment variables with the new
tk_live_...string. - Verify your traffic operates normally on the new key.
- Delete the retired key from your dashboard.
Revocation
When an API key is deleted or revoked, the revocation propagates to all edge nodes within milliseconds. Any subsequent request using the revoked key will immediately receive:
{
"error": {
"message": "Invalid API key provided. The key has been revoked or does not exist.",
"type": "invalid_request_error",
"param": null,
"code": "invalid_api_key"
}
}