Guide
Access rules & ownership
Decide for every entity who may list, read, create, change and delete records, down to letting each user see only their own.
Rules per method
Open an entity in the dashboard and go to its endpoint settings. Every method can be turned off completely, or given one of these rules:
| Rule | Who is allowed | Methods |
|---|---|---|
| Public | Anyone with your API key | All |
| User | Any signed-in user (a valid Authorization: Bearer token) | All |
| Owner | Only the user who created the record, and admins | GET, PUT, PATCH, DELETE |
| Admin | Users with the role admin | All |
A request that breaks a rule answers 401 when nobody is signed in and 403 when the signed-in user doesn't have the right role. Sign-in itself is explained in User accounts.
On a Public method a token is optional. Send it anyway when the user is signed in: new records get the user as owner, and ?populate= shows related records only that user may see. A missing or expired token there is ignored.
Record ownership
Every record remembers the signed-in user who created it, returned as ownerId. With the Owner rule:
- Listing (
GET /tasks) returns only the signed-in user's records. - Reading, changing or deleting one record of another user answers
404, as if it didn't exist. - Admins see and change all records.
- On the
usersentity, each user owns their own record, so Owner means "only yourself".
This is what to-do lists, notes, orders and profiles need: one user can never read or edit another user's data. Admins can filter by owner with ?ownerId=USER_ID.
Relations follow the same rules
?populate= only expands a related record when the caller may read that entity. Otherwise the relation stays a plain id.Fields filled in for you
When a signed-in user creates a record, fields with these names are set to that user's id, whatever the request sends. Nobody can create records in someone else's name.
user_id,author_id,created_byuser, when it is a relation field
POST /api/v1/posts
X-API-Key: YOUR_API_KEY
Authorization: Bearer ACCESS_TOKEN
{ "title": "Hello world" }
→ 201 { "id": "…", "title": "Hello world", "author_id": "5b0e…", "ownerId": "5b0e…", … }You don't need such a field for ownership: ownerId is always there. Add one when you want to show the author with ?populate=author_id or filter by it.
Admins
Everybody who signs up gets the role user. To make someone an admin, open the users entity in the dashboard and set their role to admin. Their next sign-in (or token refresh) carries the new role.
Admins pass every rule, including Owner, so use the role only for people who manage the app.
API keys in the browser
Your API key identifies your project. In a frontend app it is part of the code, so anyone can find it. That's expected: the key alone should only open what you made Public.
- Use a publishable key in the frontend. When you create a key, choose Publishable and tick what it may do per entity (read, create, update, delete) and whether it may call custom endpoints. Anything else answers
403withcode: "KEY_SCOPE", even if someone copies the key. Sign-up and login always work. Keep secret keys (full access) on your server. - Protect data with rules, not with the key. Anything that should be private needs User, Owner or Admin.
- Limit keys to your website. In API keys, add your site's addresses as allowed origins. Browsers on other websites are then refused. Tools outside a browser can fake an origin, so this stops copy-paste reuse rather than a determined attacker.
- Use one key per app or environment and turn a key off as soon as you don't need it.
- Keys of other services (Stripe, SendGrid, OpenAI) never belong in the frontend. Store them as project secrets and call the service from a custom endpoint.
Common setups
| App | GET | POST | PUT / PATCH | DELETE |
|---|---|---|---|---|
| Public blog, written by admins | Public | Admin | Admin | Admin |
| Personal to-do list or notes | Owner | User | Owner | Owner |
| Shop products | Public | Admin | Admin | Admin |
| Shop orders | Owner | User | Admin | Admin |
| Comments under posts | Public | User | Owner | Owner |
| Waitlist or contact form | Admin | Public | Admin | Admin |
Need a rule these can't express, such as "only members of this team"? Build it as a custom endpoint with a Check step.