Skip to main content

Set API rules on a collection

ADMIN GUIDE

Decide who can list, view, create, update and delete the records of a collection.

Who this guide is for

Superusers who protect a collection. You need the collection editor under Collections.

Why it matters

A rule is the only gate between a person and the records. An empty rule opens a collection to everyone, including people who are not signed in.

What you will do, in one sentence

Open the API rules tab, keep each rule locked to superusers, and unlock only the rules you need with a filter.

Screens are captured from a seeded test system. Every name, address and number on the screens is invented. Prepared 15 November 2026.

1. The five rules​

Open Collections, choose a collection, then choose Collection settings (the gear in the page header). Open the API rules tab.

The API rules tab of a collection.The API rules tab of a collection.
The API rules tab of a collection.
RuleControls
List/Search ruleWhich records a person can list or search.
View ruleWhich single record a person can open.
Create ruleWho can add a record.
Update ruleWho can change a record.
Delete ruleWho can remove a record.

A view collection has only List/Search rule and View rule.

2. Locked, open and filtered​

Each rule is in one of three states.

StateWhat you seeWho gets in
LockedThe label shows (Superusers only).Superusers only.
EmptyPlaceholder: Leave empty to grant everyone access...Everyone, signed in or not.
A filterYour expression.People for whom the expression is true.
  1. Choose Unlock and set custom rule to edit a locked rule.
  2. Type a filter, or leave the box empty to open the rule to everyone.
  3. Choose Set superusers only to lock the rule again.
  4. Save the collection.

Example filter: @request.auth.id != "" lets any signed-in account in. Choose Show available fields to see the record fields you can use. You can also use @request.auth.*, @request.body.*, @request.query.*, @request.headers.* and @collection.NAME.*.

An empty rule is public

Empty is not the same as locked. Check each rule before you save. For a collection with personal data, start locked and unlock one rule at a time.

In the Update rule, the record fields hold the old values. To test the new values, use @request.body.*. System collections show the rules but you cannot change them.

3. Extra rules for auth collections​

An auth collection has a button, Additional auth collection rules.

  • Authentication rule runs before every sign-in. Leave it empty to let anyone with an account sign in. A filter such as verified = true allows only verified accounts. Locking it turns sign-in off.
  • Manage rule adds superuser-like power to the create and update rules. A person who passes it can change a password without the old one and set the verified state or the email directly.
Be careful with the Manage rule

Anyone who passes the manage rule can take over the accounts it covers. Give it to as few people as you can.

4. Watch reads of sensitive collections​

Rules decide who may read. The audit log tells you who did. Flag sensitive collections under Settings, Application, Audit log. See the audit log guide.

5. Quick reference card​

Lock a rule​

  1. API rules tab.
  2. Set superusers only.
  3. Save.

Open a rule to signed-in accounts​

  1. Unlock and set custom rule.
  2. Type @request.auth.id != "".
  3. Save.

An empty rule is open to everyone.