Skip to content
Denne side findes på dansk. Læs på dansk
HeyMySocial

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

ParameterInNeededWhat it is
Idempotency-KeyheadernoYour 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

FieldTypeNeededWhat it is
eventsarray of objectno 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[].event_idstringyes 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[].schema_versionintegerno Version of this event format. Only 1 exists.One of: 1
events[].typestringyes 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[].occurred_atstring (date-time)yes When it happened, as ISO 8601 with an offset. Kept as sent; at most one day ahead of now.
events[].sourcestringno 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[].external_idstringno 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[].session_idstringno 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[].lead_idstringno The HeyMySocial id of the lead the event is about (26 characters).
events[].lead_external_idstringno 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[].campaign_refstringno The reference code of the campaign, when you know it. Leave it out when you do not.
events[].ad_refstringno Your reference for the ad, when you know it.
events[].creative_refstringno Your reference for the creative, when you know it.
events[].consent_statestringno 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[].corrects_event_idstringno Marks this event as a correction of an earlier one and names its event_id: a corrected status, or a corrected sale amount.
events[].testbooleanno True for a test event. It is stored and shown as received, creates nothing and is not counted as usage.
events[].propertiesobjectno 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[].properties.contactobjectno 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[].properties.formobjectno lead_created: the answers of the form, as up to 40 pairs of field name and value. They are shown on the lead.
events[].properties.hms_refstringno 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[].properties.tracking_linkstringno lead_created: the code of the tracked link the lead came through, when there is no hms_ref.
events[].properties.statusstringno 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[].properties.notestringno lead_created: a note to keep on the lead.
events[].properties.contact_consentbooleanno lead_created: whether the person agreed to be contacted (the consent box of a form). Leave it out when they were not asked.
events[].properties.contact_consent_sourcestringno lead_created: where that consent was given.
events[].properties.reasonstringno lead_disqualified and sale_lost: why.
events[].properties.titlestringno appointment_booked: what the appointment is. It becomes the next step of the lead.
events[].properties.starts_atstring (date-time)no appointment_booked: when the appointment is. The default is occurred_at.
events[].properties.namestringno opportunity_created and quote_sent: what the opportunity is called.
events[].properties.estimated_valuenumberno opportunity_created and quote_sent: the estimated value in major units.
events[].properties.estimated_value_minorintegerno The estimated value in minor units, instead of estimated_value.
events[].properties.amountnumberno 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[].properties.amount_minorintegerno The amount in minor units, instead of amount.
events[].properties.currencystringno ISO 4217 code of the amount or the estimated value. The default is the currency of the workspace.
events[].properties.revenue_basisstringno sale_won: what the amount stands for: booked (the default), invoiced or collected.One of: booked, invoiced, collected
events[].properties.verification_sourcestringno sale_won: how the sale was verified. The default is manual, or crm when source is crm.One of: manual, crm, invoice
events[].properties.sale_external_idstringno sale_refunded: your id of the sale that is refunded. It may be left out when the lead has exactly one sale.
events[].properties.sale_idstringno sale_refunded: the HeyMySocial id of the sale, instead of sale_external_id.
events[].properties.click_idobjectno 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.

FieldTypeWhat it is
statusstringaccepted (stored and applied), duplicate (seen before: the first result is returned and nothing changed) or rejected (not a valid event: nothing stored).
event_idstringThe HeyMySocial id of the stored event. It is not the event_id you sent.
lead_idstringId of the lead the event created or was applied to, when there is one.
sale_idstringId of the sale or refund the event recorded, when there is one.
warningstringThe 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.
errorsobjectFor rejected: what is wrong, as a list of messages for each field.
testbooleanTrue 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.

FieldTypeWhat it is
acceptedintegerEvents that were stored.
duplicatesintegerEvents that were seen before and changed nothing.
rejectedintegerEvents that are not valid. Each is kept as a reconciliation error.
resultsarray of objectOne result for each event, in the order sent.
results[].statusstringaccepted (stored and applied), duplicate (seen before: the first result is returned and nothing changed) or rejected (not a valid event: nothing stored).
results[].event_idstringThe HeyMySocial id of the stored event. It is not the event_id you sent.
results[].lead_idstringId of the lead the event created or was applied to, when there is one.
results[].sale_idstringId of the sale or refund the event recorded, when there is one.
results[].warningstringThe 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[].errorsobjectFor rejected: what is wrong, as a list of messages for each field.
results[].testbooleanTrue 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

429 rate_limited: too many requests in one minute, for this key or for event ingestion. Wait and send it again; the events keep their event_id, so nothing is counted twice.

The error shape and every code