Skip to main content

Conversions API

Report conversions to Affilync via server-side API calls, JavaScript pixel, or postback URLs. All conversion methods support deduplication via order_id.

Server-Side Conversion

The recommended approach for accurate attribution.

curl -X POST https://api.affilync.com/api/conversions/track \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"click_id": "clk_abc123",
"order_id": "order_456",
"amount": "99.99",
"currency": "USD",
"event_type": "sale",
"customer_email": "[email protected]",
"metadata": {
"product_id": "prod_789",
"coupon_code": "SUMMER20"
}
}'

Response (201):

{
"data": {
"conversion_id": "conv_abc123",
"click_id": "clk_abc123",
"affiliate_id": "usr_xyz789",
"campaign_id": "camp_abc123",
"commission_amount": "10.00",
"status": "pending",
"created_at": "2026-03-20T14:30:00Z"
}
}

Required fields:

FieldTypeDescription
click_idstringThe Affilync click ID from the redirect (query param afk_cid)
order_idstringYour unique order identifier (for deduplication)
amountstringConversion value

Optional fields:

FieldTypeDescription
currencystringISO 4217 code (default: USD)
event_typestringsale, lead, signup, trial (default: sale)
customer_emailstringHashed for privacy; used for cross-device attribution
metadataobjectCustom key-value pairs

JavaScript Pixel

For client-side tracking, add the Affilync pixel to your thank-you page:

<script src="https://track.affilync.com/pixel.js" async></script>
<script>
affilync('track', 'conversion', {
order_id: 'order_456',
amount: 99.99,
currency: 'USD'
});
</script>

The pixel automatically reads the afk_cid cookie set during the click redirect.

Postback URL

For platforms that support server-to-server postbacks, use this URL template:

https://api.affilync.com/api/conversions/postback?click_id={click_id}&amount={amount}&order_id={order_id}&currency={currency}

Authenticate with ?api_key=YOUR_API_KEY or the Authorization header.


List Conversions

curl "https://api.affilync.com/api/conversions?date_from=2026-03-01&date_to=2026-03-31" \
-H "Authorization: Bearer YOUR_TOKEN"

Query Parameters:

ParameterTypeDescription
date_fromstringISO 8601 start
date_tostringISO 8601 end
campaign_idstringFilter by campaign
affiliate_idstringFilter by affiliate (brands only)
statusstringpending, approved, rejected
pageintPage number
per_pageintResults per page

Update Conversion Status

Brands can approve or reject pending conversions.

curl -X PATCH https://api.affilync.com/api/conversions/conv_abc123 \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"status": "approved",
"note": "Verified in our system"
}'

Deduplication

Conversions are deduplicated by order_id. Submitting the same order_id twice returns the original conversion without creating a duplicate. This ensures idempotent conversion reporting.

Attribution Window

Conversions are attributed to clicks within the campaign's cookie window (default: 30 days). The click_id takes priority over cookie-based attribution.