Transaction annotations allow you to attach metadata to database changes. When you set annotations, all change messages following the annotation will include the annotations in their metadata.Documentation Index
Fetch the complete documentation index at: https://sequinstream.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Protocol
Set annotations inside a transaction using the functionpg_logical_emit_message:
Message prefixes
| Prefix | Description |
|---|---|
sequin:transaction_annotations.set | Sets annotations for all following changes in the current transaction |
sequin:transaction_annotations.clear | Clears annotations for all following changes in the current transaction |
Behavior
Scope
- Annotations are transaction-scoped
- They apply to all changes following the annotation within the transaction
- Setting new annotations overwrites previous annotations in the same transaction
Limitations
- Must be valid JSON
- Cannot be set outside a transaction
Message format
Annotations appear in themetadata.transaction_annotations field of messages:
null.
Examples
Setting annotations
Clearing annotations
Overwriting annotations
Related
Payloads reference
Learn about message shapes and how annotations appear in messages.
How to annotate changes
Step-by-step guide on adding annotations to your database changes.
Create audit logs
Learn how to use annotations to create rich audit logs.

