Skip to main content
All API requests require authentication via a Bearer token. Your API key acts as the token.

API Key Format

AgentRef uses prefixed API keys to distinguish key types:
PrefixTypeDescription
ak_live_MerchantFull access to your programs, affiliates, conversions, payouts, and settings
ak_aff_AffiliateAccess to affiliate self-serve endpoints (/me/*, marketplace)
ak_onb_OnboardingLimited scope for initial setup (create program, connect Stripe)

Making Requests

Include your API key as a Bearer token in the Authorization header:
curl https://www.agentref.co/api/v1/programs \
  -H "Authorization: Bearer ak_live_YOUR_KEY"

Base URL

All API endpoints are served from:
https://www.agentref.co/api/v1

Scopes

API keys are scoped to control access. When creating a key, you choose which scopes to grant.

Merchant Scopes

ScopeDescription
merchant:readRead merchant profile and settings
merchant:manageUpdate merchant profile and settings
programs:readList and view programs
programs:writeCreate and update programs
affiliates:readList and view affiliates
affiliates:manageApprove, block, and unblock affiliates
conversions:readList and view conversions
payouts:readList and view payouts
payouts:writeCreate payouts and mark as completed
stats:readView program, conversion, and payout statistics
billing:readView billing information and tiers
billing:writeSubscribe and manage billing
flags:readList and view fraud flags
flags:writeResolve fraud flags
webhooks:readList and view webhook endpoints
webhooks:writeCreate, update, and delete webhook endpoints
invites:claimClaim invite tokens

Affiliate Scopes

ScopeDescription
profile:readView own profile
profile:writeUpdate own profile
links:readList own tracking links
links:writeCreate and delete tracking links
earnings:readView own commission earnings
conversions:readView own conversions
payouts:readView own payout history
stats:readView own statistics
marketplace:readBrowse the program marketplace
marketplace:applyApply to programs
invites:claimClaim invite tokens

Scope Presets

For convenience, you can use presets when creating API keys:
PresetIncludes
merchant:fullAll merchant scopes
affiliate:fullAll affiliate scopes
readonlyAll read-only scopes across both merchant and affiliate

Creating API Keys

  1. Log in to your AgentRef dashboard
  2. Go to Settings → API Keys
  3. Click Create API Key
  4. Select scopes or a preset
  5. Copy the key – it won’t be shown again
Store your API key securely. Treat it like a password. Never commit API keys to version control or expose them in client-side code.

Authentication Errors

StatusCodeDescription
401UNAUTHORIZEDMissing or invalid API key
403INSUFFICIENT_SCOPEAPI key doesn’t have the required scope for this action
403FORBIDDENAction not allowed (e.g., accessing another merchant’s resources)