> ## Documentation Index
> Fetch the complete documentation index at: https://docs.woodwide.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Pagination

> Cursor-based pagination for list endpoints.

List endpoints (`GET /datasets`, `GET /models`, `GET /jobs`) use cursor-based pagination. Results are ordered newest-first.

* **Default page size:** 50 items
* **Maximum page size:** 200 items (set via the `limit` query parameter)
* **Next page:** Pass the `next_cursor` value from the response as the `cursor` query parameter in your next request.
* **Last page:** When `next_cursor` is `null`, there are no more pages.

<CodeGroup>
  ```python Python theme={null}
  import os
  import requests

  api_key = os.getenv("WOODWIDE_API_KEY")
  base_url = "https://api.woodwide.ai"
  headers = {"Authorization": f"Bearer {api_key}"}

  all_datasets = []
  cursor = None

  while True:
      params = {"limit": 100}
      if cursor:
          params["cursor"] = cursor

      response = requests.get(
          f"{base_url}/datasets",
          headers=headers,
          params=params,
      )
      data = response.json()

      all_datasets.extend(data["items"])

      cursor = data.get("next_cursor")
      if cursor is None:
          break

  print(f"Total datasets: {len(all_datasets)}")
  ```

  ```javascript JavaScript theme={null}
  const apiKey = process.env.WOODWIDE_API_KEY;
  const baseUrl = "https://api.woodwide.ai";
  const headers = { Authorization: `Bearer ${apiKey}` };

  const allDatasets = [];
  let cursor = null;

  do {
    const params = new URLSearchParams({ limit: "100" });
    if (cursor) params.set("cursor", cursor);

    const response = await fetch(`${baseUrl}/datasets?${params}`, {
      headers,
    });
    const data = await response.json();

    allDatasets.push(...data.items);
    cursor = data.next_cursor;
  } while (cursor);

  console.log(`Total datasets: ${allDatasets.length}`);
  ```

  ```bash curl theme={null}
  export WOODWIDE_API_KEY="your_api_key_here"
  export BASE_URL="https://api.woodwide.ai"

  # Fetch first page
  RESPONSE=$(curl -s "$BASE_URL/datasets?limit=100" \
    -H "Authorization: Bearer $WOODWIDE_API_KEY")

  echo "$RESPONSE" | jq '.items | length'

  # Fetch next page using the cursor
  CURSOR=$(echo "$RESPONSE" | jq -r '.next_cursor')
  if [ "$CURSOR" != "null" ]; then
    curl -s "$BASE_URL/datasets?limit=100&cursor=$CURSOR" \
      -H "Authorization: Bearer $WOODWIDE_API_KEY"
  fi
  ```
</CodeGroup>
