Wahlu API

Pagination

How to paginate through list endpoints.

Overview

List endpoints use offset-based pagination. You control the page size and position using query parameters.

Query parameters

ParameterTypeDescription
pageintegerPage number (1-based). Defaults to 1.
limitintegerNumber of items per page. Defaults to 50, maximum 100.
sort_bystringField to sort by. Allowed values: created_at, updated_at, name, scheduled_at, published_at, last_used_at, status, file_name. Defaults to created_at.
sort_dirstring"asc" or "desc". Defaults to "desc".

Response format

All list endpoints return a consistent response shape with a pagination object:

Response
{
  "success": true,
  "data": [
    { "id": "abc123", ... },
    { "id": "def456", ... }
  ],
  "pagination": {
    "page": 1,
    "limit": 50,
    "has_more": true
  }
}
ParameterTypeDescription
success*booleanAlways true for successful responses.
data*arrayThe list of items for the current page.
pagination.page*integerThe current page number.
pagination.limit*integerThe number of items per page.
pagination.has_more*booleanWhether there are more pages after the current one.

Example: paginating through all content items

JavaScript
async function getAllContentItems(brandId) {
  const allContentItems = [];
  let page = 1;
  let hasMore = true;

  while (hasMore) {
    const response = await fetch(
      `https://api.wahlu.com/v1/brands/${brandId}/content-items?page=${page}&limit=100`,
      {
        headers: {
          Authorization: "Bearer wahlu_live_your_api_key_here",
        },
      }
    );

    const body = await response.json();
    allContentItems.push(...body.data);
    hasMore = body.pagination.has_more;
    page++;
  }

  return allContentItems;
}