Record contact events in a batch
Validates the full request shape, contact references, and event names before processing.
POST
Validates the full request shape, contact references, and event names before processing. A schema failure rejects the entire batch without writes. Between 1 and 100 valid entries are then processed in input order, with independent indexed results for properties limits, contact resolution, and domain validation. An optional Idempotency-Key header scopes the batch; retries reuse each entry's original receipt by its position in the batch.
apiKeyheader
x-api-key<token>idempotency-key?stringLength
1 <= length <= 255application/json- body
events*array<>Items
1 <= items <= 100BatchEventsResult
application/json- response
total*integerRange
-9007199254740991 <= value <= 9007199254740991accepted*integerRange
-9007199254740991 <= value <= 9007199254740991errors*integerRange
-9007199254740991 <= value <= 9007199254740991results*array<>import { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
const result = await samva.events.batch({
"events": [
{
"contact": {
"id": "example"
},
"name": "example"
}
]
});Example Response
{
"total": -9007199254740991,
"accepted": -9007199254740991,
"errors": -9007199254740991,
"results": [
{
"index": -9007199254740991,
"status": "accepted",
"event": {
"id": "string",
"contactId": "string",
"name": "string",
"source": "api",
"properties": {
"property1": "string",
"property2": "string"
},
"occurredAt": "string",
"recordedAt": "string"
},
"error": "string"
}
]
}