If you don’t have a key yet, see the Build with AI quickstart.
Using API keys
Pass the key as a Bearer token in the Authorization header:- bash
- JavaScript
- Python
sk_test_... for sk_live_... and the same code hits production.
Client secrets
Each session generates a single-use client secret (prefixedcs...) containing an embedded URL, expiration timestamp, and authentication credentials for that specific session. Client secrets are safe to expose to the frontend. API keys must never leave the server.
Create session on backend, pass secret to frontend
Security rules
- API keys: server-side only. Never embed in client code, public repos, or browser environments.
- Client secrets: safe for the frontend, but single-use and short-lived.
- For frontend integration, create sessions on your backend and pass only the client secret URL to the user.
Environments
Both environments share the same base URL (
https://api.facesign.ai). The key prefix is what routes your request into the right environment.
Rate limits
When rate limited, the API returns
429 with a rate_limit_exceeded code. Implement exponential backoff with jitter: 1s, 2s, 4s, and so on.
Retry guidance
- Network errors and
5xxresponses: retry with exponential backoff (up to 3 attempts). 429responses: respect the rate limit window, then retry.4xxresponses (except 429): do not retry. Fix the request.- Media download failures: re-fetch the session to get a fresh URL (they expire after 15 minutes).