Skip to main content

Checking the usability of your key

Your key may not be available at some times. For instance:

Your key may have reached its daily cap set by you Your user has reached their individual usage cap for the day The balance on your key is exhausted By default, Address Lookup not initialize if your key is not usable for whatever reason. You may use the onLoaded and onFailedCheck callbacks to make necessary adjustments.

To disable key checking, set checkKey to false.

Loading...
import { AddressLookup } from "@addresszen/address-lookup";

AddressLookup.setup({
inputField: "#input",

// Test key: 'ak_test' passes the check
apiKey: "ak_test",
// Test key: 'ak_fails' fails the key check
// apiKey: 'ak_fails',

// By default, checkKey is enabled
checkKey: true,

// Invoked if plugin loads
onLoaded: function () {
document.getElementById("message").textContent =
"Check passed! Start typing your address";
},

// Invoked if key fails check
onFailedCheck: function () {
document.getElementById("message").textContent =
"Check failed. Please manually enter your address";
},

outputFields: {
line_1: "#line_1",
line_2: "#line_2",
city: "#city",
state: "#state",
zip_plus_4_code: "#zipcode",
},
});