Skip to main content

Documentation Index

Fetch the complete documentation index at: https://agentref.co/docs/llms.txt

Use this file to discover all available pages before exploring further.

Every affiliate gets a unique referral code. Your tracking link follows this format:
https://merchant-site.com/?via=YOUR_CODE
AgentRef-generated links default to ?via=YOUR_CODE. Some programs may still expose ref, r, a, or merchant-configured aliases for inbound attribution. When someone clicks your link, AgentRef:
  1. Records the click with your affiliate ID
  2. Sets a first-party cookie on the visitor’s browser
  3. Tracks the visitor across the cookie window (typically 30-90 days)
  4. Attributes any conversion back to you

Referral Code

Your referral code is set when you join a program. It’s usually your name or brand:
https://example.com/?via=jane
https://example.com/?via=techreviewer
https://example.com/?via=ai-tools-blog
Affiliate API keys can create named tracking links for a joined program. Use destination_path for a merchant-approved path on the merchant website and custom_slug when you want a specific referral code for that link. destination_path must be a relative path such as /pricing or /blog/review. It must be in the program’s allowed destination list. custom_slug must be 3-32 lowercase letters, numbers, or hyphens.
curl -X POST "https://www.agentref.co/api/v1/me/links?program_id=PROGRAM_ID" \
  -H "Authorization: Bearer ak_aff_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: create-pricing-link" \
  -d '{
    "name": "Pricing page",
    "destination_path": "/pricing",
    "custom_slug": "jane-review"
  }'
The current update contract is narrower than the create contract. PATCH /api/v1/me/links/{id} accepts name, targetUrl, and isActive; it does not accept destination_path or custom_slug. Use targetUrl when you need to point an existing link at a full URL, and create a new link when you need a different approved destination path or custom slug.
curl -X PATCH "https://www.agentref.co/api/v1/me/links/LINK_ID?program_id=PROGRAM_ID" \
  -H "Authorization: Bearer ak_aff_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Pricing page - updated",
    "targetUrl": "https://merchant-site.com/pricing",
    "isActive": true
  }'
Each program sets a cookie window – the number of days a click stays valid. If a visitor clicks your link today and purchases within the window, you get credit.
Typical WindowsDuration
Short30 days
Standard60 days
Long90 days
The merchant configures this per program.

UTM & Sub-ID Tracking

You can append tracking parameters to your links for your own analytics:
https://example.com/?via=jane&utm_source=youtube&utm_campaign=review
https://example.com/?via=jane&sub1=header-banner&sub2=homepage

Supported Parameters

ParameterDescription
utm_sourceTraffic source (youtube, twitter, newsletter)
utm_mediumMedium (video, post, email)
utm_campaignCampaign name
utm_contentContent variant
utm_termSearch term
sub1 - sub5Custom sub-IDs for your own tracking
These are tracked per click and visible in your affiliate dashboard.

Attribution Model

AgentRef uses last-click attribution: the last affiliate link clicked before conversion gets the commission. If a visitor clicks affiliate A’s link, then later clicks affiliate B’s link and purchases – affiliate B gets credit.

Viewing Your Clicks

In the Dashboard

Your dashboard shows click analytics: total clicks, unique visitors, click-through rates, and geographic breakdown.

Via API

Use the affiliate self-serve clicks endpoint to inspect a specific reporting window:
const stats = await fetch(
  'https://www.agentref.co/api/v1/me/clicks?startDate=START_DATE&endDate=END_DATE',
  {
    headers: { Authorization: 'Bearer ak_aff_YOUR_KEY' },
  }
).then((r) => r.json());
Use sub-IDs (sub1-sub5) to track which content, placement, or campaign drives the most conversions. This helps you optimize your promotion strategy.