Record events
const url = 'https://api.sendwing.app/api/organizations/example/events';const options = { method: 'POST', headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'}, body: '{"events":[{"contactId":"example","email":"example","name":"example","properties":{"additionalProperty":"example"}}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The workspace, like org_…. An OAuth access token works in the one the member picked when connecting, which GET /me returns.
Request Bodyrequired
Section titled “Request Bodyrequired”object
object
The contact, by ID. Send this or email.
The contact, by email. Send this or contactId.
What the contact did, like signed_up or order.paid: up to 100 letters, digits, _, ., : or -, starting with a letter or digit
Example generated
{ "events": [ { "contactId": "example", "email": "example", "name": "example", "properties": { "additionalProperty": "example" } } ]}Responses
Section titled “Responses”What was recorded
object
How many events were recorded
Positions in events (from 0) whose contact doesn’t exist
Example generated
{ "recorded": 1, "notFound": [ 1 ]}The request isn’t valid; issues lists each problem
object
What went wrong, in words you can show people
For a 400: each invalid field, by its path in the request, like events.0.name
object
For a 5xx: quote it when contacting support
Example generated
{ "error": "example", "issues": [ { "path": "example", "message": "example" } ], "requestId": "example"}The API key or access token is missing, invalid or expired
object
What went wrong, in words you can show people
For a 400: each invalid field, by its path in the request, like events.0.name
object
For a 5xx: quote it when contacting support
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
object
What went wrong, in words you can show people
For a 400: each invalid field, by its path in the request, like events.0.name
object
For a 5xx: quote it when contacting support
Example generated
{ "error": "example", "issues": [ { "path": "example", "message": "example" } ], "requestId": "example"}Too many requests; wait for the seconds in Retry-After
object
What went wrong, in words you can show people
For a 400: each invalid field, by its path in the request, like events.0.name
object
For a 5xx: quote it when contacting support
Example generated
{ "error": "example", "issues": [ { "path": "example", "message": "example" } ], "requestId": "example"}