Docs · Conversions API
POST /api/leads_track
Record a lead or sale against the click that drove it. Bearer-auth with a workspace API key (write scope). Concept walkthrough: conversion tracking.
Request
POST https://slugy.co/api/leads_track
Authorization: Bearer <workspace API key>
Content-Type: application/json
{
"clickId": "clk_abc123",
"eventName": "Sign up",
"customerExternalId": "user_123",
"customerEmail": "buyer@example.com"
}- clickId (string, required): the slugy_click_id captured at landing. Unknown or cross-workspace IDs return 404.
- eventName (string ≤120 chars, required): e.g. “Sign up”, “Purchase”. Dedup key includes this — distinct names count separately.
- customerExternalId (string ≤255 chars, required): your user or order ID. Dedup key includes this — replays are idempotent.
- customerEmail (email, optional): attribution identity; falls back gracefully when omitted.
- customerName (string, optional): stored on the customer record.
- metadata (JSON object, optional): must be JSON-serializable; forwarded to webhooks.
- saleAmount (positive number, optional): revenue in major units. Growth-only — other plans get 403.
- saleCurrency (3-letter code, optional): normalized to uppercase, e.g. USD.
Responses
- 201 Created — { leadEventId } on first recording (200 with “Sale already recorded” on idempotent replay).
- 404 — unknown clickId (or cross-workspace ID). Log and continue; the underlying signup/order still exists in your system.
- 422 — missing clickId/eventName/customerExternalId or non-serializable metadata.
- 403 — lead tracking needs Pro/Growth; saleAmount needs Growth. API-key scope failures also land here.
- 401 — missing/invalid Bearer key. 429 — per-key throttle (300/min).
Attribution rules (90-day window, last-click-wins, idempotent replays) are explained in the feature guide. Fan-out to automation: webhooks.