Hook Events
Foir emits an event whenever something happens that another system might need to know about — a record is published, a user signs up, a subscription lapses. Subscribe to an event with a hook, and Foir delivers it to an operation you own.
This page is the complete catalogue: every event Foir emits, what produces it, and exactly what arrives in the body. For how to wire a receiver and verify a delivery, see Webhooks; for the hook itself, see Lifecycle Hooks.
What arrives
Each event carries a flat set of keys describing one thing that happened. When the hook runs an operation, those keys arrive as input on the OperationPayload your endpoint receives — so RECORD_PUBLISHED’s recordId is payload.input.recordId, not payload.recordId. The rest of the envelope, and how to verify a delivery, is under Webhooks.
Five properties are worth knowing before you write a handler.
The payload is a fact, not a query result. It describes the state at the moment the event happened. It does not carry the resource’s current state, and for most events it does not carry the resource’s content at all — it carries enough to identify what changed so you can read it back under your own credentials.
Filters match these keys. A hook filter such as { "modelKey": "post" } is matched against the top-level keys listed for each event below. A key the payload does not carry is treated as no constraint, so filtering on a key that is not in the table below will not narrow anything.
Deliveries are not ordered. Two events about the same resource can arrive in either order, and a retry can re-deliver one you have already seen. Write the handler so the newest information wins and a repeat is a no-op: key on the identifier in the payload, re-read the resource when you need its current state, and treat the delivery as a signal rather than as the authoritative sequence. This is a property you can detect and compensate for, which is why it is stated here rather than papered over with a guarantee that would fail quietly under load.
state is a snapshot, and not every event has one. Beside its keys, an event can carry a state object: the resource as it stood when the event happened, never a credential. Where an event declares no snapshot, state is null. RECORD_* events never carry one: their state is null by design, because a record’s content is governed by who may read it, and a copy in the event would reach readers the record does not. Read the record back under your own credentials instead.
causationChain may be present. When the event was produced by work that a hook itself started, the payload carries the chain of operation keys that led to it. Foir refuses to re-run an operation already in the chain, and stops any chain at three hops, so a hook that fires itself cannot run away.
The full catalogue
| Event | Subscribe on | What it means |
|---|---|---|
RECORD_CREATED | a project hook | A record was created. |
RECORD_UPDATED | a project hook | A record changed. |
RECORD_DELETED | a project hook | A record was deleted. |
RECORD_PUBLISHED | a project hook | A record version went live. |
RECORD_UNPUBLISHED | a project hook | A published record version was taken down. |
USER_CREATED | a project hook | A user was created. |
USER_UPDATED | a project hook | A user’s details changed. |
USER_DELETED | a project hook | A user was deleted. |
USER_MERGED | a project hook | Two users were merged into one. |
SESSION_REVOKED | a project hook | A session was revoked. |
OPERATION_COMPLETED | a project hook | An operation execution finished successfully. |
OPERATION_FAILED | a project hook | An operation execution finished with an error. |
OPERATION_CANCELLED | a project hook | An operation execution was cancelled before completing. |
OPERATION_TIMED_OUT | a project hook | An async operation did not call back in time and was reaped. |
MEMBERSHIP_GRANTED | a workspace hook | A team member was granted access to the workspace or to a project in it. |
MEMBERSHIP_REVOKED | a workspace hook | A team member’s access was withdrawn. |
MEMBERSHIP_ROLE_CHANGED | a workspace hook | A team member’s role changed. Not emitted today — see below. |
TENANT_PLAN_CHANGED | a workspace hook | The workspace moved to a different billing plan. |
TENANT_SUBSCRIPTION_STATUS_CHANGED | a workspace hook | The workspace’s subscription status changed — for example to past due, or back to active. |
PROJECT_CREATED | a workspace hook | A project was created in the workspace. |
PROJECT_ARCHIVED | a workspace hook | A project was deleted. |
INVITATION_ACCEPTED | a workspace hook | Someone accepted an invitation and joined the place it asked them to. |
IMPORT_COMPLETED | a project hook | A batch import finished. |
MIGRATION_APPLIED | a project hook | A schema migration finished moving record data. |
BULK_UPDATE_COMPLETED | a project hook | A bulk update finished. |
BULK_PUBLISH_COMPLETED | a project hook | A bulk publish finished. |
USER_PREFERENCE_CHANGED | a project hook | A user’s notification preference changed. |
ORGANIZATION_CREATED | a project hook | An organization was created. |
ORGANIZATION_UPDATED | a project hook | An organization’s name, presentation or own settings changed. |
ORGANIZATION_MOVED | a project hook | An organization moved to a different parent, taking everything beneath it along. |
ORGANIZATION_SUSPENDED | a project hook | An organization was suspended. |
ORGANIZATION_RESUMED | a project hook | A suspended organization was made active again. |
ORGANIZATION_DELETION_SCHEDULED | a project hook | An organization was put on a deletion clock. |
ORGANIZATION_DELETION_CANCELLED | a project hook | An organization’s scheduled deletion was cancelled. |
ORGANIZATION_DELETED | a project hook | An organization and everything it owned were destroyed. |
ORGANIZATION_MEMBER_ADDED | a project hook | A user became a member of an organization. |
ORGANIZATION_MEMBER_REMOVED | a project hook | A user’s membership of an organization was removed. |
ORGANIZATION_MEMBER_ROLE_CHANGED | a project hook | A member’s role in an organization changed. |
PROJECT_REACTIVATED | a workspace hook | A deleted project was reactivated. |
JOIN_REQUESTED | a project hook | A person asked to join an organization. |
JOIN_REQUEST_APPROVED | a project hook | A request to join an organization was approved. |
JOIN_REQUEST_DECLINED | a project hook | A request to join an organization was declined. |
Project events
Subscribe to these with a project hook — in the console under Settings, with foir hooks create, or with defineHook in your config. A project hook fires only for events in its own project.
Record events
Content lifecycle — the highest-volume family on the platform.
A record payload is a pointer, not a copy. It carries the record’s id and model key and no field content, on every record event including RECORD_DELETED. Read the record back through the API to get its data — and read it under your own credentials, which is the reason for the design: the event log is readable by anyone who can read events for the project, while a record is governed by ownership, grants, borrows and per-field read rules. Copying field content into an event would move it out from under all of those, permanently, for the whole retention of the log. So the pointer is not a cost saving that a later release relaxes; it is the shape of the contract.
A consumer that arrives after a delete therefore resolves nothing, which is the correct answer: the record is gone.
RECORD_CREATED
A record was created.
Fires when: Creating a record through the API, the console, the CLI, or an import.
| Key | Type | Present | Description |
|---|---|---|---|
recordId | string | always | The record’s id. |
modelKey | string | always | The model the record belongs to. This is the key hook filters most often match on. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
RECORD_UPDATED
A record changed.
Fires when: Any write that changes a record — a field edit, an owner change, a variant write, a version restore, a schedule change, or a cascade from a deleted secret.
| Key | Type | Present | Description |
|---|---|---|---|
recordId | string | always | The record’s id. |
modelKey | string | always | The model the record belongs to. This is the key hook filters most often match on. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
This is the highest-volume event on the platform. Filter it by modelKey unless you genuinely want every model.
RECORD_DELETED
A record was deleted.
Fires when: Deleting a record.
| Key | Type | Present | Description |
|---|---|---|---|
recordId | string | always | The record’s id. |
modelKey | string | always | The model the record belongs to. This is the key hook filters most often match on. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
The record is already gone when this is delivered, so reading it back returns nothing. If you need the record’s final content, capture it on RECORD_UPDATED while it still exists.
RECORD_PUBLISHED
A record version went live.
Fires when: Publishing a version, immediately or by a schedule reaching its publish time.
| Key | Type | Present | Description |
|---|---|---|---|
recordId | string | always | The record’s id. |
modelKey | string | always | The model the record belongs to. This is the key hook filters most often match on. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
RECORD_UNPUBLISHED
A published record version was taken down.
Fires when: Unpublishing a version, immediately or by a schedule reaching its unpublish time.
| Key | Type | Present | Description |
|---|---|---|---|
recordId | string | always | The record’s id. |
modelKey | string | always | The model the record belongs to. This is the key hook filters most often match on. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
User events
The people your project signs in: created, changed, removed or merged.
No user event carries credential material: no password, no hash, no identity-provider anchor, no session token. email is delivered where the emitting path holds it.
USER_CREATED
A user was created.
Fires when: Creating a user, or a person signing themselves up through the public auth API.
| Key | Type | Present | Description |
|---|---|---|---|
userId | string | always | The new user’s id. |
email | string | always | The user’s email address. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
USER_UPDATED
A user’s details changed.
Fires when: Updating a user through the API or the console.
| Key | Type | Present | Description |
|---|---|---|---|
userId | string | always | The user’s id. |
email | string | always | The user’s email address AFTER the change. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
USER_DELETED
A user was deleted.
Fires when: Deleting a user. Fires only when an account was actually removed, so a repeated delete is silent.
| Key | Type | Present | Description |
|---|---|---|---|
userId | string | always | The deleted user’s id. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
There is no email on this payload — the delete path does not re-read the row it is removing. Keep your own mapping from userId if you need to identify the user downstream.
USER_MERGED
Two users were merged into one.
Fires when: A real merge. A dry-run merge and a merge that moved nothing do not fire.
| Key | Type | Present | Description |
|---|---|---|---|
userId | string | always | The surviving user’s id, the same value as survivorId, present so a handler written for the other user events keeps working. |
survivorId | string | always | The user that persists. |
duplicateId | string | always | The user that was absorbed. Re-point your own foreign keys from this id to survivorId. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
USER_PREFERENCE_CHANGED
A user’s notification preference changed.
Fires when: A user, or somebody acting for them, changing a preference through the API or console, a one-click RFC-8058 unsubscribe from an event-notification email, and a provider bounce or complaint suppressing the address. It fires for the people the project signs in; a console teammate’s own notification settings are not the project’s to hear about.
| Key | Type | Present | Description |
|---|---|---|---|
userId | string | always | The user whose preference changed. |
category | string | always | The notification category. * is the global email opt-out, which suppresses every event-notification email rather than one category. |
channel | string | always | email, push or in_app. |
enabled | boolean | always | The state AFTER the change. |
source | string | always | Why it is in that state: manual, unsubscribe, bounce or complaint. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
READ source BEFORE ACTING. A manual change is somebody choosing, and mirroring it outward is ordinary. An unsubscribe is a deliberate opt-out, and restoring one — in foir or in a system you sync to — is a compliance problem rather than a fix. A bounce or complaint is the provider suppressing an address, which is hygiene and carries no intent at all. Treating the three alike is how an opt-out gets undone by an integration that meant well.
projectId is always present: a preference this event reports always names its project.
Session events
A signed-in session’s lifecycle. Use it to drop a revoked session from your own cache or to force a re-authentication in a connected system.
SESSION_REVOKED
A session was revoked.
Fires when: Somebody revoking a session, the user signing out, or the app the session belongs to being disabled. An already-revoked or unknown session does not fire.
| Key | Type | Present | Description |
|---|---|---|---|
sessionId | string | always | The revoked session’s id. |
userId | string | always | The user the session belonged to. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
No token material is delivered, by design — a session row carries a live credential and the event carries only its identity.
Operation events
An operation execution reached a terminal state. These are how you chain follow-up work off an operation without polling.
Every operation event carries the same three keys — executionId, operationKey, status — plus at most one of result or error. Loop protection applies: an operation re-fired by its own terminal event is refused once its key is already in the causation chain, and no chain may exceed three hops.
OPERATION_COMPLETED
An operation execution finished successfully.
Fires when: An operation returning success, whether inline or through an async callback.
| Key | Type | Present | Description |
|---|---|---|---|
executionId | string | always | The operation execution’s id. Key your handler on it to make retries idempotent. |
operationKey | string | always | The key of the operation that ran. |
status | string | always | The terminal status the execution reached. |
result | object | sometimes | The operation’s own return value. Absent when the operation returned nothing. |
OPERATION_FAILED
An operation execution finished with an error.
Fires when: An operation returning a failure, or exhausting its retries.
| Key | Type | Present | Description |
|---|---|---|---|
executionId | string | always | The operation execution’s id. Key your handler on it to make retries idempotent. |
operationKey | string | always | The key of the operation that ran. |
status | string | always | The terminal status the execution reached. |
error | object | sometimes | The error, as {code, message, retryable}. Absent when the failure carried no structured error. |
OPERATION_CANCELLED
An operation execution was cancelled before completing.
Fires when: Someone cancelling an execution from the console or the API, or the extension cancelling itself.
| Key | Type | Present | Description |
|---|---|---|---|
executionId | string | always | The operation execution’s id. Key your handler on it to make retries idempotent. |
operationKey | string | always | The key of the operation that ran. |
status | string | always | The terminal status the execution reached. |
A cancel carries neither result nor error — the execution produced neither.
OPERATION_TIMED_OUT
An async operation did not call back in time and was reaped.
Fires when: The watchdog reaping a callback-mode execution that passed its callback TTL.
| Key | Type | Present | Description |
|---|---|---|---|
executionId | string | always | The operation execution’s id. Key your handler on it to make retries idempotent. |
operationKey | string | always | The key of the operation that ran. |
status | string | always | The terminal status the execution reached. |
error | object | sometimes | The watchdog’s timeout error — not output from the operation, which never reported. |
Import events
What a maintenance-mode batch sends instead of one delivery per record.
A bulk write withholds the per-record RECORD_* events on purpose: fifty thousand deliveries is not a notification, it is an outage on your endpoint. The summary is the replacement message, not a quieter version of the same thing — without it you would be silently stale, with no way to know you need to re-read.
See also BULK_UPDATE_COMPLETED and MIGRATION_APPLIED, which follow the same rule.
IMPORT_COMPLETED
A batch import finished.
Fires when: A BatchRecordOperations call sent with maintenance set.
| Key | Type | Present | Description |
|---|---|---|---|
modelKey | string | always | The model the records belong to. |
recordCount | number | always | How many records the operation touched. |
recordIds | string[] | sometimes | The ids that moved. Present only when recordCount is at or below 1000; above that, re-read the model instead. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
This is the whole notification for that batch — the per-record RECORD_CREATED / RECORD_UPDATED / RECORD_DELETED events are deliberately withheld, because one delivery per record is an outage on your endpoint rather than a notification. Without maintenance the batch behaves exactly as it always has.
Migration events
A schema migration finished moving record data.
Same contract as IMPORT_COMPLETED: one message for the whole operation, in place of the per-record events the migration deliberately withholds.
MIGRATION_APPLIED
A schema migration finished moving record data.
Fires when: A migration finishing in the background — one whose corpus was too large to complete inside the push.
| Key | Type | Present | Description |
|---|---|---|---|
modelKey | string | always | The model the records belong to. |
recordCount | number | always | How many records the operation touched. |
recordIds | string[] | sometimes | The ids that moved. Present only when recordCount is at or below 1000; above that, re-read the model instead. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
Only the asynchronous half sends this. A migration small enough to finish inside the push has already completed by the time that call returns, so its outcome is in the push’s own output rather than an event arriving later.
Bulk update events
A predicate-scoped bulk update finished.
Same contract as IMPORT_COMPLETED: one message for the whole operation, in place of the per-record RECORD_UPDATED deliveries the write would otherwise produce.
BULK_UPDATE_COMPLETED
A bulk update finished.
Fires when: A BulkUpdateRecords call sent with maintenance set.
| Key | Type | Present | Description |
|---|---|---|---|
modelKey | string | always | The model the records belong to. |
recordCount | number | always | How many records the operation touched. |
recordIds | string[] | sometimes | The ids that moved. Present only when recordCount is at or below 1000; above that, re-read the model instead. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
As with IMPORT_COMPLETED, the per-record RECORD_UPDATED deliveries this write would otherwise produce are withheld in favour of this one message.
BULK_PUBLISH_COMPLETED
A bulk publish finished.
Fires when: A PublishVersion of many versions (version_ids) sent with maintenance set.
| Key | Type | Present | Description |
|---|---|---|---|
modelKey | string | always | The model the records belong to. |
recordCount | number | always | How many records the operation touched. |
recordIds | string[] | sometimes | The ids that moved. Present only when recordCount is at or below 1000; above that, re-read the model instead. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
Distinct from IMPORT_COMPLETED on purpose: an import says rows arrived, this says rows went live. If you warm a cache, purge a CDN or notify an audience on publication, this is the one to listen for. The per-record RECORD_PUBLISHED deliveries the batch would otherwise produce are withheld in favour of this single message. Scheduled publishing is unaffected and still sends one RECORD_PUBLISHED per record — a schedule firing is normal operation, not maintenance.
Organization events
The organizations inside a project, which are the tenants of a product built on Foir. These let you mirror your own tenancy without polling: an organization is created, renamed, moved in the tree, suspended, put on a deletion clock and finally deleted, and its members come and go.
Each event belongs to the organization it describes. A project hook created by a credential confined to one organization receives that organization’s events and never a sibling’s. A project hook with no organization receives every organization’s. A hook confined to a parent does not receive its children’s events, the same as for every other event, so subscribe from the project to follow a whole tree.
Only real transitions fire. A save that changes nothing, a move to the parent the organization already has, and a status write to the status it already holds send nothing.
Suspension and deletion reach the tree differently. Suspending an organization stops its whole subtree without writing to it, so ORGANIZATION_SUSPENDED fires once, for the organization that was suspended, and you should treat everything beneath it as suspended too. A deletion destroys the subtree, so the deletion events fire once for every organization involved.
Each event is recorded with its change. The event is written in the same transaction as the change it describes, whichever way the change was made, so a change never stands without its event and an event never describes a change that did not happen. Delivery can still repeat an event, so reconcile against the organizations API rather than counting deliveries.
Quota caps are not published here. A cap is configuration the platform enforces on your behalf, and a change to one is recorded on the audit log instead.
ORGANIZATION_CREATED
An organization was created.
Fires when: Creating an organization through the API or the console, at the root of the project or under a parent, or a user registering one through self-service sign-up where the project offers it.
| Key | Type | Present | Description |
|---|---|---|---|
orgId | string | always | The organization the event is about. |
parentId | string | always | The organization’s parent. Empty when it is a root of the project. |
name | string | always | The organization’s name. |
status | string | always | The organization’s status, which is active for a new one. |
founderId | string | sometimes | The user who registered the organization through self-service sign-up. Present only for that path. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
A new organization has no subscriptions of its own yet, so this reaches project-wide hooks. A self-service registration makes the founder the first member, which arrives as ORGANIZATION_MEMBER_ADDED.
ORGANIZATION_UPDATED
An organization’s name, presentation or own settings changed.
Fires when: Renaming an organization, changing its presentation (display name, logo, colour, sender name, reply-to address, support address, app URL, terms or privacy address), or changing its own settings (where its users stand, who may join it and the role joining gives, its sign-in methods, whether it requires a second factor, and whether wrong passwords lock an account), including clearing an override so the field inherits again. A save that changes nothing does not fire.
| Key | Type | Present | Description |
|---|---|---|---|
orgId | string | always | The organization the event is about. |
parentId | string | always | The organization’s parent. Empty when it is a root of the project. |
name | string | always | The organization’s name after the change. |
changed | string[] | always | Which fields changed, from name, displayName, logoUrl, primaryColor, fromName, replyTo, supportEmail, appBaseUrl, termsUrl, privacyUrl, users, joining, joiningRoleId, signInMethods, requiresSecondFactor and locksAccountsAfterFailedSignIns. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
The presentation values after the change are in state. A field absent there has no override, so the organization inherits it from the nearest organization above that sets it, then from the project. A change here also changes what every organization below inherits for the fields they leave empty, and this event fires only for the organization that changed.
ORGANIZATION_MOVED
An organization moved to a different parent, taking everything beneath it along.
Fires when: Re-parenting an organization, including promoting it to a root of the project. A move to the parent it already has does not fire.
| Key | Type | Present | Description |
|---|---|---|---|
orgId | string | always | The organization that moved. |
parentId | string | always | Its new parent. Empty when it is now a root. |
previousParentId | string | always | Its parent before the move. Empty when it was a root. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
Only the organization that was moved fires. Everything beneath it moved too, but each descendant kept its own parent, so if you record full ancestry, recompute it for the whole subtree.
ORGANIZATION_SUSPENDED
An organization was suspended.
Fires when: Changing an active organization’s status to suspended.
| Key | Type | Present | Description |
|---|---|---|---|
orgId | string | always | The organization the event is about. |
parentId | string | always | The organization’s parent. Empty when it is a root of the project. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
Its users can no longer sign in, and none of its data is touched. Suspension covers the whole subtree without being written to it, so this fires once, for the organization that was suspended. Treat every organization beneath it as suspended too.
ORGANIZATION_RESUMED
A suspended organization was made active again.
Fires when: Changing a suspended organization’s status back to active. Cancelling a scheduled deletion sends ORGANIZATION_DELETION_CANCELLED instead.
| Key | Type | Present | Description |
|---|---|---|---|
orgId | string | always | The organization the event is about. |
parentId | string | always | The organization’s parent. Empty when it is a root of the project. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
An organization is usable only while every organization above it is active, which is why resuming one whose ancestor is still suspended is refused rather than accepted and ineffective.
ORGANIZATION_DELETION_SCHEDULED
An organization was put on a deletion clock.
Fires when: Scheduling an organization for deletion. It fires for that organization and for every organization beneath it, all with the same deadline. Scheduling one that is already scheduled restarts the clock and fires again.
| Key | Type | Present | Description |
|---|---|---|---|
orgId | string | always | The organization the event is about. |
parentId | string | always | The organization’s parent. Empty when it is a root of the project. |
deletionScheduledAt | string | always | When the retention window closes and the data may be destroyed, as an RFC 3339 timestamp. |
rootOrgId | string | always | The organization the deletion was scheduled on. The same as orgId for that one, and its ancestor for every organization beneath it. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
Nothing is removed yet. The schedule can be cancelled until the window closes, and ORGANIZATION_DELETED follows only if it is not.
ORGANIZATION_DELETION_CANCELLED
An organization’s scheduled deletion was cancelled.
Fires when: Changing a scheduled organization’s status to active or suspended. It fires for that organization and for every organization beneath it that the schedule covered.
| Key | Type | Present | Description |
|---|---|---|---|
orgId | string | always | The organization the event is about. |
parentId | string | always | The organization’s parent. Empty when it is a root of the project. |
status | string | always | The status the organization returned to, active or suspended. |
rootOrgId | string | always | The organization the cancellation was made on. The same as orgId for that one, and its ancestor for every organization beneath it. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
An organization beneath the one that was cancelled returns to the status it held before the schedule, so one that was suspended in its own right comes back suspended rather than active.
ORGANIZATION_DELETED
An organization and everything it owned were destroyed.
Fires when: The retention window of a scheduled deletion closing. A subtree is destroyed from the leaves up, so a child is always destroyed before its parent.
| Key | Type | Present | Description |
|---|---|---|---|
orgId | string | always | The organization the event is about. |
parentId | string | always | The organization’s parent. Empty when it is a root of the project. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
This is the last event about the organization, and parentId is its parent at the moment it was destroyed. Its own subscriptions are destroyed with it, so this reaches project-wide hooks, and reading the organization back returns nothing.
ORGANIZATION_MEMBER_ADDED
A user became a member of an organization.
Fires when: Adding a member through the API or the console, an organization’s own manager staffing it, or a founder registering an organization, which makes them its first member.
| Key | Type | Present | Description |
|---|---|---|---|
orgId | string | always | The organization the membership belongs to. |
userId | string | always | The member. |
roleId | string | sometimes | The role the membership carries. Absent when it carries none, which grants nothing until a role is given. |
roleKey | string | sometimes | The key of that role. Absent whenever roleId is. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
Adding someone who is already a member with a different role sends ORGANIZATION_MEMBER_ROLE_CHANGED instead, and adding them with the role they hold sends nothing. Changes to one organization’s membership are applied one at a time, so two adds of the same user made together produce exactly one ORGANIZATION_MEMBER_ADDED: the second sees the membership the first created.
ORGANIZATION_MEMBER_REMOVED
A user’s membership of an organization was removed.
Fires when: Removing a member through the API or the console, or an organization’s own manager removing one of its staff. Removing someone who is not a member does not fire.
| Key | Type | Present | Description |
|---|---|---|---|
orgId | string | always | The organization the membership belongs to. |
userId | string | always | The member. |
roleId | string | sometimes | The role the membership carried when it was removed. Absent when it carried none. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
The user still exists. Removing a membership withdraws what it granted and touches none of the organization’s data.
ORGANIZATION_MEMBER_ROLE_CHANGED
A member’s role in an organization changed.
Fires when: Adding an existing member again with a different role, or with none.
| Key | Type | Present | Description |
|---|---|---|---|
orgId | string | always | The organization the membership belongs to. |
userId | string | always | The member. |
roleId | string | sometimes | The role after the change. Absent when the role was cleared. |
roleKey | string | sometimes | The key of that role. Absent whenever roleId is. |
previousRoleId | string | sometimes | The role before the change. Absent when there was none. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
Join request events
Requests to join an organization that takes them. Somebody who can already sign in at an organization’s page, and is not a member, asks to join by signing in there; its staff then approve or decline.
Each event stands at the organization and names the person. An organization’s hook hears the requests to join it, and a project hook hears every organization’s. An approval also sends ORGANIZATION_MEMBER_ADDED, so a subscriber that only mirrors membership needs nothing here.
JOIN_REQUESTED
A person asked to join an organization.
Fires when: Somebody of the pool that serves an organization taking requests, who is not a member of it, signs in at its page. Signing in again while the request waits does not fire again.
| Key | Type | Present | Description |
|---|---|---|---|
requestId | string | always | The request. |
orgId | string | always | The organization asked to join. |
userId | string | always | The person asking. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
The event stands at the organization and names the person, so it is read by whoever reaches them there. Staff holding members:write approve or decline the request.
JOIN_REQUEST_APPROVED
A request to join an organization was approved.
Fires when: Staff approving the request through the API or the console. The person is then a member, with the role the approval named or else the organization’s joining role, and ORGANIZATION_MEMBER_ADDED fires too.
| Key | Type | Present | Description |
|---|---|---|---|
requestId | string | always | The request. |
orgId | string | always | The organization asked to join. |
userId | string | always | The person asking. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
The person is emailed that they may now sign in.
JOIN_REQUEST_DECLINED
A request to join an organization was declined.
Fires when: Staff declining the request through the API or the console.
| Key | Type | Present | Description |
|---|---|---|---|
requestId | string | always | The request. |
orgId | string | always | The organization asked to join. |
userId | string | always | The person asking. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the event belongs to. |
The person is emailed the outcome and may ask again by signing in at the organization’s page.
Workspace events
Subscribe to these with a workspace hook, on the workspace itself rather than on a project. One workspace hook covers every project in the workspace, including projects created after the hook was.
The two planes are kept apart on purpose: a project hook cannot subscribe to a workspace event and a workspace hook cannot subscribe to a project event. A subscription created on the wrong plane would be accepted and would then never fire, so it is refused instead.
Membership events
Who has access to the workspace, and with what role.
Membership is granted through two surfaces (a role assignment and an access grant) and they do not send an identical key set. The Present column below says which keys you can rely on.
MEMBERSHIP_GRANTED
A team member was granted access to the workspace or to a project in it.
Fires when: Granting workspace access, or giving a team member a role. A role at the platform root, outside any workspace, does not fire.
| Key | Type | Present | Description |
|---|---|---|---|
userId | string | always | The team member who received the access. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | sometimes | The project the event belongs to. |
roleId | string | always | The granted role’s id. |
roleKey | string | always | The granted role’s key. |
actorId | string | always | Who performed the action. |
projectId is empty for workspace-wide access and set for access scoped to one project.
MEMBERSHIP_REVOKED
A team member’s access was withdrawn.
Fires when: Revoking a workspace access grant, taking a role from a team member, a team member being removed from the workspace or a project or leaving it, and a team member’s account being deleted, once for each role that went. Taking a role from a person the project signs in is the project’s own authorization, not workspace membership, and does not fire.
| Key | Type | Present | Description |
|---|---|---|---|
userId | string | always | The team member whose access was withdrawn. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | sometimes | The project the event belongs to. |
roleId | string | always | The revoked role’s id. |
roleKey | string | always | The revoked role’s key. |
actorId | string | always | Who performed the action. |
reason | string | sometimes | Why the role went, where it went with more than itself: membership_ended when the person was removed or left, account_deleted when their account was deleted. Absent when the role alone was taken. |
Both revoke surfaces send roleId and roleKey, so a filter on either matches every revoke, mirroring MEMBERSHIP_GRANTED.
MEMBERSHIP_ROLE_CHANGED
A team member’s role changed.
This event is never emitted. No platform path emits MEMBERSHIP_ROLE_CHANGED. A role change is applied as a revoke followed by a grant, so it reaches you as MEMBERSHIP_REVOKED and then MEMBERSHIP_GRANTED for the same userId. Creating a subscription to this event is rejected — subscribe to the two membership events instead.
Billing events
The workspace’s plan and subscription state.
Both fire only on a real transition: a renewal or a card change does not fire TENANT_PLAN_CHANGED. TENANT_PLAN_CHANGED commits with the subscription change that raises it. TENANT_SUBSCRIPTION_STATUS_CHANGED is emitted after the billing change has committed, so treat it as at-most-once and reconcile against the billing API rather than counting deliveries.
TENANT_PLAN_CHANGED
The workspace moved to a different billing plan.
Fires when: A subscription change that resolves to a different plan. A renewal, a card change or any other update that leaves the plan alone does not fire.
| Key | Type | Present | Description |
|---|---|---|---|
tenantId | string | always | The workspace the event belongs to. |
planId | string | always | The new plan’s id. |
planKind | string | always | The new plan’s kind. |
previousPlan | string | always | The plan id in effect before the change. Empty when the workspace had no resolved plan. |
status | string | always | The subscription status after the change. |
TENANT_SUBSCRIPTION_STATUS_CHANGED
The workspace’s subscription status changed — for example to past due, or back to active.
Fires when: A real status transition. A repeated notification of the status the workspace already has does not fire.
| Key | Type | Present | Description |
|---|---|---|---|
tenantId | string | always | The workspace the event belongs to. |
status | string | always | The new subscription status. |
This payload carries no plan information. If you need the plan as well, read it back from the billing API, or subscribe to TENANT_PLAN_CHANGED too.
Project lifecycle events
Projects appearing and disappearing inside the workspace. These are the only two workspace events whose payload carries a project — which is why they are the only two that can run an operation rather than merely notify. Every other workspace event describes the workspace itself, so it can only notify.
PROJECT_CREATED
A project was created in the workspace.
Fires when: Creating a project.
| Key | Type | Present | Description |
|---|---|---|---|
projectId | string | always | The new project’s id. |
tenantId | string | always | The workspace the event belongs to. |
name | string | always | The project’s name. |
actorId | string | always | Who performed the action. |
A project may still be finishing setup when this fires. A hook that runs an operation the new project cannot resolve yet is retried for a short window before it is treated as a failure, so a setup operation does not need to guard against the race itself.
PROJECT_ARCHIVED
A project was deleted.
Fires when: Deleting a project, or approving a request to delete one. Deleting the workspace’s default project is refused and does not fire. Deleting a project that is already deleted changes nothing and does not fire.
| Key | Type | Present | Description |
|---|---|---|---|
projectId | string | always | The deleted project’s id. |
tenantId | string | always | The workspace the event belongs to. |
actorId | string | always | Who performed the action. |
The event keeps the name it was given when a deleted project was called archived. A deleted project stops answering at once and is kept for its retention window, in which it can be reactivated: that fires PROJECT_REACTIVATED. When the window closes its data is destroyed, and nothing fires for that.
Unlike PROJECT_CREATED this payload carries no name. A deletion commits with its event, whether it was made directly or by approving a request.
PROJECT_REACTIVATED
A deleted project was reactivated.
Fires when: Reactivating a deleted project before its retention window closes. Reactivating a project that is not deleted is refused and does not fire.
| Key | Type | Present | Description |
|---|---|---|---|
projectId | string | always | The reactivated project’s id. |
tenantId | string | always | The workspace the event belongs to. |
actorId | string | always | Who performed the action. |
It undoes what PROJECT_ARCHIVED said: the project answers again, with everything it held when it was deleted. A consumer that stopped working for the project when it was deleted starts again here.
It commits with the reactivation, so a reactivation that happened has its event. The two can alternate for one project any number of times.
Invitation events
The accept is the event; the invite itself is not published, because an invitation row carries a bearer token that would be a live credential on a durable log.
INVITATION_ACCEPTED
Someone accepted an invitation and joined the place it asked them to.
Fires when: An invited person completing the accept, for an invitation to the workspace or to one of its projects or organizations. Sending or revoking an invitation does not fire.
| Key | Type | Present | Description |
|---|---|---|---|
invitationId | string | always | The accepted invitation’s id. |
tenantId | string | always | The workspace the event belongs to. |
projectId | string | always | The project the invitation was to. Empty for one to the workspace. |
orgId | string | always | The organization the invitation was to. Empty for one to the project or the workspace. |
email | string | always | The address the invitation was sent to. |
userId | string | always | The person the accept made, or who held the address already and joined. |
roleId | string | sometimes | The role the invitation conferred. Always present for one to the workspace, and present for one to a project or an organization where the invitation named a role. |
roleKey | string | sometimes | The key of that role. |
invitedBy | string | always | Who sent the invitation: a person’s id, or the key’s. |
projectIds | string[] | always | The projects an invitation to the workspace gave its role at. Empty for the whole workspace, and for an invitation to a project. |
The invitation token is never delivered. It is a bearer credential, and anyone holding it could accept the invitation.
See also
- Webhooks — wiring a receiver, verifying a delivery, retries and redelivery
- Lifecycle Hooks — creating hooks, filters, sync vs async
- Defining Hooks —
defineHookin your config file