Predictive API Quickstart
Use this guide to request address suggestions, retrieve details for a selected address, and try locality and postcode suggestions.
Before you begin
You need a Geoscape Hub application with Predictive API product access and its Consumer Key. Follow Authentication to set up your application.
Code
The header name is Authorization. Its value is the Consumer Key directly, without a Bearer prefix. The Consumer Secret is not used in these requests.
1. Suggest addresses
Send partial input once it has at least three characters. These examples use curl and jq:
Code
Each suggest entry contains:
address: the label to displayid: the address ID to use after selectionrank: its zero-based position in the suggestion list
An empty suggest array means there are no suggestions. Rank is an ordering value, not a confidence score. Ask the user to select the intended address rather than automatically accepting the first result.
2. Retrieve the selected address
In your application, use the selected suggestion's id. This command demonstrates a lookup with the first suggestion:
Code
The response's address object contains a GeoJSON point and structured properties:
- Property names use snake_case, for example
formatted_addressandstreet_name - Optional address components are returned as
null - Point coordinates use longitude,latitude order in GDA94 by default. Use
Accept-Crsto request another supported response CRS datasetidentifies the contributing datasets.contributoris currently an empty array
Retain the returned attribution. See CRS & GDA2020 and Attribution.
3. Suggest localities instead
Use the locality endpoint for a locality and postcode picker:
Code
Display suggest[].displayName. The response also supplies localityName, stateTerritory, postcode, id, and rank. Locality IDs cannot be used with the address-details endpoint.
Usage and errors
Each suggestion request uses 0.1 credits. Retrieving address details uses 1 credit.
- For
400, correct the query, filters, or address ID - For
401or403, resolve credentials or product access - For address-details
404, check that the selected address ID is still valid - Debounce typed input and ignore stale responses to avoid displaying suggestions for an earlier query
See Error Handling and Rate Limiting for retry and rate guidance.