Track events in a batchMenu

Track events in a batch

POST/v1/events/batch

Requires an API key with the events:write scope. About keys and scopes

Works with integration and partner keys, not agent keys.

Each entry carries its own idempotencyKey; a retried entry replays. About idempotency

Tracks up to 100 events in one request, each stored exactly as POST /v1/events/track would, in order, under its own idempotencyKey in place of the header. One event refused does not stop the rest: its entry carries the error a single track would have returned, and a key already used returns the stored event with replayed: true, or IDEMPOTENCY_KEY_REUSED if the event differs. An entry without a key is recorded every time it is sent. Retry a failed batch whole; the keys stop anything being stored twice. Counts against the rate limit as one request per event. An event past the plan's monthly events carries PLAN_LIMIT_REACHED in its own entry; the rest are stored.

Header parameters

Kirora-Workspacestringoptional

Partner keys only: the child workspace to act in, by the external id the partner gave it. Without it, a partner key acts in its own workspace. Any other key that sends it is refused with 403, and an unknown workspace is 404.

pattern ^[A-Za-z0-9._:-]{1,128}$

Request body

eventsobject[]required

at least 1 item · at most 100 items

2 child attributes
idempotencyKeystringoptional

As the Idempotency-Key header of a single track: one per event you mean. Optional, but without one a retried entry records the event again.

8–255 characters

eventobjectrequired
Any of 3 shapes
By contact id
5 child attributes
contactIdstringrequired

Kirora's id for the contact.

uuid

namestringrequired

Case-sensitive, up to 128 characters once leading and trailing spaces are removed. contact.* is reserved, and Ordered Product is recorded from each Order Completed.

pattern ^\P{Cc}+$ · 1–128 characters

propertiesmap<string, any>optional

Free-form details of the event; at most 16 KB, keys up to 64 characters, products up to 250 lines.

default {}

occurredAtstringoptional

When it happened; defaults to now. At most 24 hours ahead.

date-time

contextEventContextInputoptional

Where and on what it happened, beside the properties.

12 child attributes
sessionIdstringoptional

The visit, from the SDK.

up to 128 characters

localestringoptional

As BCP 47, en-GB; extensions such as -u-fw-mon are dropped.

timezonestringoptional

As IANA, Europe/Berlin.

up to 64 characters

pageobjectoptional

Web: the page as visited: query strings kept, fragments removed. A longer value is cut, not refused: url, search and referrer at 8192 characters, path at 2048, title at 256.

campaignobjectoptional

Web: the utm_* parameters of the page, each cut to 256 characters.

deviceobjectoptional
appobjectoptional

Mobile: the app the event happened in.

osobjectoptional

Mobile: the operating system.

screenobjectoptional

Mobile: the screen in points (iOS) or pixels (Android), and its scale.

libraryobjectoptional
ipstringoptional

up to 64 characters

userAgentstringoptional

up to 1,024 characters

By external id
5 child attributes
externalIdstringrequired

Your own id for the contact, as set with identify.

1–255 characters

namestringrequired

Case-sensitive, up to 128 characters once leading and trailing spaces are removed. contact.* is reserved, and Ordered Product is recorded from each Order Completed.

pattern ^\P{Cc}+$ · 1–128 characters

propertiesmap<string, any>optional

Free-form details of the event; at most 16 KB, keys up to 64 characters, products up to 250 lines.

default {}

occurredAtstringoptional

When it happened; defaults to now. At most 24 hours ahead.

date-time

contextEventContextInputoptional

Where and on what it happened, beside the properties.

12 child attributes
sessionIdstringoptional

The visit, from the SDK.

up to 128 characters

localestringoptional

As BCP 47, en-GB; extensions such as -u-fw-mon are dropped.

timezonestringoptional

As IANA, Europe/Berlin.

up to 64 characters

pageobjectoptional

Web: the page as visited: query strings kept, fragments removed. A longer value is cut, not refused: url, search and referrer at 8192 characters, path at 2048, title at 256.

campaignobjectoptional

Web: the utm_* parameters of the page, each cut to 256 characters.

deviceobjectoptional
appobjectoptional

Mobile: the app the event happened in.

osobjectoptional

Mobile: the operating system.

screenobjectoptional

Mobile: the screen in points (iOS) or pixels (Android), and its scale.

libraryobjectoptional
ipstringoptional

up to 64 characters

userAgentstringoptional

up to 1,024 characters

By email
5 child attributes
emailstringrequired

The contact's email address, matched trimmed and without case.

namestringrequired

Case-sensitive, up to 128 characters once leading and trailing spaces are removed. contact.* is reserved, and Ordered Product is recorded from each Order Completed.

pattern ^\P{Cc}+$ · 1–128 characters

propertiesmap<string, any>optional

Free-form details of the event; at most 16 KB, keys up to 64 characters, products up to 250 lines.

default {}

occurredAtstringoptional

When it happened; defaults to now. At most 24 hours ahead.

date-time

contextEventContextInputoptional

Where and on what it happened, beside the properties.

12 child attributes
sessionIdstringoptional

The visit, from the SDK.

up to 128 characters

localestringoptional

