Event reference
Every catalog change records an event in the same database transaction as the change and its audit record. If the change is saved, so is the event; if it fails, neither exists.
Events drive workflows, rules, and extension event handlers. They are not exposed as a public feed.
Event types
Section titled “Event types”| Type | Recorded when |
|---|---|
record.created.v1 |
A record is created. |
record.updated.v1 |
A record’s values, relationships, system tags, or system metadata change in a save (PUT /v1/records/{id}). Editing values through POST /records/{id}/values or acli value emits attribute_value.changed.v1 instead, and a change to files or relationships alone has its own event, so to hear about every value change subscribe to those too. |
record.annotations_changed.v1 |
An extension changes the record tags or metadata in its own namespace. |
record.deleted.v1 |
A record is deleted. |
record.migrated.v1 |
A record moves to a newer blueprint revision. |
record.published.v1 |
A record is published to a channel. |
record.unpublished.v1 |
A record’s publication is withdrawn. |
attribute_value.changed.v1 |
An attribute value is set, replaced, or removed. |
attribute_value.restored.v1 |
A value is restored from history. |
relationship.changed.v1 |
Relationship targets are added or removed. |
blueprint.created.v1 |
A blueprint is created. |
blueprint.revision_created.v1 |
A new blueprint revision is drafted. |
blueprint.published.v1 |
A blueprint revision is published. |
context.created.v1, context.updated.v1, context.deleted.v1 |
A context changes. |
export.retry_requested.v1 |
An operator asks an export extension to push a record again. |
Extensions publish their own types, named plugin.<extension-id>.<name>.vN. The record, attribute_value, relationship, blueprint, context, and export namespaces are reserved.
A version suffix never changes meaning. An incompatible payload gets a new .vN type, and consumers subscribe to the exact versions they understand.
Envelope
Section titled “Envelope”| Field | Description |
|---|---|
id |
Event UUID. Use it to deduplicate. |
event_type |
Such as record.updated.v1. |
occurred_at |
When the change was saved. |
aggregate_kind, aggregate_id |
What changed, such as record and its UUID. |
correlation_id |
Shared by everything that came from one request or job. |
causation_id |
The event that directly caused this one, if any. |
source_kind |
api, worker, plugin, or system. |
source_name |
Which producer, such as a workflow (workflow:<id>) or extension (extension:<extension-id>). |
metadata, payload |
JSON objects, each up to 64 KiB. |
Record payloads
Section titled “Record payloads”Record and value events describe what changed, not the whole record:
{ "record_id": "7f1c…", "blueprint_id": "a2d4…", "blueprint_version": 3, "facts": [{ "attribute_id": "c9e0…", "attribute_code": "price", "context_id": "00000000-0000-4000-8000-000000000001", "context_code": "default", "relationship_target_record_id": null, "change_kind": "set", "before_value": 49.0, "after_value": 39.0 }]}To act on the record’s current state, read it; the payload is only a description of the change.
Which changes produce facts
Section titled “Which changes produce facts”facts contains one entry per attribute value that actually changed. A save that leaves a value as it was adds no fact for it. Workflow triggers can filter on attribute_code with attributes and on change_kind with change_kinds.
- Scalar attributes:
change_kindisset,replace, orremove;restoreonattribute_value.restored.v1.record.created.v1lists every initial value, including defaults and generated values, asset. - Relationship attributes: each added or removed target is its own fact, with
change_kindrelationship_addorrelationship_remove,relationship_target_record_idset, and the target ID as the value. A save that only changes relationships recordsrelationship.changed.v1; one that also changes other values recordsrecord.updated.v1. - File attributes: uploading, linking, reordering, or removing files records
attribute_value.changed.v1with one fact for the attribute.change_kindisset,replace, orremove, and the values are the ordered lists of file IDs. - System tag and system metadata changes are not attribute values and add no fact. Instead,
record.created.v1andrecord.updated.v1list the system tags the save added intags_addedand the ones it removed intags_removed. Each is left out when empty. Workflow triggers can filter on them. - Migrations:
record.migrated.v1has nofacts. Its payload names the record, its blueprint,source_version,target_version, andmigration_id. When the migration dropped or re-pointed a relationship,released_relationshipslists the targets the record no longer points to, asattribute_codeandtarget_record_ids(at most 100 per relationship and 1,000 per event).
Extension annotation changes
Section titled “Extension annotation changes”record.annotations_changed.v1 is recorded when an extension, or an operator repairing its namespace, changes the system tags or metadata the extension owns on a record. Its aggregate is the record, and its payload is:
{ "record_id": "7f1c…", "blueprint_id": "a2d4…", "blueprint_version": 3, "extension_id": "acme.enrich", "revision": 4, "tags_added": ["reviewed"], "tags_removed": [], "metadata_keys_set": ["score"], "metadata_keys_removed": []}Tags and keys are the extension’s local names, without the <extension-id>: prefix. revision counts the namespace’s changes on that record. An operator repair that replaces a malformed namespace value also adds replaced_namespace_value. These changes do not record record.updated.v1.
Export retry requests
Section titled “Export retry requests”export.retry_requested.v1 is recorded once per record when someone retries an export. Its aggregate is the record, and its payload is:
{ "record_id": "7f1c…", "extension_id": "acme.shopify", "connection": "shop-eu" }connection is null for the extension’s default destination. Only the extension named in extension_id receives it, and only if one of its handlers subscribes to the type.
Delivery guarantees
Section titled “Delivery guarantees”- At least once. A consumer can receive the same event twice, for example if it crashes after doing its work but before the delivery is recorded. Make handlers idempotent, keyed on the event ID.
- Unordered. Events can arrive in a different order from the one they were recorded in.
- From now on. A new consumer starts at the current position and does not receive older events.
- Retries. A failed delivery is retried after 1, 2, 4, … seconds, up to 60, and becomes a dead letter after five attempts. These are the defaults; see Background work.
See Monitoring for finding and replaying dead letters.