Skip to main content

Overview

The ReelMirror API supports two authentication methods:
  1. API keys — For programmatic/server-side access
  2. JWT tokens — For browser-based access via Supabase Auth
Every request must include an Authorization header:
Authorization: Bearer <token>

API Keys

API keys are the recommended way to authenticate programmatic access.

Creating a key

Create an API key from the dashboard or via the API using your JWT token:
curl -X POST https://reelmirror.com/api/v1/api-keys \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Production Key", "scopes": ["personas:read", "content:read"]}'
Response:
{
  "id": "uuid",
  "name": "Production Key",
  "key": "rm_abc123...",
  "scopes": ["personas:read", "content:read"],
  "created_at": "2025-01-01T00:00:00Z"
}
The key field is only returned once at creation time. Store it securely — you cannot retrieve it later.

Key format

API keys follow the format rm_ followed by 32 random characters. Keys are stored as SHA-256 hashes in the database.

Listing keys

curl https://reelmirror.com/api/v1/api-keys \
  -H "Authorization: Bearer YOUR_TOKEN"

Revoking a key

curl -X DELETE https://reelmirror.com/api/v1/api-keys/KEY_ID \
  -H "Authorization: Bearer YOUR_TOKEN"

JWT Tokens

JWT tokens are Supabase session tokens issued when a user signs in via the dashboard. They are primarily used for frontend/browser access. JWT users automatically have all scopes — no scope restrictions apply.

Scopes

API keys can be restricted to specific scopes. If no scopes are specified when creating a key, all scopes except billing:read are granted by default.
ScopeDescription
personas:readRead personas
personas:writeCreate, update, delete personas
sources:readList sources
sources:writeAdd, remove sources
content:readRead content, poll generation status
content:writeGenerate content, clone URLs, toggle public
sync:writeTrigger content sync
billing:readView balance and transactions
uploads:writeUpload avatar images and voice samples

Scope requirements by endpoint

EndpointMethodRequired scope
/v1/api-keysPOST, GET, DELETENone (always allowed)
/v1/personasGETpersonas:read
/v1/personasPOST, PATCH, DELETEpersonas:write
/v1/personas/:id/sourcesGETsources:read
/v1/personas/:id/sourcesPOST, DELETEsources:write
/v1/personas/:id/syncPOSTsync:write
/v1/personas/:id/source-postsGETcontent:read
/v1/personas/:id/generated-postsGETcontent:read
/v1/generatePOSTcontent:write
/v1/clone-urlPOSTcontent:write
/v1/generate/toggle-publicPOSTcontent:write
/v1/sync-jobs/:idGETcontent:read
/v1/generated-posts/:idGETcontent:read
/v1/generated-media-items/:idGETcontent:read
/v1/billing/balanceGETbilling:read
/v1/billing/transactionsGETbilling:read
/v1/uploadsPOSTuploads:write

Rate Limiting

Rate limits are applied per authentication identity:
Auth typeLimit
API key60 requests/minute
JWT120 requests/minute
Rate limit information is included in every response:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-RateLimit-Reset: 1704067260
When the limit is exceeded, the API returns a 429 status with the RATE_LIMITED error code.

Security Best Practices

  • Never expose API keys in client-side code. Use them only in server-side applications.
  • Use the minimum scopes necessary. Create separate keys for different services with only the scopes they need.
  • Rotate keys regularly. Delete old keys and create new ones periodically.
  • Monitor usage. Check last_used_at on your API keys via the list endpoint.