Links API
Create, list, and manage tracking links programmatically. Requires links:read and/or links:write scopes.
List Links
curl https://api.affilync.com/api/links \
-H "Authorization: Bearer YOUR_TOKEN"
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
campaign_id | string | -- | Filter by campaign |
status | string | active | active or deactivated |
page | int | 1 | Page number |
per_page | int | 20 | Results per page (max 100) |
Response (200):
{
"data": [
{
"id": "lnk_x7kQ2mNp",
"campaign_id": "camp_abc123",
"url": "https://track.affilync.com/c/x7kQ2mNp",
"short_url": "https://afl.ink/x7kQ2",
"landing_page_url": "https://example.com/spring",
"sub_id_1": "blog-header",
"sub_id_2": "march-2026",
"sub_id_3": null,
"clicks": 1423,
"unique_clicks": 1102,
"conversions": 87,
"status": "active",
"created_at": "2026-03-10T08:15:00Z"
}
],
"meta": {
"page": 1,
"per_page": 20,
"total": 156
}
}
Create a Link
curl -X POST https://api.affilync.com/api/links \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"campaign_id": "camp_abc123",
"sub_id_1": "email-footer",
"sub_id_2": "welcome-series",
"landing_page_url": "https://example.com/spring?ref=email"
}'
Response (201):
{
"id": "lnk_r9Lm3kWq",
"campaign_id": "camp_abc123",
"url": "https://track.affilync.com/c/r9Lm3kWq",
"short_url": "https://afl.ink/r9Lm3",
"sub_id_1": "email-footer",
"sub_id_2": "welcome-series",
"created_at": "2026-03-21T14:30:00Z"
}
Bulk Create Links
Generate multiple links in one request:
curl -X POST https://api.affilync.com/api/links/bulk \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"links": [
{
"campaign_id": "camp_abc123",
"sub_id_1": "twitter",
"sub_id_2": "bio"
},
{
"campaign_id": "camp_abc123",
"sub_id_1": "instagram",
"sub_id_2": "story"
},
{
"campaign_id": "camp_def456",
"sub_id_1": "blog",
"sub_id_2": "sidebar"
}
]
}'
Response (201):
{
"created": 3,
"links": [
{ "id": "lnk_a1b2c3", "short_url": "https://afl.ink/a1b2c" },
{ "id": "lnk_d4e5f6", "short_url": "https://afl.ink/d4e5f" },
{ "id": "lnk_g7h8i9", "short_url": "https://afl.ink/g7h8i" }
]
}
Maximum 500 links per bulk request.
Get a Link
curl https://api.affilync.com/api/links/lnk_x7kQ2mNp \
-H "Authorization: Bearer YOUR_TOKEN"
Deactivate a Link
curl -X PATCH https://api.affilync.com/api/links/lnk_x7kQ2mNp \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "status": "deactivated" }'
Deactivated links return a 404 page instead of redirecting.
Link Object Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique link identifier |
campaign_id | string | Parent campaign ID |
url | string | Full tracking URL |
short_url | string | Shortened URL |
landing_page_url | string | Destination URL |
sub_id_1 | string | Custom tracking tag 1 |
sub_id_2 | string | Custom tracking tag 2 |
sub_id_3 | string | Custom tracking tag 3 |
clicks | int | Total click count |
unique_clicks | int | Unique visitor clicks |
conversions | int | Attributed conversions |
status | string | active or deactivated |
created_at | string | ISO 8601 timestamp |