As BCP 47, en-GB; extensions such as -u-fw-mon are dropped.

timezonestringoptional

As IANA, Europe/Berlin.

up to 64 characters

pageobjectoptional

Web: the page as visited: query strings kept, fragments removed. A longer value is cut, not refused: url, search and referrer at 8192 characters, path at 2048, title at 256.

campaignobjectoptional

Web: the utm_* parameters of the page, each cut to 256 characters.

deviceobjectoptional
appobjectoptional

Mobile: the app the event happened in.

osobjectoptional

Mobile: the operating system.

screenobjectoptional

Mobile: the screen in points (iOS) or pixels (Android), and its scale.

libraryobjectoptional
ipstringoptional

up to 64 characters

userAgentstringoptional

up to 1,024 characters

Returns

Returns 200 OK with a TrackEventsBatchResult in data. It can also return 409 Conflict, 413 Payload Too Large or 415 Unsupported Media Type; see the statuses below. Otherwise returns an error; Errors lists every code and which to retry.

  • 200 OKOne result per event sent, in the same order.
  • 409 ConflictThe request conflicts with current state — a duplicate unique value, or a resource whose status does not allow this operation.
  • 413 Payload Too LargeThe body is larger than this operation accepts (PAYLOAD_TOO_LARGE).
  • 415 Unsupported Media TypeThe body is not JSON, or not the upload the operation takes (UNSUPPORTED_MEDIA_TYPE).
resultsobject[]required
Any of 2 shapes
Event recorded
3 child attributes
idempotencyKeystring | nullrequired
replayedbooleanrequired

True when the key was used before and the stored event is returned.

eventTrackedEventrequired
3 child attributes
idstringrequired

uuid

occurredAtstringrequired

date-time

expiresAtstringrequired

When retention deletes it: when it happened plus the days the plan kept events when it was stored. Fixed: a plan change moves only later events.

date-time

Event refused
2 child attributes
idempotencyKeystring | nullrequired
errorobjectrequired
5 child attributes
codestringrequired

one of BAD_REQUEST, ALREADY_EXISTS, CONFLICT, IN_USE, FORBIDDEN, SCOPE_MISSING, AGENT_KEY_REFUSED, INTERNAL_ERROR, NOT_FOUND, METHOD_NOT_ALLOWED, PAYLOAD_TOO_LARGE, UNSUPPORTED_MEDIA_TYPE, RATE_LIMITED, REVISION_CONFLICT, SERVICE_UNAVAILABLE, UNAUTHORIZED, VALIDATION_ERROR, API_KEY_IP_NOT_ALLOWED, INTEGRATION_PAUSED, AGENT_CONFIRMATION_REQUIRED, EMBED_BUILDER_UNAVAILABLE, EMBED_ORIGIN_NOT_ALLOWED, WORKSPACE_SUSPENDED, WORKSPACE_DELETION_PENDING, CONTACT_SEND_IN_PROGRESS, EXPORT_UNAVAILABLE, NOTHING_TO_EXPORT, EVENT_NAME_LIMIT_REACHED, PLAN_LIMIT_REACHED, SENDING_REVIEW_REQUIRED, PLAN_FEATURE_UNAVAILABLE, CAMPAIGN_AUDIENCE_CONFLICT, EMPTY_AUDIENCE, DRAFT_INCOMPLETE, INVALID_SCHEDULE, UNSUPPORTED_CHANNEL, POSTAL_ADDRESS_MISSING, CONSENT_MISSING, SUPPRESSED, TOPIC_UNSUBSCRIBED, SIGNUP_BLOCKED, INVALID_SENDER_ADDRESS, SENDING_DOMAIN_DMARC_MISSING, SENDING_DOMAIN_IDENTITY_CONFLICT, TEST_SEND_OUTCOME_UNKNOWN, TEST_SEND_ROUTE_NOT_READY, TEST_SEND_UNAVAILABLE, SENDING_DOMAIN_UNVERIFIED, IDEMPOTENCY_KEY_REUSED, IDEMPOTENCY_KEY_IN_USE, IDEMPOTENCY_KEY_OUTCOME_UNKNOWN, CONTENT_NOT_RETAINED, RECIPIENT_EMAIL_MISSING, RECIPIENT_EMAIL_UNSUPPORTED, TEMPLATE_NOT_PUBLISHED, TEMPLATE_ENVELOPE_INCOMPLETE, PUSH_APP_NOT_READY, PUSH_DESTINATION_MISSING, FORM_CLOSED

messagestringrequired
errorsFieldError[]optional

Each field the request got wrong: on VALIDATION_ERROR and DRAFT_INCOMPLETE.

6 child attributes
instringoptional

The part of the request the field is in, when known.

one of body, query, params, headers

fieldstringrequired

Dotted path to the field (blocks.0.text); empty for the whole part.

codestringoptional

The rule that failed (too_big, invalid_type, custom, …).

messagestringrequired

Plain words, meant to be shown beside the field.

minimumnumberoptional

The bound a too_small rule set.

maximumnumberoptional

The bound a too_big rule set.

detailsobjectoptional

What else the error carries, by code: see that code's description.

requestIdstringoptional