Platform API · Product API · Audience
Events
What an audience event is, how the project's event catalogue and its parameter schemas are discovered live, how events attach to a contact, how to tell an event type that is declared apart from one that actually arrives, and how to read consent changes (subscribe and unsubscribe) and reach the contact behind each one.
An event is an immutable record of something a person did: a purchase, a page view, a form submission, an appointment, anything the account decides to track. Events are the behavioural half of the audience. Attributes say what somebody is; events say what they did, and when.
Because contacts merge, so do timelines. Every event reported by any data source about a person ends up on that person's single audience contact, in one chronological stream, regardless of how many systems contributed to it.
The event catalogue
Which event types a project can receive is project-specific, exactly like the attribute catalogue. Read it live rather than hardcoding a list.
Every event type available in this project.
curl "$BASE/specs/events" \
-H "Authorization: Bearer $INSTASENT_TOKEN"Each entry describes the type, not any instance of it:
uidstringThe identifier used everywhere else: as the event type in a filter condition, and as the event argument of a probe. For example ecommerce_order_create, ecommerce_product_view, appointment.
namestringHuman-readable name for the type.
categorystringWhich family the type belongs to (ecommerce, crm, marketing, subscriptions, payments, meetings, contact_data, contact_behaviour). Useful for grouping in a UI, not for filtering.
attributionbooleanWhether this type takes part in attribution tracking, which is what lets a conversion be credited to what preceded it.
automationbooleanWhether the type can trigger an automation. A type with automation: false can still be filtered on; it just will not start anything.
importantbooleanWhether the platform treats the type as a headline event for the contact's timeline.
Event parameters
An event carries parameters: the payload that makes one purchase different from another. They are declared per type, and their schema is discovered the same way.
The parameter schema of one event type.
curl "$BASE/specs/events/ecommerce_product_purchase" \
-H "Authorization: Bearer $INSTASENT_TOKEN"Each parameter reports its parameter key, title, dataType, whether it is required, its multiValue ceiling and, for strings, a maxLength. Parameter keys are namespaced by their event type when you filter on them: for a create event you filter on create.source, for an order on ecommerce_order_create.order-euro-amount. The event query filter page documents the resolution rules.
Reading a contact's events
Given an audience contact id, its timeline is one call.
The events attached to a single audience contact.
This needs PROJECT_AUDIENCE_READ and PROJECT_AUDIENCE_DATA_EVENTS, the second of which is gated by the subscription plan. Without it the call is refused rather than returning a thinner timeline.
To search events across the whole project rather than for one person, use the event query filter against /event/search and /event/scroll. Note that the event listing endpoints look back over a bounded window whose length depends on the subscription: read what the response reports rather than assuming your requested range was honoured.
Declared is not received
The catalogue lists every type the project could receive. It cannot tell you which of them anything ever sends, and that difference is usually the one that decides whether a feature is worth building.
POST /project/{project}/event/volumes answers it: per declared type, the count inside a window, whether anything arrived, and when the last one did. A type that is declared and never received comes back as an explicit zero rather than being silently absent. Pass an event and the answer goes a level deeper, returning the values that type's parameters actually carry: product ids and names, categories, tags, vendors, the campaign ids and names behind an attribution, sources and mediums, statuses, methods.
Which event types arrive, how many, when the last one did, and what their parameters hold.
Four caveats travel with that answer and are easy to lose:
- A null
lastSeenAtmeans nothing arrived in that window, never that the type was never seen. - Where a parameter has both an id and a name, both come back. Filter on the id (
product-id,utm-id), which is stable and unique, and read the name (product-name,utm-campaign), which is neither: a condition written against a name breaks the first time the customer renames the thing. - The type counts are never sampled, but the parameter values are, above 10,000 contacts. Their answer is in
event.sampling, a second block nested underevent, not in the top-levelsamplingthat reports on the counts. A value missing from a sampled list has not been shown not to occur. - The probe reads the project's event history, while a segment's event condition is evaluated against a narrower, per-contact store. So a value the probe lists can match fewer people than its count suggests, sometimes none. Use the probe to pick a value, then count.
The full treatment, with the rest of the caveats, is on Probes.
Events in a contact filter
You do not need the event grammar to select people by what they did. The audience query filter has event_condition and group_event nodes for exactly that: "contacts who purchased in the last 30 days" is a contact-side filter with an event group inside it. Reach for the event query filter when the rows you want back are events, not people.
Consent events: subscribe and unsubscribe
A consent change lands on the contact's timeline as one of two event types that Instasent raises itself: a STOP reply, a tap on an unsubscribe link, a change made through subscription management (from the API or a flow), or a connected source reporting a consent change. unsubscribe records a contact who stops accepting messages on a channel; subscribe records one who accepts them again. Both are in the catalogue like any other type, and POST /event/volumes lists them among the platformEventTypes. A consent attribute written directly by a data source, an import or a sync setting _accepts_marketing_sms for example, is recorded as an update of the contact, not as one of these.
What consent is, and what each state lets a send do, is explained once, in the Platform guides: How consent works for the marketing preference and channel suppression, Opt-outs & reactivation for how contacts opt out and come back, Subscription attributes for the attributes that store the state, and Manage consent via API for changing it from your own code. This section covers reading the changes.
What each event carries
The parameters come back in the event's resolvedData, under the names that GET /project/{project}/specs/events/unsubscribe (or /subscribe) declares. Each value is a list of strings, almost always with one element ("channel": ["sms"]), or null when the change did not set it. Both types use the same names:
channelstring[]The channel whose consent changed: sms, email, whatsapp. RCS shares its consent with SMS, so an opt-out from an RCS message is recorded with channel sms, and its method starts with rcs:. See Shared consent.
typestring[]What changed. On unsubscribe: opt-out, the contact declined marketing on the channel, and suppression, the channel is blocked for every message. On subscribe: opt-in, the contact accepted marketing, and reactivation, the channel suppression was lifted. Besides a suppress through subscription management, a suppression comes from a STOP or an unsubscribe link on a message sent under the basic policy, and from an escalation: a contact who had already declined marketing opts out again. Outside subscription management, an opt-in that reaches a contact suppressed on that channel records two events, an opt-in and a reactivation; subscription management records only the type of the operation it performed.
methodstring[]How the change arrived, as origin:action: sms:keyword-reply and rcs:keyword-reply (a reply with an opt-out or opt-in keyword), sms:unsubscribe-link, rcs:unsubscribe-link and email:unsubscribe-link, and api:manage (a direct change through subscription management, from the API or a flow's consent step). An escalation to suppression reads <origin>:escalation (sms:escalation), and the reactivation that follows an opt-in reads <origin>:de-escalation (sms:de-escalation). unknown when the origin was not recorded. Branch on these values, not on reason.
sourcestring[]What originated the change: campaign, automation, flow (a flow message, or a flow's consent step), direct (a direct message), api (a message sent through the API), or unknown when the change cannot be traced to one of those, such as a change through subscription management from the panel or the API. On an unsubscribe tied to a message it is followed by the consent policy that message was sent under, as origin:policy: campaign:no-opt-out, flow:basic. On subscribe, and on a change through subscription management, it carries no policy.
reasonstring[]A short free-text note, when the origin supplies one.
idstring[]The message tied to the change: the reply itself for a keyword reply, the message whose link was tapped for an unsubscribe link. null for a change made through subscription management.
subidstring[]The id of the campaign, automation or flow that message belongs to, when there is one. Filter on it rather than on name.
namestring[]The name of that campaign, automation or flow. Names change; read it, don't filter on it.
When the change is tied to a message Instasent sent, the event also carries that message's attribution parameters: utm-type (campaign, automation, flow or direct), utm-id, utm-campaign and utm-medium, the channel the message went out on, among others. Under the project's anonymized data policy the whole resolvedData comes back as the string [redacted-by-policy]; audienceId is still there.
Reading the changes
There is no webhook for consent changes. Two ways to act on them: poll POST /project/{project}/event/scroll with a filter on the event type, or let a flow react to them, since subscribe and unsubscribe can start a flow and end a run (see Triggers and exits).
Every event matching an event query filter, up to 100 per page, cursor-paginated.
It needs PROJECT_AUDIENCE_LIST and PROJECT_AUDIENCE_DATA_EVENTS, both gated by the subscription plan. The body is an event query filter. The SMS unsubscribes of the last 24 hours (which include those from RCS messages, recorded on sms):
{
"root": {
"type": "group",
"join": "and",
"children": [
{ "type": "event_condition", "key": "event-type", "operator": "matches-string", "values": ["unsubscribe"] },
{ "type": "event_condition", "key": "unsubscribe.channel", "operator": "matches-string", "values": ["sms"] },
{
"type": "event_condition",
"key": "created-at",
"operator": "range-date-relative",
"values": {
"lowerOffset": -1,
"lowerOffsetPeriod": "day",
"upperOffset": null,
"upperOffsetPeriod": "day",
"lowerExcludeEquals": false,
"upperExcludeEquals": false,
"lowerRounding": false,
"upperRounding": false
}
}
]
},
"limit": 100
}Add a condition on unsubscribe.type to keep only suppressions, or on unsubscribe.method for one origin. The response, trimmed to the fields discussed here:
{
"entities": [
{
"id": "c2a91f3e7b604d1d8e5f0a4b",
"type": "unsubscribe",
"createdAt": "2026-11-27T10:15:00.000+0000",
"audienceId": "6954234341ef67caa32a14c2",
"resolvedData": {
"channel": ["sms"],
"type": ["opt-out"],
"method": ["sms:keyword-reply"],
"source": ["campaign:no-opt-out"],
"subid": ["5f1e9b2c4d7a8e3b6c0d1a92"],
"utm-type": ["campaign"]
}
}
],
"metadata": {
"totalHits": 37,
"limit": 100,
"cursor": "eyJwb2ludEluVGltZUlkIjoiLi4uIn0="
}
}The next page is the same body plus the cursor. The cursor holds the snapshot and the position in it, not the filter: a request that sends only the cursor gets the next page of the snapshot without your conditions, so every page resends the same root and limit:
{
"root": {
"type": "group",
"join": "and",
"children": [
{ "type": "event_condition", "key": "event-type", "operator": "matches-string", "values": ["unsubscribe"] },
{ "type": "event_condition", "key": "unsubscribe.channel", "operator": "matches-string", "values": ["sms"] },
{
"type": "event_condition",
"key": "created-at",
"operator": "range-date-relative",
"values": {
"lowerOffset": -1,
"lowerOffsetPeriod": "day",
"upperOffset": null,
"upperOffsetPeriod": "day",
"lowerExcludeEquals": false,
"upperExcludeEquals": false,
"lowerRounding": false,
"upperRounding": false
}
}
]
},
"limit": 100,
"cursor": "eyJwb2ludEluVGltZUlkIjoiLi4uIn0="
}Keep going with the cursor of the latest response until metadata.cursor is null. totalHits is only reported on the first page. Each cursor serves one request (sending it twice is refused with 400), and it expires one minute after the last request. Starting a scroll, a request without a cursor, is limited per project and per minute on top of the endpoint's own rate limit; past it the response is 429 with a Retry-After header, so page with the cursor instead of starting the same scroll over (see Rate limits). When successive polls use overlapping windows, deduplicate on the event id.
From the event to the contact
Every event carries audienceId, the id of the audience contact it belongs to. Pass it to the direct lookup; no search is needed:
The audience contact the event belongs to.
The event tells you what changed and when; the contact tells you the state now, which differs if the contact changed their mind later. Which fields the contact comes back with depends on the token's data level (see Data privacy and plan gating), and the lookups are described in Retrieving one contact.
What's next
- Probes: which types arrive and what their parameters really hold.
- Event query filter: the grammar for searching and aggregating events directly.
- Query filter: selecting contacts by their events.
- How consent works: the consent model behind
subscribeandunsubscribe, in the Platform guides.
Last updated