Get started
Authentication
Authenticate server-side requests with a Sera Studio API key.
Create and manage API keys in the Sera Studio API console. Every key starts with sera_sk_.
Authorization header
Send the key as a Bearer token in the Authorization header of every request:
Authorization: Bearer sera_sk_...curl https://serastudio.app/api/v1/siren/estimate \
-H "Authorization: Bearer $SERA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"resolution": "720p", "source_duration_s": 9.4}'The word Bearer is not case-sensitive. A key sent without it, or with another scheme, returns api_key_missing.
Permissions
Every key created in the console has all three permissions: read (estimates, get and list generations, uploads, balance, models), create (uploads, generations, cancel) and delete (delete generations and uploads). A request that needs a permission the key lacks returns 403 insufficient_scope.
Create a key
- Open API keys and select Create API key.
- Enter a name of up to 100 characters.
- To make the key expire, turn on Set expiration date and choose 1 day, 7 days, 30 days, 90 days, 180 days or 1 year. If you leave it off, the key never expires.
- Select Create key and copy the key. The console shows the full key only once. After that, it stores just a hash of the key and a few characters from its start and end.
Who can manage keys
Keys belong to a workspace. The workspace owner and admins can create, edit, disable and delete keys. Editors and viewers can see the key list but cannot change it. See Workspaces.
Disable or delete a key
Owners and admins manage a key from its actions menu in the key list. Disable turns off an active key, and Enable turns a disabled key back on. Delete removes a key permanently. A key stops working on the next request after you disable or delete it, or after it expires.
Keep keys on your server
- Keep the key in a secrets manager or in a server-side environment variable such as
SERA_API_KEY. - Never put the key in browser or mobile app code, URLs, logs or screenshots, and never commit it.
- If a key may have leaked, create a new key and delete the old one.
Authentication errors
| Status | Code | Message | Fix |
|---|---|---|---|
401 | api_key_missing | No API key was sent. | Send the key as Authorization: Bearer sera_sk_... |
401 | api_key_invalid | The API key is not valid. | Check the key or create a new one in the console. |
401 | api_key_revoked | The API key was revoked. | Create a new key in the console. |
401 | api_key_disabled | The API key is turned off. | Turn the key back on in the console or use another key. |
401 | api_key_expired | The API key has expired. | Create a new key in the console. |
403 | workspace_forbidden | The workspace that owns this key cannot make requests right now. | |
503 | temporarily_unavailable | The request could not be checked right now. | Send the same request again in a few seconds. |
Every response from an endpoint, errors included, carries a Request-Id header. See Errors and retries.