POST /api/track/lead

Record a lead event. Server-side. Idempotent on externalId.

Endpoint

POST https://partli.app/api/track/lead

Headers

Authorization: Bearer pk_live_...
Content-Type: application/json

Body

{
  "externalId": "signup_abc123",         // required, your unique id (dedupe key)
  "customerEmail": "[email protected]",   // optional
  "customerName": "Alex",                // optional
  "clickId": "c_aB3xY9ZqLp",             // optional but required for attribution
  "eventName": "signup",                 // optional, default "lead"
  "metadata": { "source": "homepage" }   // optional, free-form jsonb
}

Response

{
  "eventId": "uuid-of-event",  // null if not attributed
  "attributed": true
}

Behavior

  • Without clickId: event recorded but not attributed; no commission
  • With unresolvable or expired clickId: same — no attribution
  • With valid clickId: customer + event created, attributed to the partner
  • If the partner's group has a lead reward: a commission is created

Errors

  • 401 Unauthorized — bad API key
  • 400 Bad Request — invalid request body

Re-posting the same externalId is a silent no-op — safe to retry.