- Define permissions (like
documents.read,billing.write) - Group permissions into roles (like
admin,editor,viewer) - Attach roles or permissions directly to keys
- Check permissions during verification
When to use this
Multi-tenant SaaS
Different customers get different feature access. Enterprise keys can do more than free-tier keys.
Team permissions
Admin keys can delete resources, editor keys can modify, viewer keys can only read.
Feature flags
Only keys with
beta.access permission can use new features.Resource scoping
Keys can only access specific resources:
project.123.read, project.456.write.How it works
Define permissions
Create permissions that map to actions in your app:
documents.read, documents.write, users.delete.Create roles (optional)
Group permissions into roles for easier management. An
editor role might include documents.read and documents.write.Quick example
Permissions vs Roles
| Concept | What it is | Example |
|---|---|---|
| Permission | A specific action | documents.read, billing.manage |
| Role | A group of permissions | admin = all permissions, viewer = read-only permissions |
- Attach roles when you want predefined access levels
- Attach permissions directly for fine-grained control

