Send EventsPOST /collect

Send Events

Send events to Hardal with an HTTP POST to the /collect endpoint.

curl -X POST "https://analytics.yourdomain.com/collect" \
  -H "Content-Type: application/json" \
  -H "tenant-id: your-tenant-id" \
  -H "x-virgo-session-id: 123e4567-e89b-12d3-a456-426614174000" \
  -H "x-virgo-consent: granted" \
  -d '{
  "type": "event",
  "eventName": "purchase",
  "payload": {
    "sourceId": "your-source-id",
    "title": "Order Confirmed",
    "hostname": "www.yourdomain.com",
    "url": "https://www.yourdomain.com/order/confirmation",
    "timestamp": 1773914400000,
    "data": {
      "transaction_id": "ORD-20260615-7891",
      "value": 214.98,
      "currency": "USD",
      "items": [
        {
          "item_id": "SNK-URBAN-10",
          "item_name": "UrbanGlide Sneakers",
          "price": 134.99,
          "quantity": 1
        }
      ]
    }
  }
}'
{
  "success": true,
  "data": {
    "accepted": 1,
    "events": [
      {
        "eventId": "123e4567-e89b-12d3-a456-426614174000",
        "sourceId": "your-source-id"
      }
    ],
    "consentStatus": "granted"
  },
  "timestamp": "2024-12-25T10:00:00Z",
  "path": "/collect",
  "requestId": "example_string"
}
POST
/collect
POST
Base URLstring

Target server for requests. Edit to use your own host.

Content-Typestring
Required

The media type of the request body

Options: application/json
header
tenant-idstring
Required

Your Tenant ID from Setup in the Dashboard.

header
x-virgo-session-idstring

Stable UUID for the current app or server session. If omitted, Hardal creates a session ID.

Format: uuid
No request body parameters defined
Request Preview
Response

Response will appear here after sending the request

Headers

tenant-idstring
Required

Your Tenant ID from Setup in the Dashboard.

Example:
your-tenant-id
x-virgo-session-idstring

Stable UUID for the current app or server session. If omitted, Hardal creates a session ID.

Body

application/json
datastring
Required

Raw application/json data

Responses

Send events straight to Hardal over HTTP. The reference and live playground below are generated from the API spec, so you can fill in your own values and send a test event to your first-party URL.