- Config file - Update your config and restart the service
- API endpoint - Deploy at runtime without restarting
During deployment, existing sync rules continue serving clients while new
rules process. Clients seamlessly transition once initial
replication
completes.
Option 1: Config File (Recommended)
Define sync rules in yourpowersync.yaml either inline or via a separate file. See Self-Hosted Instance Configuration for the full config reference and Sync Rules for syntax.
1
Edit Config
Update the
sync_rules section in your powersync.yaml:2
Restart Service
Restart your service to apply changes:Once the service starts up, it will load the updated sync rules and begin processing them while continuing to serve existing rules until initial replication completes.
Option 2: Deploy via API
Deploy sync rules at runtime without restarting. Useful for quick iterations during development.1
Configure API Token
Add an API token to your
powersync.yaml and restart:powersync.yaml
2
Deploy Sync Rules
/api/sync-rules/v1/validate first to check for errors without deploying.Additional Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/sync-rules/v1/current | GET | Get active and pending sync rules |
/api/sync-rules/v1/reprocess | POST | Restart replication from scratch |
Troubleshooting
Common errors when using the API:| Error Code | Meaning |
|---|---|
PSYNC_S4105 | Sync rules defined in config file - API is disabled |
PSYNC_S4104 | No sync rules deployed yet |
PSYNC_R0001 | Invalid sync rules YAML - check details field |