Refport
API ReferenceTrack

Track Lead

Report a lead conversion event — typically a user sign-up — and attribute it to a referral click.

POST /api/track/lead

Reports a lead event for a customer who arrived via a Refport referral link. Use this to attribute sign-ups and account creations to the partner who referred them.

Request

Headers

HeaderValue
AuthorizationBearer YOUR_API_KEY
Content-Typeapplication/json

Body

{
  "clickId": "abc123",
  "eventName": "Sign Up",
  "customerExternalId": "user_001",
  "customerEmail": "alice@example.com",
  "customerName": "Alice",
  "customerAvatar": "https://example.com/avatar.png",
  "metadata": {
    "plan": "free"
  }
}
FieldTypeRequiredDescription
clickIdstringYesThe refp_id click ID from the user's cookie
eventNamestringYesDescriptive name for the event (e.g. "Sign Up")
customerExternalIdstringYesYour internal user ID — used to link future sales to this lead
customerEmailstringNoUser's email address
customerNamestringNoUser's display name
customerAvatarstringNoURL to the user's avatar
metadataobjectNoArbitrary key-value data attached to the event

Response

200 OK

{
  "eventName": "Sign Up",
  "click": {
    "id": "clk_xyz"
  },
  "link": {
    "id": "lnk_abc",
    "domain": "go.yoursite.com",
    "key": "alice",
    "url": "https://yoursite.com",
    "programId": "prog_001"
  },
  "customer": {
    "externalId": "user_001",
    "email": "alice@example.com",
    "name": "Alice"
  }
}

Error responses

StatusCodeDescription
400INVALID_CLICK_IDThe clickId does not match any recorded click
400VALIDATION_ERRORMissing or malformed required field
401UNAUTHORIZEDInvalid or missing API key
429RATE_LIMIT_EXCEEDEDToo many requests — retry after backing off

SDK equivalent

await refport.track.lead({
  clickId: 'abc123',
  eventName: 'Sign Up',
  customerExternalId: 'user_001',
  customerEmail: 'alice@example.com',
});

See the Node.js SDK reference for full parameter details.

On this page