What you can build
Attribution in the browser
Drop in one script tag and Referly records clicks, stores the referral, and survives across
pages and subdomains.
Conversions from your server
Report sales from your backend, where you already know the real amount charged.
Your own affiliate experience
Create affiliates, issue links and coupons, and read performance data from your own app.
Reactions to what happens
Receive an HTTP callback whenever an affiliate, referral, sale, or coupon changes.
Who these docs are for
You are writing code against Referly — installing tracking on a site you control, wiring your checkout to report conversions, or syncing affiliate data into another system. You are comfortable with HTTP requests, JSON, and a bit of JavaScript. If you manage the program itself — commission plans, approving affiliates, running payouts — the Help Center covers that side, and none of it requires code.How the pieces fit together
Every integration is some combination of three moving parts.1. Attribution: who referred this person
A visitor arrives through an affiliate’s referral link (or uses their coupon code) and Referly records a click. The tracking script stores that attribution in the browser so it survives page navigation and return visits.2. Conversion: this person became a customer
When the visitor signs up or pays, you tell Referly. The click becomes a referral (a tracked customer), and each payment they make becomes a sale that produces a commission. You have three ways to do this, and most programs use exactly one:An integration
Stripe, Shopify, WooCommerce, Paddle, and others report payments to Referly for you. No
conversion code to write.
Your server
Post the sale from your backend after the charge succeeds. The most reliable option when you
control the payment flow.
The browser
Call the tracking script’s helpers on your confirmation page. Quickest to ship, but subject to
ad blockers and abandoned redirects.
3. Reading and reacting
Once data is flowing, the REST API reads and writes affiliates, referrals, sales, links, coupons, and promotional codes, and webhooks push changes to you as they happen.Base URL and environments
The REST API lives under a single base URL:https://www.referly.so/affiliate-tracker.js.
Referly has one live environment — there is no separate sandbox, and API keys are not split into
test and live modes. To try things end to end without touching real data, create a second program
in your dashboard and point your staging site at that program’s ID. Sales you create while testing
can be deleted afterwards.
API access is included with the Business plan. If your key returns
403 with User does not have API access, check your plan on the pricing page.Authentication
Every API request carries an API key as a bearer token. Keys are created in your dashboard and scoped to one program, so the key itself determines which program’s data you are reading and writing — you never pass a program ID to the API.401. Full details, including how to generate and rotate a
key, are in Authentication.
Rate limits
Requests are counted per API key, and the ceiling depends on what the endpoint does — reads are the most generous, sales the strictest, because each one triggers attribution and commission calculation. Exceeding a limit returns429 with Too many requests. Please slow down.
Retry after a short pause rather than immediately, and batch where you can. The exact windows are
listed in Rate limits.
Webhooks
Referly can push events to an endpoint you own, so you do not have to poll. Events are emitted for affiliates, referrals, sales, coupons, and promotional codes, each in created, updated, and deleted form — for exampleaffiliate.created, sale.updated, referral.deleted.
Deliveries are signed, retried on failure, and logged, so you can replay anything you missed. See
Webhooks.
Skip the code
If you are on a platform Referly already integrates with, the fastest integration is no integration at all.Stripe
Shopify
WooCommerce
Zapier
Make
Everything else
Related
Quickstart
Install tracking and record your first sale, end to end.
Core concepts
Programs, affiliates, clicks, referrals, sales, commissions, and payouts.
Glossary
Every term Referly uses, defined once.
API reference
Endpoint-by-endpoint documentation for the REST API.