App Keys support a three-tier permission system, allowing you to create keys with granular access control:
Read
Query data
Read documents
Access collections
View indexes
Write
Store data
Update documents
Delete documents
Create collections
Admin
Manage indexes
Configure encryption
App-level settings
Full access
When generating an App Key from the Dashboard, you can select any combination of these permissions:
Permission Combination
Use Case
Read only
Public APIs, analytics dashboards
Read + Write
Standard application backend
Read + Write + Admin
Full application management
Write only
Data ingestion pipelines
Create separate keys with minimal permissions for different parts of your application. A read-only key for your frontend proxy and a write key for your backend services.
The App Key (X-App-Key header) is required for all write operations:
Creating documents
Updating documents
Deleting documents
Creating indexes
Creating collections
Managing views
Copy
// App key is automatically included in all requestsconst result = await client.store({ collection: 'posts', data: [{ title: 'Hello World', content: 'My first post' }]});
When you provide a userKey and the user has granted authorization (authz) to the broker, payments happen automatically without requiring payment callbacks.
User keys are generated when users authenticate with your application and grant authorization (authz) to the OnchainDB broker for automatic payments. See Security Settings for details on authz grants.