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-WorkspacestringoptionalPartner 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[]requiredat least 1 item · at most 100 items
2 child attributes
idempotencyKeystringoptionalAs the
Idempotency-Keyheader of a single track: one per event you mean. Optional, but without one a retried entry records the event again.8–255 characters
eventobjectrequiredAny of 3 shapes
- By contact id
5 child attributes
contactIdstringrequiredKirora's id for the contact.
uuid
namestringrequiredCase-sensitive, up to 128 characters once leading and trailing spaces are removed.
contact.*is reserved, andOrdered Productis recorded from eachOrder Completed.pattern
^\P{Cc}+$· 1–128 characterspropertiesmap<string, any>optionalFree-form details of the event; at most 16 KB, keys up to 64 characters,
productsup to 250 lines.default
{}occurredAtstringoptionalWhen it happened; defaults to now. At most 24 hours ahead.
date-time
contextEventContextInputoptionalWhere and on what it happened, beside the properties.
12 child attributes
sessionIdstringoptionalThe visit, from the SDK.
up to 128 characters
localestringoptionalAs BCP 47,
en-GB; extensions such as-u-fw-monare dropped.timezonestringoptionalAs IANA,
Europe/Berlin.up to 64 characters
pageobjectoptionalWeb: the page as visited: query strings kept, fragments removed. A longer value is cut, not refused:
url,searchandreferrerat 8192 characters,pathat 2048,titleat 256.campaignobjectoptionalWeb: the
utm_*parameters of the page, each cut to 256 characters.deviceobjectoptionalappobjectoptionalMobile: the app the event happened in.
osobjectoptionalMobile: the operating system.
screenobjectoptionalMobile: the screen in points (iOS) or pixels (Android), and its scale.
libraryobjectoptionalipstringoptionalup to 64 characters
userAgentstringoptionalup to 1,024 characters
- By external id
5 child attributes
externalIdstringrequiredYour own id for the contact, as set with identify.
1–255 characters
namestringrequiredCase-sensitive, up to 128 characters once leading and trailing spaces are removed.
contact.*is reserved, andOrdered Productis recorded from eachOrder Completed.pattern
^\P{Cc}+$· 1–128 characterspropertiesmap<string, any>optionalFree-form details of the event; at most 16 KB, keys up to 64 characters,
productsup to 250 lines.default
{}occurredAtstringoptionalWhen it happened; defaults to now. At most 24 hours ahead.
date-time
contextEventContextInputoptionalWhere and on what it happened, beside the properties.
12 child attributes
sessionIdstringoptionalThe visit, from the SDK.
up to 128 characters
localestringoptionalAs BCP 47,
en-GB; extensions such as-u-fw-monare dropped.timezonestringoptionalAs IANA,
Europe/Berlin.up to 64 characters
pageobjectoptionalWeb: the page as visited: query strings kept, fragments removed. A longer value is cut, not refused:
url,searchandreferrerat 8192 characters,pathat 2048,titleat 256.campaignobjectoptionalWeb: the
utm_*parameters of the page, each cut to 256 characters.deviceobjectoptionalappobjectoptionalMobile: the app the event happened in.
osobjectoptionalMobile: the operating system.
screenobjectoptionalMobile: the screen in points (iOS) or pixels (Android), and its scale.
libraryobjectoptionalipstringoptionalup to 64 characters
userAgentstringoptionalup to 1,024 characters
- By email
5 child attributes
emailstringrequiredThe contact's email address, matched trimmed and without case.
namestringrequiredCase-sensitive, up to 128 characters once leading and trailing spaces are removed.
contact.*is reserved, andOrdered Productis recorded from eachOrder Completed.pattern
^\P{Cc}+$· 1–128 characterspropertiesmap<string, any>optionalFree-form details of the event; at most 16 KB, keys up to 64 characters,
productsup to 250 lines.default
{}occurredAtstringoptionalWhen it happened; defaults to now. At most 24 hours ahead.
date-time
contextEventContextInputoptionalWhere and on what it happened, beside the properties.
12 child attributes
sessionIdstringoptionalThe visit, from the SDK.
up to 128 characters
localestringoptionalAs BCP 47,
en-GB; extensions such as-u-fw-monare dropped.timezonestringoptionalAs IANA,
Europe/Berlin.up to 64 characters
pageobjectoptionalWeb: the page as visited: query strings kept, fragments removed. A longer value is cut, not refused:
url,searchandreferrerat 8192 characters,pathat 2048,titleat 256.campaignobjectoptionalWeb: the
utm_*parameters of the page, each cut to 256 characters.deviceobjectoptionalappobjectoptionalMobile: the app the event happened in.
osobjectoptionalMobile: the operating system.
screenobjectoptionalMobile: the screen in points (iOS) or pixels (Android), and its scale.
libraryobjectoptionalipstringoptionalup to 64 characters
userAgentstringoptionalup 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[]requiredAny of 2 shapes
- Event recorded
3 child attributes
idempotencyKeystring | nullrequiredreplayedbooleanrequiredTrue when the key was used before and the stored event is returned.
eventTrackedEventrequired3 child attributes
idstringrequireduuid
occurredAtstringrequireddate-time
expiresAtstringrequiredWhen 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 | nullrequirederrorobjectrequired5 child attributes
codestringrequiredone 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_CLOSEDmessagestringrequirederrorsFieldError[]optionalEach field the request got wrong: on
VALIDATION_ERRORandDRAFT_INCOMPLETE.6 child attributes
instringoptionalThe part of the request the field is in, when known.
one of
body,query,params,headersfieldstringrequiredDotted path to the field (
blocks.0.text); empty for the whole part.codestringoptionalThe rule that failed (
too_big,invalid_type,custom, …).messagestringrequiredPlain words, meant to be shown beside the field.
minimumnumberoptionalThe bound a
too_smallrule set.maximumnumberoptionalThe bound a
too_bigrule set.
detailsobjectoptionalWhat else the error carries, by
code: see that code's description.requestIdstringoptional