Send one event, or up to 100 events
POST /api/v1/events
The key needs the scope events:write
Records what happened to a lead: it came in, it was contacted, qualified, sold, refunded.
Send one event object as the body, or an object with events for a batch. The workspace is the workspace of the key; a workspace id in the body is never read. An event seen before (the same source and event_id, or the same source, type and external_id) is answered with the status duplicate and the first result, and changes nothing, so sending again is always safe. A single event that is not valid is answered 422 and kept as a reconciliation error; in a batch it is reported as rejected in its own result and the rest is still stored. An event that names a lead nobody knows yet is stored with the warning unmatched_lead and applied when that lead arrives. Times are kept as sent. This call counts against the rate limit of the key and against the limit for event ingestion.
Request
| Parameter | In | Needed | What it is |
|---|---|---|---|
Idempotency-Key | header | no | Your own unique value for this request, 8 to 191 characters. A repeat with the same key and the same body returns the first response with the header Idempotent-Replay: true. Events are also recognized by their own event_id, so a retry without this header is safe as well. |
Body
| Field | Type | Needed | What it is |
|---|---|---|---|
events | array of object | no | A batch of 1 to 100 events. For a single event, leave events out and send the fields of the event as the body itself, as in the example. |
events[]. | string | yes | Your id for this event: up to 96 printable characters without spaces. The same id from the same source is the same event, so sending it again is safe. |
events[]. | integer | no | Version of this event format. Only 1 exists.One of: 1 |
events[]. | string | yes | What happened.One of: page_view, link_click, form_started, lead_created, lead_contacted, lead_qualified, lead_disqualified, appointment_booked, opportunity_created, quote_sent, sale_won, sale_lost, sale_refunded |
events[]. | string (date-time) | yes | When it happened, as ISO 8601 with an offset. Kept as sent; at most one day ahead of now. |
events[]. | string | no | Which of your systems reports it. The default is api. An event is recognized as seen before only within its source.One of: api, crm, website |
events[]. | string | no | Your id of the record the event creates: the lead for lead_created, the sale for sale_won, the refund for sale_refunded. The same id is the same record. |
events[]. | string | no | The visitor session the event belongs to: 16 to 64 letters, digits, hyphens or underscores. Send it only when the visitor consented. Visits (page_view, link_click, form_started) are kept only with a session and consent. |
events[]. | string | no | The HeyMySocial id of the lead the event is about (26 characters). |
events[]. | string | no | Your id of the lead the event is about: the external_id you sent with its lead_created. Every event except lead_created and visits needs lead_id or this. |
events[]. | string | no | The reference code of the campaign, when you know it. Leave it out when you do not. |
events[]. | string | no | Your reference for the ad, when you know it. |
events[]. | string | no | Your reference for the creative, when you know it. |
events[]. | string | no | Consent to tracking. The default is unknown. Use not_applicable when no consent question applies, such as a phone call or a record from a CRM.One of: granted, denied, unknown, not_applicable |
events[]. | string | no | Marks this event as a correction of an earlier one and names its event_id: a corrected status, or a corrected sale amount. |
events[]. | boolean | no | True for a test event. It is stored and shown as received, creates nothing and is not counted as usage. |
events[]. | object | no | What the event carries, by type. At most 16384 bytes as JSON. Contact details and form answers go to the lead and are never kept in the event log. |
events[]. | object | no | lead_created: who the lead is, with name, email, phone and company. At least a name, an email address or a phone number is needed. |
events[]. | object | no | lead_created: the answers of the form, as up to 40 pairs of field name and value. They are shown on the lead. |
events[]. | string | no | lead_created: the hms_ref value a tracked link added to the address of the landing page. It ties the lead to that click. |
events[]. | string | no | lead_created: the code of the tracked link the lead came through, when there is no hms_ref. |
events[]. | string | no | lead_created: where the lead already is, for a lead that is not new. A lead stated as won becomes an opportunity with the warning won_without_sale, because a sale needs its own sale_won event.One of: contacted, qualified, disqualified, opportunity, won, lost |
events[]. | string | no | lead_created: a note to keep on the lead. |
events[]. | boolean | no | lead_created: whether the person agreed to be contacted (the consent box of a form). Leave it out when they were not asked. |
events[]. | string | no | lead_created: where that consent was given. |
events[]. | string | no | lead_disqualified and sale_lost: why. |
events[]. | string | no | appointment_booked: what the appointment is. It becomes the next step of the lead. |
events[]. | string (date-time) | no | appointment_booked: when the appointment is. The default is occurred_at. |
events[]. | string | no | opportunity_created and quote_sent: what the opportunity is called. |
events[]. | number | no | opportunity_created and quote_sent: the estimated value in major units. |
events[]. | integer | no | The estimated value in minor units, instead of estimated_value. |
events[]. | number | no | sale_won and sale_refunded: the amount in major units (84000 is 84,000.00). A sale or a refund needs amount or amount_minor. |
events[]. | integer | no | The amount in minor units, instead of amount. |
events[]. | string | no | ISO 4217 code of the amount or the estimated value. The default is the currency of the workspace. |
events[]. | string | no | sale_won: what the amount stands for: booked (the default), invoiced or collected.One of: booked, invoiced, collected |
events[]. | string | no | sale_won: how the sale was verified. The default is manual, or crm when source is crm.One of: manual, crm, invoice |
events[]. | string | no | sale_refunded: your id of the sale that is refunded. It may be left out when the lead has exactly one sale. |
events[]. | string | no | sale_refunded: the HeyMySocial id of the sale, instead of sale_external_id. |
events[]. | object | no | The click id an ad platform put in the address, as an object with type and value. It is kept only when consent_state is granted, and only as a hash. |
curl -X POST https://heymysocial.com/api/v1/events \
-H "Authorization: Bearer $HMS_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"event_id": "form-7f3a9c2e",
"type": "lead_created",
"occurred_at": "2026-11-25T09:12:44+01:00",
"source": "website",
"external_id": "web-lead-2291",
"campaign_ref": "spring-roof",
"consent_state": "granted",
"properties": {
"contact": {
"name": "Anders Holm",
"email": "anders@example.com",
"phone": "+45 55 51 98 76",
"company": "Holm VVS"
},
"form": {
"message": "Call me after four",
"roof_type": "tile"
}
}
}'
Responses
202 The single event was stored.
| Field | Type | What it is |
|---|---|---|
status | string | accepted (stored and applied), duplicate (seen before: the first result is returned and nothing changed) or rejected (not a valid event: nothing stored). |
event_id | string | The HeyMySocial id of the stored event. It is not the event_id you sent. |
lead_id | string | Id of the lead the event created or was applied to, when there is one. |
sale_id | string | Id of the sale or refund the event recorded, when there is one. |
warning | string | The event was stored, but something is open: unmatched_lead (the lead is not known yet), unmatched_sale (the refund or correction names no known sale), not_applied (the lead could not take this change) or won_without_sale. All but the last are listed as reconciliation errors. |
errors | object | For rejected: what is wrong, as a list of messages for each field. |
test | boolean | True when the event was a test event. Left out otherwise. |
{
"status": "accepted",
"event_id": "01m88q4x4d3xmn1bh68e35b303",
"lead_id": "01m88q4x4fnc553a2pf9pk2y8s"
}
200 The results of a batch, one for each event. A single event that was seen before is answered 200 too, with one result object whose status is duplicate. The example answers a batch of two: the lead above sent again, and a sale_won for it.
| Field | Type | What it is |
|---|---|---|
accepted | integer | Events that were stored. |
duplicates | integer | Events that were seen before and changed nothing. |
rejected | integer | Events that are not valid. Each is kept as a reconciliation error. |
results | array of object | One result for each event, in the order sent. |
results[]. | string | accepted (stored and applied), duplicate (seen before: the first result is returned and nothing changed) or rejected (not a valid event: nothing stored). |
results[]. | string | The HeyMySocial id of the stored event. It is not the event_id you sent. |
results[]. | string | Id of the lead the event created or was applied to, when there is one. |
results[]. | string | Id of the sale or refund the event recorded, when there is one. |
results[]. | string | The event was stored, but something is open: unmatched_lead (the lead is not known yet), unmatched_sale (the refund or correction names no known sale), not_applied (the lead could not take this change) or won_without_sale. All but the last are listed as reconciliation errors. |
results[]. | object | For rejected: what is wrong, as a list of messages for each field. |
results[]. | boolean | True when the event was a test event. Left out otherwise. |
{
"accepted": 1,
"duplicates": 1,
"rejected": 0,
"results": [
{
"status": "duplicate",
"event_id": "01m88q4x4d3xmn1bh68e35b303",
"lead_id": "01m88q4x4fnc553a2pf9pk2y8s"
},
{
"status": "accepted",
"event_id": "01m88q4x59kbsehrgk3rps3a33",
"lead_id": "01m88q4x4fnc553a2pf9pk2y8s",
"sale_id": "01m88q4x5as85jrt935y653wwz"
}
]
}
401 unauthenticated: the API key is missing, mistyped, revoked or expired.
The error shape and every code
403 access_denied: the key lacks the scope events:write.
The error shape and every code
409 duplicate: the Idempotency-Key was already used with a different request, or the first request with it is still running (then retryable is true).
The error shape and every code
422 validation_failed: the single event is not valid (details names each field), the body is empty, or events is not a list of 1 to 100 events.
The error shape and every code