Skip to Content
APIPagination

Pagination

Carapis listings are paginated with two parameters — page (1-based) and limit (results per page) — and the response count tells you the total number of matches. Increment page until you have collected every result.

Parameters

ParameterTypeDefaultDescription
pageinteger1Page number, 1-based.
limitinteger20Results per page.

The response envelope echoes page and limit and includes count, the total number of matching listings:

{ "count": 312, "page": 1, "limit": 20, "results": [ /* ... */ ] }

Iterating all pages

Request page 1, then keep incrementing page until you have fetched count items (or a page comes back empty).

import requests def all_listings(source, limit=20): page = 1 while True: resp = requests.get( "https://api.carapis.com/v2/listings", params={"source": source, "limit": limit, "page": page}, headers={"Authorization": f"Bearer {API_KEY}"}, ) results = resp.json()["results"] if not results: break yield from results page += 1 for car in all_listings("encar"): print(car["id"], car["price"])

Tips

  • Use a larger limit to reduce round-trips, but keep each response a manageable size.
  • Apply filters (make, model, year_min, price_max) to shrink count before paging — see Listings.
  • Pace your requests to stay within your plan’s rate limits.