@checkify-api/autocomplete
v1.0.1
Published
Australian address autocomplete widget powered by Checkify
Maintainers
Readme
@checkify-api/autocomplete
Drop-in JavaScript library for unit-level Australian address autocomplete, powered by the Checkify API. Covers 15.4 million addresses including full unit number resolution.
Requires an API key — sign up at checkify.com.au.
Usage
Add the script tag to your page with your API key:
<script src="https://cdn.jsdelivr.net/npm/@checkify-api/autocomplete@latest/checkify-autocomplete.js?key=YOUR_API_KEY"></script>Then initialise on your address input:
<input type="text" id="street" placeholder="Start typing an address..." />
<script>
CheckifyAutocomplete.init("#street");
</script>Field mapping
Automatically populate separate form fields when an address is selected:
<input type="text" id="street" />
<input type="text" id="unit" />
<input type="text" id="suburb" />
<input type="text" id="state" />
<input type="text" id="postcode" />
<script>
CheckifyAutocomplete.init("#street", {
unit: "#unit",
street: "#street-display",
city: "#suburb",
state: "#state",
postcode: "#postcode",
});
</script>Events
Listen for checkify:selected on the input to get the full address object:
document.querySelector("#street").addEventListener("checkify:selected", (e) => {
console.log(e.detail);
// {
// street_number, street_name, street_type,
// unit, city, state, postcode,
// latitude, longitude, ...
// }
});Destroy
const widget = CheckifyAutocomplete.init("#street");
widget.destroy(); // removes listeners and dropdownOther Checkify API endpoints
The same API key gives you access to the full Checkify REST API:
| Endpoint | Description |
| ----------------------------------------- | ------------------------------------------- |
| GET /api/v1/autocomplete | Address autocomplete suggestions |
| GET /api/v1/autocomplete-details | Full details for a selected address |
| GET /api/v1/autocomplete-suburb | Suburb autocomplete suggestions |
| GET /api/v1/autocomplete-suburb-details | Full details for a selected suburb |
| GET /api/v1/reverse | Reverse geocode lat/lng to nearest address |
| GET /api/v1/postcode | Look up all suburbs for a postcode |
| GET /api/v1/abn | Look up an Australian Business Number (ABN) |
| GET /api/v1/acn | Look up an Australian Company Number (ACN) |
See the full API documentation for request/response details.
