Pagination & Filtering
Search, filter, sort, and paginate through programs, reviews, and categories.
Pagination
All list endpoints return paginated results. You can control pagination with two query parameters:
page— The page number to retrieve (default:1)per_page— Number of results per page (default:20, max100for programs, max50for reviews)
Every paginated response includes a pagination object alongside the data array:
curl "https://api.theaffiliateindex.com/v1/programs?page=2&per_page=10" \
-H "X-API-Key: tai_your_key"{
"data": [ ... ],
"pagination": {
"page": 2,
"per_page": 10,
"has_more": true
}
}When has_more is true, there are additional pages of results. Keep incrementing page until has_more returns false. Here is how to iterate through all pages:
let page = 1;
let hasMore = true;
const allPrograms = [];
while (hasMore) {
const res = await fetch(
`https://api.theaffiliateindex.com/v1/programs?page=${page}&per_page=100`,
{ headers: { "X-API-Key": process.env.TAI_API_KEY } }
);
const data = await res.json();
allPrograms.push(...data.data);
hasMore = data.pagination.has_more;
page++;
}per_page=100 to minimize the number of requests when fetching all results.Searching
The q parameter on /v1/programs lets you search programs by name. The search is case-insensitive and performs a partial match, so you don't need to type the full program name.
curl "https://api.theaffiliateindex.com/v1/programs?q=reward" \
-H "X-API-Key: tai_your_key"This matches programs like "Rewardful", "Reward Gateway", and any other program with "reward" in its name.
Filtering
The /v1/programs endpoint supports several filter parameters to narrow down results:
| Parameter | Description | Example |
|---|---|---|
commission_type | Filter by commission model | recurring, one_time, hybrid, tiered |
min_commission | Minimum commission percentage | min_commission=20 |
max_commission | Maximum commission percentage | max_commission=50 |
min_cookie_days | Minimum cookie window in days | min_cookie_days=30 |
tracking_platform | Filter by tracking platform | rewardful, impact, cj, shareasale |
verified_only | Only return verified programs | verified_only=true |
Combine multiple filters in a single request:
curl "https://api.theaffiliateindex.com/v1/programs?commission_type=recurring&min_commission=20&verified_only=true&per_page=50" \
-H "X-API-Key: tai_your_key"Sorting
Use the sort parameter to control the order of results. By default, featured programs appear first. The following sort values are available for programs:
| Value | Description |
|---|---|
trending | Most viewed programs |
commission_desc | Highest commission rate first |
commission_asc | Lowest commission rate first |
cookie_desc | Longest cookie duration first |
rating_desc | Highest rated first |
reviews_desc | Most reviewed first |
newest | Most recently added first |
curl "https://api.theaffiliateindex.com/v1/programs?sort=rating_desc&per_page=10" \
-H "X-API-Key: tai_your_key"Combining parameters
Search, filter, sort, and pagination parameters can all be combined in a single request. For example, to find recurring SaaS programs with at least 15% commission, sorted by rating:
curl "https://api.theaffiliateindex.com/v1/programs?q=saas&commission_type=recurring&min_commission=15&sort=rating_desc&page=1&per_page=20" \
-H "X-API-Key: tai_your_key"This request:
- Searches for programs matching "saas"
- Filters to only recurring commission programs
- Requires at least 15% commission rate
- Sorts results by highest rating
- Returns the first page of 20 results
Check pagination.has_more in the response to determine if there are additional pages to fetch.