TugusDeveloper Docs
Server-Side

HTTP API

Send server-to-server events to Tugus over plain HTTP — no client-side dependency required.

For server-to-server events or custom implementations. No client-side dependency.

  • POST https://collect.tugus.io/collect/{api_key}
  • GET https://app.tugus.io/api/v1/properties/{property}/events

Request

curl -X POST https://collect.tugus.io/collect/th_YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d '{
    "event":     "purchase",
    "order_id":  "ORD-2024-001",
    "value":     99.80,
    "currency":  "EUR",
    "user": {
      "email":   "kunde@example.com"
    },
    "client_id": "optional_if_available"
  }'

PHP example

$response = Http::post('https://collect.tugus.io/collect/' . $apiKey, [
  'event'    => 'purchase',
  'order_id' => $order->id,
  'value'    => $order->total,
  'currency' => 'EUR',
  'user'     => [
    'email' => $order->email,  // Tugus hashes server-side
  ],
]);

if ($response->successful()) {
  Log::info('Tugus event accepted', ['event_id' => $response->json('event_id')]);
}

Response

202 Accepted

{
  "ok":       true,
  "event_id": "a3f8b2c1-d4e5-f6a7-b8c9-d0e1f2a3b4c5"
}

On this page