Skip to content

Record events

POST
/organizations/{organizationId}/events
curl --request POST \
--url https://api.sendwing.app/api/organizations/example/events \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '{ "events": [ { "contactId": "example", "email": "example", "name": "example", "properties": { "additionalProperty": "example" } } ] }'

Records what contacts did, like signed_up or order.paid, up to 100 at a time. Each event goes on its contact’s timeline and starts the active workflows triggered by a custom event of that name. Name each contact by contactId or email. Events for contacts that don’t exist aren’t recorded: their positions in events come back in notFound. Nothing creates a contact.

organizationId
required
string

The workspace, like org_…. An OAuth access token works in the one the member picked when connecting, which GET /me returns.

Media typeapplication/json
object
events
required
Array<object>
>= 1 items <= 100 items
object
contactId

The contact, by ID. Send this or email.

string
email

The contact, by email. Send this or contactId.

string
name
required

What the contact did, like signed_up or order.paid: up to 100 letters, digits, _, ., : or -, starting with a letter or digit

string
/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,99}$/
properties

Details shown on the contact’s timeline, like { "plan": "pro" }. Up to 20, each value up to 500 characters.

object
key
additional properties
Any of:
string
<= 500 characters

Example generated

{
"events": [
{
"contactId": "example",
"email": "example",
"name": "example",
"properties": {
"additionalProperty": "example"
}
}
]
}

What was recorded

Media typeapplication/json
object
recorded
required

How many events were recorded

integer
>= -9007199254740991 <= 9007199254740991
notFound
required

Positions in events (from 0) whose contact doesn’t exist

Array<integer>

Example generated

{
"recorded": 1,
"notFound": [
1
]
}

The request isn’t valid; issues lists each problem

Media typeapplication/json
object
error
required

What went wrong, in words you can show people

string
issues

For a 400: each invalid field, by its path in the request, like events.0.name

Array<object>
object
path
required
string
message
required
string
requestId

For a 5xx: quote it when contacting support

string

Example generated

{
"error": "example",
"issues": [
{
"path": "example",
"message": "example"
}
],
"requestId": "example"
}

The API key or access token is missing, invalid or expired

Media typeapplication/json
object
error
required

What went wrong, in words you can show people

string
issues

For a 400: each invalid field, by its path in the request, like events.0.name

Array<object>
object
path
required
string
message
required
string
requestId

For a 5xx: quote it when contacting support

string

Example generated

{
"error": "example",
"issues": [
{
"path": "example",
"message": "example"
}
],
"requestId": "example"
}

The API key’s permissions, or the app’s scopes and the member’s role, don’t allow this

Media typeapplication/json
object
error
required

What went wrong, in words you can show people

string
issues

For a 400: each invalid field, by its path in the request, like events.0.name

Array<object>
object
path
required
string
message
required
string
requestId

For a 5xx: quote it when contacting support

string

Example generated

{
"error": "example",
"issues": [
{
"path": "example",
"message": "example"
}
],
"requestId": "example"
}

Too many requests; wait for the seconds in Retry-After

Media typeapplication/json
object
error
required

What went wrong, in words you can show people

string
issues

For a 400: each invalid field, by its path in the request, like events.0.name

Array<object>
object
path
required
string
message
required
string
requestId

For a 5xx: quote it when contacting support

string

Example generated

{
"error": "example",
"issues": [
{
"path": "example",
"message": "example"
}
],
"requestId": "example"
}