Skip to content

Search locations

GET /api/locations/search

Searches for locations matching a query string. You can search by suburb name, postcode, or a prefix of either.

ParameterTypeRequiredDescription
qstringNoSearch query (suburb name, postcode, or partial prefix). If omitted, the full locations catalogue is returned (large payload).
Terminal window
# Search by suburb name
curl -X GET \
-H "Content-Type: application/json" \
"https://www.transdirect.com.au/api/locations/search?q=melbourne"
# Search by postcode
curl -X GET \
-H "Content-Type: application/json" \
"https://www.transdirect.com.au/api/locations/search?q=3000"

A successful response returns a 200 status code with an envelope containing a locations array (not a bare array):

{
"locations": [
{
"id": 100,
"locality": "MELBOURNE",
"postcode": "3000",
"state": "VIC",
"priority": 1
},
{
"id": 101,
"locality": "EAST MELBOURNE",
"postcode": "3002",
"state": "VIC",
"priority": 1
}
]
}

For historical compatibility, country rows may also appear in the same array with a different shape (country_code, country_name) when the full catalogue is loaded.

FieldTypeDescription
idintegerSuburb row id
localitystringSuburb or locality name
postcodestringFour-digit Australian postcode
statestringState or territory abbreviation
priorityintegerSort priority within the postcode