jane-doe) that Referly appends to your destination URLs as a query parameter so it can attribute clicks, referrals, and sales back to that affiliate.
An affiliate can have many slugs — one per campaign, channel, or landing page — and they all credit the same affiliate.
The affiliate object
Affiliate objects returned by Get Affiliate(s) and Create an Affiliate include anaffiliateLinks array with one entry per slug:
Affiliate response (truncated)
array
Every referral link belonging to this affiliate. Each entry has
id, link (the slug), userId,
programId, createdAt, and updatedAt.string | null
deprecated
Legacy single-link field. Kept for backwards compatibility and typically
null. Read
affiliateLinks instead.Create an affiliate with a chosen slug
POST /affiliates requires firstName, lastName, and email. Every affiliate is created with at least one referral link, so the slug is decided at creation time.
string
The slug for the affiliate’s first referral link. If you omit it, Referly generates one from the
affiliate’s email address and keeps trying until it finds an unused slug.
cURL
affiliateLink that another affiliate in the program already uses, the request fails with 400 and The requested affiliate link is already in use. Referly only falls back to an auto-generated slug when you left affiliateLink out.
See Create an Affiliate for the full list of body fields.
Add more links to an existing affiliate
There are two ways to give an affiliate an additional slug, and both add rather than replace:- Links endpoint (recommended)
- Affiliates endpoint
POST /links creates the link and returns it with its tracking URLs and stats. Identify the
owner with either affiliateId or affiliateEmail.cURL
Slug rules
Slugs are validated when you create or rename a link through the Links endpoints:- Only letters, numbers, and hyphens are allowed. Anything else returns
400withLink can only contain letters, numbers, and hyphens. - A slug must be unique across your affiliate program. Reusing one returns
400withThis link already exists for this affiliate program. - The slug is the visible part of the URL your affiliates share, so short and readable works best.
Tracking URLs
A slug on its own is not a shareable URL. Get Affiliate Link(s) and Create an Affiliate Link return afullURLs array that combines the slug with each destination URL configured on your program:
Link response (truncated)
ref. Any custom URL parameters you configured on a destination URL are appended too. See Tracking parameters for how a click on one of these URLs is attributed.
Look up an affiliate or a link
The twoGET endpoints let you resolve records from whichever identifier you happen to hold.
Find an affiliate
GET /affiliates returns a single affiliate when you pass an identifier, or an array of every affiliate in the program when you pass none.
string
Accepts three kinds of value: an affiliate ID, a numeric click ID, or a referral link slug. Referly
tries the click ID first when the value is entirely numeric, then falls back to matching the
affiliate ID or a slug in
affiliateLinks.string
The affiliate’s email address.
Resolve an affiliate from a slug
null with a 200 status rather than a 404.
Find links
GET /links accepts id, link, affiliateId, or affiliateEmail, and always returns an array. Use affiliateId or affiliateEmail to list every link an affiliate owns, each with its own clicks, referrals, sales, and totalRevenue.
List one affiliate's links
Errors
Both resources share the same authentication and error behaviour. Failures return a JSON object with anerror message.
See Authentication for how to generate an API key.
Related
Affiliate endpoints
Create, read, update, and delete affiliates.
Link endpoints
Create, read, rename, and delete referral links.
Coupons and promotional codes
Attribute sales with discount codes instead of links.
Authentication
Generate an API key and authorize your requests.