Authentication
Authenticate your API requests using API keys.
API Keys
All API requests require authentication via an API key. You can generate API keys from the Ssemble dashboard — click your profile icon and select API Keys.
API keys are prefixed with sk_ssemble_ and should be kept secret. Do not expose them in client-side code or public repositories.
Generating an API key
- Sign in to the Ssemble dashboard
- Click your profile icon in the top-right corner and select API Keys
- Click Generate New Key
- Copy the key immediately — it won't be shown again
- Store the key securely in your environment variables
You can generate multiple API keys for different applications or environments. Each key is tied to your account and shares the same credit balance and rate limits.
Passing the API key
Include your API key in every request header using either format:
X-API-Key header (recommended)
Authorization Bearer header
Both formats are fully supported. The X-API-Key header is recommended because it avoids confusion with other Bearer token systems (like OAuth).
Authentication errors
The API returns specific error codes depending on the authentication issue:
Missing API key (401)
No X-API-Key or Authorization header was included in the request.
Invalid API key (401)
The key doesn't start with sk_ssemble_, has an incorrect length, doesn't match any active key, or has been revoked.
Subscription required (403)
The account associated with the API key does not have an active subscription.
Insufficient credits (403)
The account has no remaining credits. Each short creation request consumes 1 credit.
Error codes summary
| Status | Code | Cause |
|---|---|---|
| 401 | missing_api_key | No API key header provided |
| 401 | invalid_api_key | Key format is wrong, key not found, or key revoked |
| 403 | subscription_required | No active subscription on the account |
| 403 | insufficient_credits | No credits remaining |
Rate limit headers
Every API response includes rate limit information in the headers, regardless of whether the request succeeded or failed:
| Header | Type | Description |
|---|---|---|
X-RateLimit-Limit-Hour | number | Maximum requests allowed per hour |
X-RateLimit-Remaining-Hour | number | Remaining requests this hour |
X-RateLimit-Limit-Day | number | Maximum requests allowed per day |
X-RateLimit-Remaining-Day | number | Remaining requests this day |
X-RateLimit-Reset | string | ISO 8601 timestamp when the hourly limit resets |
Reading rate limit headers
See Rate Limits for details on limits per endpoint.
Security best practices
-
Environment variables — Store API keys in environment variables (
SSEMBLE_API_KEY), never hardcode them in source code. -
Server-side only — Never use API keys in client-side JavaScript (browser code). Make API calls from your backend server.
-
Separate keys — Use different API keys for development and production environments. This makes it easy to rotate or revoke keys without affecting all environments.
-
Rotate periodically — Generate new keys and revoke old ones periodically from the dashboard.
-
Monitor usage — Check your API usage and credit consumption from the Ssemble dashboard to detect unexpected activity.
-
Git safety — Add
.envfiles to your.gitignoreto prevent accidentally committing API keys to version control.
