POST /v1/tenants/{tenant_id}/watch
The Watch API establishes a long-lived server-streaming connection and pushes DataChanges events to the client whenever relationship tuples or attributes are written or deleted for the tenant. This is useful for keeping downstream caches, search indexes, or audit logs in sync with Permify’s authorization data.
Requirements
- PostgreSQL database with
track_commit_timestamp = on - Watch service enabled in the Permify configuration:
Enable track_commit_timestamp
Run the following SQL on your PostgreSQL instance:postgresql.conf:
Path Parameters
The tenant identifier. Use
t1 for single-tenant deployments. Must match ^([a-zA-Z0-9_\-@\.:+]{1,128}|\*)$.Request Body
Optional snap token indicating the point in the change stream to start from. Leave empty to receive all new changes going forward.
Response (streaming)
Each streamed message has the following structure:A
DataChanges object describing one or more changes applied in a single transaction.Example (gRPC — Go)
Error Codes
| gRPC Status | Description |
|---|---|
INVALID_ARGUMENT | Missing or invalid request fields |
UNAUTHENTICATED | Missing or invalid credentials |
NOT_FOUND | Tenant not found |
UNAVAILABLE | Watch service is disabled or PostgreSQL is not configured correctly |
INTERNAL | Internal server error |