Skip to content

EventsBatch_submit

POST
/events/batch
curl --request POST \
--url http://localhost:3000/api/events/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "backfill": true, "events": [ { "subjectId": "example", "action": "example", "email": "hello@example.com", "phone": "example", "properties": { "additionalProperty": "example" }, "occurredAt": "2026-04-15T12:00:00Z", "clientEventId": "example" } ] }'

Record up to 1000 events; a failing item does not affect the others

Media typeapplication/json

Request body for recording events one by one with per-item results

object
backfill

Load history: the events are only recorded, so segments see them but no Automation enrolls on them and no webhook endpoint receives them. Use it to bring the events of an earlier system into a new setup. Defaults to false.

boolean
events
required

Events to record, at most 1000

Array<object>
>= 1 items <= 1000 items

Event payload

object
subjectId
required

Canonical subject identifier

string
action
required

Event action

string
email

Email address associated with the event

string format: email
<= 320 characters
phone

Phone number associated with the event

string
nullable
properties

Event properties

object
key
additional properties
occurredAt

Event occurrence timestamp

string format: date-time
clientEventId

A client-chosen id that makes a retry safe. It is unique within the Workspace: sending an event again with the same id changes nothing, so a load that broke off halfway is resent whole. Generate it once per event (a UUID) and reuse it on every retry. An event without one is not deduplicated.

string
nullable >= 1 characters <= 255 characters

Example generated

{
"backfill": true,
"events": [
{
"subjectId": "example",
"action": "example",
"email": "hello@example.com",
"phone": "example",
"properties": {
"additionalProperty": "example"
},
"occurredAt": "2026-04-15T12:00:00Z",
"clientEventId": "example"
}
]
}

The request has succeeded.

Media typeapplication/json

Per-item results of an events batch

object
results
required

One result per request item, in request order

Array<object>

Per-item result of an events batch, in request order

object
index
required

Zero-based position of the item in the request

integer format: int32
status
required

Accepted when published; failed when the item was rejected

string
Allowed values: accepted failed
error

Why the item failed; absent when accepted

string

Example

{
"results": [
{
"status": "accepted"
}
]
}

RFC 7807 bad request response

Media typeapplication/problem+json

RFC 7807 Problem Details

object
code

Why the request was refused, when the client should act on it

string
Allowed values: second_factor_required email_verification_required signup_closed
type

A URI reference that identifies the problem type

string
title

A short, human-readable summary of the problem type

string
status

HTTP status code

integer format: int32
detail

A human-readable explanation specific to this occurrence

string
instance

A URI reference that identifies the specific occurrence

string
errors

Validation errors grouped by field

object
key
additional properties
Array<string>
form

Form-level validation error

string
fields

Field validation errors

object
key
additional properties
string
retryAfter

Seconds to wait before retrying; set on a 429 so a client that only sees the body can show the wait

integer format: int32
debug

Why a 500 happened, sent only by a development server (SPHERICON_ENV=development)

object
error
required

The error that failed the request, or the panic value

string
stack

The goroutine stack of a panic; absent for an error a handler returned

string
requestId

The request id the server log carries for this request

string
method
required

The HTTP method of the failed request

string
path
required

The path of the failed request

string

Example

{
"code": "second_factor_required"
}

RFC 7807 unauthorized response

Media typeapplication/problem+json

RFC 7807 Problem Details

object
code

Why the request was refused, when the client should act on it

string
Allowed values: second_factor_required email_verification_required signup_closed
type

A URI reference that identifies the problem type

string
title

A short, human-readable summary of the problem type

string
status

HTTP status code

integer format: int32
detail

A human-readable explanation specific to this occurrence

string
instance

A URI reference that identifies the specific occurrence

string
errors

Validation errors grouped by field

object
key
additional properties
Array<string>
form

Form-level validation error

string
fields

Field validation errors

object
key
additional properties
string
retryAfter

Seconds to wait before retrying; set on a 429 so a client that only sees the body can show the wait

integer format: int32
debug

Why a 500 happened, sent only by a development server (SPHERICON_ENV=development)

object
error
required

The error that failed the request, or the panic value

string
stack

The goroutine stack of a panic; absent for an error a handler returned

string
requestId

The request id the server log carries for this request

string
method
required

The HTTP method of the failed request

string
path
required

The path of the failed request

string

Example

{
"code": "second_factor_required"
}

RFC 7807 validation response

Media typeapplication/problem+json

RFC 7807 Problem Details

object
code

Why the request was refused, when the client should act on it

string
Allowed values: second_factor_required email_verification_required signup_closed
type

A URI reference that identifies the problem type

string
title

A short, human-readable summary of the problem type

string
status

HTTP status code

integer format: int32
detail

A human-readable explanation specific to this occurrence

string
instance

A URI reference that identifies the specific occurrence

string
errors

Validation errors grouped by field

object
key
additional properties
Array<string>
form

Form-level validation error

string
fields

Field validation errors

object
key
additional properties
string
retryAfter

Seconds to wait before retrying; set on a 429 so a client that only sees the body can show the wait

integer format: int32
debug

Why a 500 happened, sent only by a development server (SPHERICON_ENV=development)

object
error
required

The error that failed the request, or the panic value

string
stack

The goroutine stack of a panic; absent for an error a handler returned

string
requestId

The request id the server log carries for this request

string
method
required

The HTTP method of the failed request

string
path
required

The path of the failed request

string

Example

{
"code": "second_factor_required"
}

RFC 7807 too many requests response: a rate limit was exceeded (ADR 0025)

Media typeapplication/problem+json

RFC 7807 Problem Details

object
code

Why the request was refused, when the client should act on it

string
Allowed values: second_factor_required email_verification_required signup_closed
type

A URI reference that identifies the problem type

string
title

A short, human-readable summary of the problem type

string
status

HTTP status code

integer format: int32
detail

A human-readable explanation specific to this occurrence

string
instance

A URI reference that identifies the specific occurrence

string
errors

Validation errors grouped by field

object
key
additional properties
Array<string>
form

Form-level validation error

string
fields

Field validation errors

object
key
additional properties
string
retryAfter

Seconds to wait before retrying; set on a 429 so a client that only sees the body can show the wait

integer format: int32
debug

Why a 500 happened, sent only by a development server (SPHERICON_ENV=development)

object
error
required

The error that failed the request, or the panic value

string
stack

The goroutine stack of a panic; absent for an error a handler returned

string
requestId

The request id the server log carries for this request

string
method
required

The HTTP method of the failed request

string
path
required

The path of the failed request

string

Example

{
"code": "second_factor_required"
}
Retry-After
required
integer format: int32

Seconds to wait before retrying

X-RateLimit-Limit
required
integer format: int32

The request budget of the window that was exceeded

X-RateLimit-Remaining
required
integer format: int32

Requests left in the current window

X-RateLimit-Reset
required
integer format: int64

Unix time at which the window resets