Developers/Pagination & Filtering

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, max 100 for programs, max 50 for reviews)

Every paginated response includes a pagination object alongside the data array:

bash
curl "https://api.theaffiliateindex.com/v1/programs?page=2&per_page=10" \
  -H "X-API-Key: tai_your_key"
json
{
  "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:

javascript
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++;
}
*
Use 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.

bash
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:

ParameterDescriptionExample
commission_typeFilter by commission modelrecurring, one_time, hybrid, tiered
min_commissionMinimum commission percentagemin_commission=20
max_commissionMaximum commission percentagemax_commission=50
min_cookie_daysMinimum cookie window in daysmin_cookie_days=30
tracking_platformFilter by tracking platformrewardful, impact, cj, shareasale
verified_onlyOnly return verified programsverified_only=true

Combine multiple filters in a single request:

bash
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:

ValueDescription
trendingMost viewed programs
commission_descHighest commission rate first
commission_ascLowest commission rate first
cookie_descLongest cookie duration first
rating_descHighest rated first
reviews_descMost reviewed first
newestMost recently added first
bash
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:

bash
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:

  1. Searches for programs matching "saas"
  2. Filters to only recurring commission programs
  3. Requires at least 15% commission rate
  4. Sorts results by highest rating
  5. Returns the first page of 20 results

Check pagination.has_more in the response to determine if there are additional pages to fetch.