Skip to main content

API Keys and REST API

Generate API keys and authenticate against AffiliateBase /api/v1 endpoints

Table of Contents

API Keys and REST API

AffiliateBase exposes account-scoped REST endpoints under /api/v1.

This Help article is the quick start. Full API documentation lives under /docs:

1) Create an API key

Use one of these endpoints:

  • GET /api/v1/api_keys
  • POST /api/v1/api_keys
  • DELETE /api/v1/api_keys/:id

API key secrets are only returned once when created.

2) Authenticate requests

Supported auth headers:

  • Authorization: Bearer <API_KEY>
  • Authorization: Basic <base64(API_KEY:)>
  • X-Api-Key: <API_KEY>

3) Scope to your account

Provide account context with one of:

  • ?account_id=<ACCOUNT_ID>
  • X-Account-Id: <ACCOUNT_ID>

/api/v1 requests without account context return:

{ "error": "Account ID is required", "code": "MISSING_ACCOUNT_ID" }

Quick example

curl "https://app.affiliatebase.io/api/v1/affiliates?account_id=<ACCOUNT_ID>&page=1&limit=25" \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json"

What the API currently covers

  • Plans and subscription lifecycle
  • API keys
  • Affiliates
  • Affiliate coupons
  • Campaigns
  • Links
  • Referrals
  • Commissions
  • Payouts
  • Payout exports
  • Payout runs
  • Invitations

Next steps