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:
| Field | Type | Description |
|---|---|---|
click_id | string | The Affilync click ID from the redirect (query param afk_cid) |
order_id | string | Your unique order identifier (for deduplication) |
amount | string | Conversion value |
Optional fields:
| Field | Type | Description |
|---|---|---|
currency | string | ISO 4217 code (default: USD) |
event_type | string | sale, lead, signup, trial (default: sale) |
customer_email | string | Hashed for privacy; used for cross-device attribution |
metadata | object | Custom 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}¤cy={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:
| Parameter | Type | Description |
|---|---|---|
date_from | string | ISO 8601 start |
date_to | string | ISO 8601 end |
campaign_id | string | Filter by campaign |
affiliate_id | string | Filter by affiliate (brands only) |
status | string | pending, approved, rejected |
page | int | Page number |
per_page | int | Results 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.