Skip to content

List locations

GET /api/locations

Returns Australian locations, including suburbs, postcodes, and states. The response is paginated due to the large number of locations.

To retrieve a specific page of results, use:

GET /api/locations/page/{page}
ParameterTypeRequiredDescription
pageintegerNoPage number (starts at 1). Default page size is 1000.
limitintegerNoOptional page size query parameter (default 1000).
Terminal window
# Get the first page of locations
curl -X GET \
-H "Content-Type: application/json" \
https://www.transdirect.com.au/api/locations
# Get a specific page
curl -X GET \
-H "Content-Type: application/json" \
https://www.transdirect.com.au/api/locations/page/5

A successful response returns a 200 status code with an envelope, not a bare array:

{
"code": 200,
"locations": [
{
"id": 1,
"locality": "SYDNEY",
"postcode": "2000",
"state": "NSW",
"priority": 1
},
{
"id": 2,
"locality": "THE ROCKS",
"postcode": "2000",
"state": "NSW",
"priority": 2
}
],
"next_page": "https://www.transdirect.com.au/api/locations/page/2"
}

When a previous page exists, a prev_page absolute URL is also included.

FieldTypeDescription
codeintegerHTTP-style status code in the body (200)
locationsarrayLocation rows for this page
next_pagestringAbsolute URL of the next page (only when a full page of results was returned)
prev_pagestringAbsolute URL of the previous page (only when page > 1)
FieldTypeDescription
idintegerSuburb row id
localitystringSuburb or locality name
postcodestringFour-digit Australian postcode
statestringState or territory abbreviation
priorityintegerSort priority within the postcode