Skip to main content
The Attribution API computes credit assignment across touchpoints that led to a conversion. Supports five attribution models.

POST /api/v1/attribution

Compute attribution for a customer conversion. Rate limited to 100 requests/min. Editor or Admin.

Request Body

FieldTypeRequiredDescription
customerIdstringYesCustomer identifier
conversionIdstringYesUnique conversion event ID
modelstringNoAttribution model (default: linear)
conversionValuenumberNoMonetary value of the conversion (default: 1)

Attribution Models

ModelDescription
last_touch100% credit to the last touchpoint before conversion
first_touch100% credit to the first touchpoint
linearEqual credit distributed across all touchpoints
time_decayMore credit to touchpoints closer to conversion
position_based40% to first, 40% to last, 20% distributed across middle

Example

curl -X POST https://playground.kaireonai.com/api/v1/attribution \
  -H "Content-Type: application/json" \
  -H "X-Tenant-Id: my-tenant" \
  -d '{
    "customerId": "C-1234",
    "conversionId": "conv_abc123",
    "model": "time_decay",
    "conversionValue": 99.99
  }'

Response (201)

{
  "customerId": "C-1234",
  "conversionId": "conv_abc123",
  "model": "time_decay",
  "totalValue": 99.99,
  "touchpoints": [
    { "offerId": "offer_1", "channelId": "ch_email", "credit": 0.15, "value": 14.99 },
    { "offerId": "offer_2", "channelId": "ch_push", "credit": 0.35, "value": 35.00 },
    { "offerId": "offer_1", "channelId": "ch_sms", "credit": 0.50, "value": 50.00 }
  ]
}

GET /api/v1/attribution

Query attribution results. Editor or Admin.

Query Parameters

ParameterTypeRequiredDescription
customerIdstringNoFilter by customer
modelstringNoFilter by attribution model
limitnumberNoMax results (default: 50, max: 200)
offsetnumberNoPagination offset

Response

{
  "data": [ ... ],
  "pagination": {
    "total": 42,
    "limit": 50,
    "offset": 0,
    "hasMore": false
  }
}