Skip to main content

The two keys

Every project gets exactly two API keys when it is created. Both keys are found in Settings in your project dashboard.

How to pass the key

Include the key in the x-api-key request header on every API call:
No other authentication format is accepted for project-level authorization. The header name is lowercase and hyphenated exactly as shown.

Using the publishable key

Use pk_live for all read operations from client-side code. It is safe to bundle in browser JavaScript, React Native apps, or any publicly visible context.
By default, pk_live is blocked from all write operations (POST, PUT, PATCH, DELETE). Attempting a write with only pk_live returns:

Enabling writes with pk_live

You can allow authenticated frontend users to write their own data by enabling Row-Level Security (RLS) on a collection. When RLS is on, pk_live writes are accepted — but only when the request also includes a valid user JWT in the Authorization header, and only for documents the user owns.
See Row-Level Security for the full setup and behavior details.

Using the secret key

Use sk_live for all server-side operations: seeding data, admin scripts, serverless API routes, and any write that happens outside a user’s own browser session.
sk_live bypasses RLS entirely and always has full read and write access on all collections (except /api/data/users*, which is always blocked — use /api/userAuth/* instead).
Never include your sk_live key in frontend code, client-side JavaScript bundles, mobile apps, or any public repository. Treat it like a database password. If it is exposed, rotate it immediately from your project settings.

Environment variable pattern

Store your keys in environment variables and never commit them to source control:

Key behavior summary

A good rule of thumb: use pk_live for everything your users’ browsers do, and sk_live for everything your server does.