Sending your own events
Record what contacts do in your own product, to use in flows, segments and conversions.
Record anything your contacts do in your own product, like “Started trial”, “Booked a demo” or “Upgraded plan”. Each one can start a flow, be used in a segment, or count as a conversion. Your server sends it to POST/events. For orders, use Sending orders instead.
Before you start
Create an API key with Events → Full access (events:write). See Permissions.
Send an event
curl
curl -X POST https://yousendit.io/api/v1/events \
-H "Authorization: Bearer $YOUSENDIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"metric": "Booked a demo",
"profile": { "email": "sam@example.com" },
"value": "500",
"currency": "USD",
"properties": { "plan": "pro", "seats": 12 },
"unique_id": "demo-8812"
}'| Field | What it is |
|---|---|
| metricRequired | The activity's name. A new name creates it, and it appears in the app's lists (at most 200 of your own). |
| profileRequired | Who did it: exactly one of email, external_id or id. If no contact has that email or External ID yet, one is created (see below). An id must be an existing contact’s. |
| unique_id | Your id for this event. Sending it again records nothing, so retries are safe. |
| occurred_at | When it happened (default: now). Events more than 48 hours old are past activity: they never start a flow. |
| value, currency | What it was worth. Used when a conversion takes "the activity's own value". |
| properties | Any details, as JSON. You can filter on them in conversions and segments (plan is pro), and use them in the emails of a flow the event starts. |
The answer is 201 with the stored event, or 200 with status: "duplicate" when that unique_id was already recorded.
New contacts
An event for an email or External ID you have never sent before creates the contact, so you don’t need to create people first. The new contact:
- has only that email or External ID. Add names and fields with Create or update profile, before or after.
- is not subscribed to your emails: an event is not consent. Subscribe people through a form, or by sending
subscriptionwith the profile. - is not created for an address that was erased at the person’s request.
Many at once, and history
- Record events in bulk: up to 1,000 events in one request, each with its own result.
- Import past events: your history, stored as past activity (never starts a flow). The key also needs the Import past events permission.
Good to know
- Events from the API count against your plan’s monthly event allowance (orders do not).
- To see what was recorded: List events, or the contact’s timeline in the app.