Pagination

List endpoints tend to return paginated responses. When you request /v1/countries or /v1/airports?country=US, you'll get back a page of results, along with metadata to navigate the full set.

Response structure#

jsonc
{
	"data": [
		{ "code": "AD", "name": "Andorra", ... },
		{ "code": "AE", "name": "United Arab Emirates", ... },
		{ "code": "AF", "name": "Afghanistan", ... }
	],
	"pagination": {
		"page": 1,
		"per_page": 50,
		"total_pages": 5,
		"total_items": 249
	}
}

The data array contains the actual resources. The pagination object tells you where you are and how much there is.

Query parameters#

Pagination can be controlled using query parameters:

ParameterDescriptionDefaultMaximum
pageWhich page to return1
per_pageResults per page50100

Note how pages are 1-indexed. The first page is page=1, not page=0.

bash
# First 50 countries (default)
curl "https://worlddataapi.com/v1/countries"

# Second page of 100 results
curl "https://worlddataapi.com/v1/countries?page=2&per_page=100"

What's not paginated#

A few things return plain arrays or objects, without any paginated wrapper:

  • Continents — Only 7 items, no need

  • Computed endpoints — Astronomy, Business Days, and Travel return single objects, not lists

If you're getting a data wrapper, it's paginated. If you're getting a bare array or object, it's not.