Tugus Docs

Send event

POST
/collect/{api_key}

Sends a server-to-server event. No Authorization header required — the property-specific API key is part of the URL. PII fields inside user (email, phone, first name) are hashed with SHA-256 server-side before forwarding.

Path Parameters

api_key*string

Property-specific API key (dashboard under Websites → your website → Script).

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Event envelope. Identity/context fields live at the top level; all event and commerce fields are nested inside data. For purchase and refund, data.value and data.currency are required.

Response Body

application/json

application/json

curl -X POST "https://example.com/collect/th_YOUR_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "event": "purchase",    "event_id": "purchase_ORD-2024-001",    "client_id": "optional_if_available",    "data": {      "order_id": "ORD-2024-001",      "value": 99.8,      "currency": "EUR"    },    "user": {      "email": "kunde@example.com"    }  }'
{  "ok": true,  "event_id": "a3f8b2c1-d4e5-f6a7-b8c9-d0e1f2a3b4c5"}
Empty
Empty
{  "message": "The data.value field is required. (and 1 more error)",  "errors": {    "data.value": [      "The data.value field is required."    ],    "data.currency": [      "The data.currency field is required."    ]  }}
Empty