The AffiliateBase REST API under /api/v1 lets developers read or manage account-scoped affiliate program records such as affiliates, referrals, commissions, and payouts. This overview covers authentication, account scoping, API-key permissions, pagination, and response and error formats.
Base URL
- Production:
https://app.affiliatebase.io - Endpoint prefix:
/api/v1
Example:
curl "https://app.affiliatebase.io/api/v1/affiliates?account_id=<ACCOUNT_ID>&page=1&limit=25" \
-H "Authorization: Bearer <API_KEY>"Authentication
All /api/v1 endpoints accept these API key formats:
Authorization: Bearer <API_KEY>Authorization: Basic <base64(API_KEY:)>X-Api-Key: <API_KEY>
Access tokens issued to AI connectors through OAuth are not accepted at /api/v1. They return 403 with the code FORBIDDEN regardless of their permissions, because they work only at the MCP endpoint. Create an API key in Settings -> API keys for REST access. See API Keys and REST API.
Account scoping
All /api/v1 endpoints require account context. Provide one of:
?account_id=<ACCOUNT_ID>X-Account-Id: <ACCOUNT_ID>
Notes:
- API keys are account-scoped. API-key clients must always send
X-Account-Idoraccount_id. - Signed-in dashboard sessions fall back to the account currently selected in the dashboard.
Authorization model
- Session auth enforces account membership roles (
owner,admin,member) per endpoint. - API-key auth enforces permission maps (resource/action), not membership roles.
- Keys created in Settings -> API keys have full access (
{ "all": true }). - requires an explicit, non-empty
permissionsobject. A request without one returns422withVALIDATION_ERROR.
Permission examples:
{ "all": true }{
"v1.affiliates.read": true,
"v1.referrals.read": true,
"v1.campaigns.write": false
}Common query patterns
- Pagination:
?page=1&limit=25(defaultlimitis 25; maximum is 100 on paginated routes) - Arrays: either repeated params (
state[]=due&state[]=pending) or comma-delimited (state=due,pending) - Expansion:
?expand[]=campaign&expand[]=linksor?expand=campaign,links - Timestamps: endpoints that support
updated_since/updated_untilrequire ISO-8601 values
Response patterns
Most routes return:
- Single object: the resource fields directly, not wrapped in
data - List responses: a
dataarray plus apaginationobject on paginated routes - Errors: structured JSON with
error,code, and optionaldetails
Paginated list responses use this shape:
{
"data": [],
"pagination": {
"previous_page": null,
"current_page": 1,
"next_page": 2,
"count": 25,
"limit": 25,
"total_pages": 10,
"total_count": 250
}
}Errors use this shape. details appears only on some errors:
{
"error": "Account ID is required",
"code": "MISSING_ACCOUNT_ID"
}Common error codes:
MISSING_ACCOUNT_ID(400)UNAUTHORIZED(401)FORBIDDEN(403)NOT_FOUND(404)VALIDATION_ERROR(422)INVALID_PARAMETER(400)TOO_MANY_REQUESTS(429; see Rate limits)
An invalid updated_since or updated_until timestamp returns 422 with VALIDATION_ERROR.
Payout endpoints also return operation-specific 422 codes such as PAYOUT_EXECUTION_FAILED, PAYOUT_RUN_EXECUTION_FAILED, and PAYOUT_EXPORT_CREATE_FAILED. See the REST API endpoint reference for the full list.