### Install AddressZen Magento Plugin via Composer Source: https://docs.addresszen.com/docs/integrations/magento Installs the AddressZen Magento plugin using Composer and enables it along with necessary Magento setup commands. ```shell composer require addresszen/magento ``` ```shell magento module:enable Addresszen_Lookup magento setup:upgrade magento setup:di:compile magento setup:static-content:deploy -f ``` -------------------------------- ### Example API Key Format Source: https://docs.addresszen.com/docs/guides/api-key An example of what an AddressZen API Key looks like. API Keys are strings of characters used for authentication and typically begin with 'ak_'. ```text ak_ksqa49sjSdAEDq9I88 ``` -------------------------------- ### Install AddressZen OpenAPI Package Source: https://docs.addresszen.com/docs/libraries/open-api This command installs the AddressZen OpenAPI package using npm. This package provides API typings and the OpenAPI v3 specification files. ```bash npm install @addresszen/openapi ``` -------------------------------- ### Install Address Lookup via npm Source: https://docs.addresszen.com/docs/address-lookup/npm Installs the @addresszen/address-lookup package using npm. This is the first step to using the Address Lookup service in your project. ```bash npm install @addresszen/address-lookup ``` -------------------------------- ### Premise and Organisation Examples Source: https://docs.addresszen.com/docs/data/ecad Provides examples for premise details like 'building_name' (e.g., 'Rose Cottage') and 'sub_building_name' (e.g., 'Flat 1'), as well as an example for 'organisation' (e.g., 'Oak Tree Limited'). ```text Rose Cottage ``` ```text Flat 1 ``` ```text Oak Tree Limited ``` -------------------------------- ### Version Pinning Example for CDN Usage Source: https://docs.addresszen.com/docs/address-lookup/script This example illustrates the recommended practice of pinning a specific version of the Address Lookup script when using a JavaScript CDN in a production environment. Pinning ensures stability and prevents unexpected breakages due to future updates. ```html ``` -------------------------------- ### Clone AddressZen Magento Plugin Repository Source: https://docs.addresszen.com/docs/integrations/magento Demonstrates how to clone the AddressZen Magento plugin repository from GitHub, either the main project or a specific version using a tag. ```git git clone --depth=1 https://github.com/addresszen/magento.git ``` ```git git clone --branch -depth=1 https://github.com/addresszen/magento.git ``` -------------------------------- ### Install Address Lookup Package Source: https://docs.addresszen.com/docs/address-lookup/react Installs the Address Lookup library as a project dependency using npm. This is the first step to using the library in your React application. ```bash npm install --save @addresszen/address-lookup ``` -------------------------------- ### GET /keys/:key Source: https://docs.addresszen.com/docs/changelog Retrieves details for a given API key. Supports keys starting with 'sl_' and returns a 'datasets' attribute indicating access to specific datasets like PAF, Multiple Residence, or Not Yet Built. ```APIDOC ## GET /keys/:key ### Description Retrieves details for a given API key. Supports keys starting with 'sl_' and returns a 'datasets' attribute indicating access to specific datasets like PAF, Multiple Residence, or Not Yet Built. ### Method GET ### Endpoint /keys/:key ### Parameters #### Path Parameters - **key** (string) - Required - The API key to retrieve details for. ### Response #### Success Response (200) - **datasets** (array) - A list of datasets the key has access to (e.g., "PAF", "Multiple Residence", "Not Yet Built"). ``` -------------------------------- ### Example API Postcode Lookup (No Licensee) Source: https://docs.addresszen.com/docs/guides/sublicensing Demonstrates a standard API request for postcode lookups before implementing sublicensing. This format is used when a single licensee is managed under a key. ```url /v1/postcodes/?api_key=ak_test ``` -------------------------------- ### Example API Address Autocomplete Lookup (With Licensee) Source: https://docs.addresszen.com/docs/guides/sublicensing Demonstrates an API request for address autocompletion using a Sublicensing Key. The licensee key is included to attribute the request to a specific client. ```url /v1/autocomplete/addresses?api_key=sk_i98n29d8dj3K&licensee_key=li_randomkey ``` -------------------------------- ### Retrieve Key Details API Source: https://docs.addresszen.com/docs/changelog Available datasets can be accessed through the `GET /keys/:key/details` API. ```APIDOC ## GET /keys/:key/details ### Description Retrieves details about an API key, including the datasets it has access to. ### Method GET ### Endpoint /keys/:key/details ### Parameters #### Path Parameters - **key** (string) - Required - The API key for which to retrieve details. ### Response #### Success Response (200) - **datasets** (array) - A list of datasets accessible by the API key. - **name** (string) - The name of the dataset. - **access_level** (string) - The level of access to the dataset. #### Response Example ```json { "datasets": [ { "name": "USA Standard", "access_level": "full" }, { "name": "Canada Enhanced", "access_level": "read-only" } ] } ``` ``` -------------------------------- ### BigCommerce Script Setup and Configuration Source: https://docs.addresszen.com/docs/integrations/bigcommerce This script snippet initializes the AddressZen integration for BigCommerce. It requires an API key and can be configured with various options to control address lookup and population behavior. ```javascript ``` ```javascript window.idpcConfig = { // API Key is not set by default apiKey: "", // Postcode Lookup is enabled postcodeLookup: true, // Autocomplete is enabled autocomplete: true, // Company name field is updated populateOrganisation: true, // County name field is not updated populateCounty: false, // Advanced configuration autocompleteOverride: {}, postcodeLookupOverride: {} }; ``` -------------------------------- ### Example API Address Autocomplete Lookup (No Licensee) Source: https://docs.addresszen.com/docs/guides/sublicensing Shows a typical API request for address autocompletion without specifying a licensee. This is the format used for direct key usage. ```url /v1/autocomplete/addresses?api_key=ak_test ``` -------------------------------- ### Example API Postcode Lookup (With Licensee) Source: https://docs.addresszen.com/docs/guides/sublicensing Illustrates how to perform an API request for postcode lookups when using a Sublicensing Key. The licensee key is appended to the request to identify the specific client account. ```url /v1/postcodes/?api_key=sk_i98n29d8dj3K&licensee_key=li_randomkey ``` -------------------------------- ### Install and Initialize Address Lookup Plugin Source: https://docs.addresszen.com/docs/integrations/jetformbuilder This snippet shows how to include the AddressZen Address Lookup script and initialize it within a JetFormbuilder HTML block. It requires an API key and maps output fields to form input names. The `onLoaded` function customizes the visibility of the lookup container. ```html ``` -------------------------------- ### Address Verification with cURL Source: https://docs.addresszen.com/docs/address-verification/getting-started Example of how to call the Address Verification API using cURL. It sends a POST request with JSON payload and includes the API key in the query parameters. ```bash curl -X POST "https://api.addresszen.com/v1/verify/addresses?api_key=YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "123 Main St, Springfield, CO 81073" }' ``` -------------------------------- ### Install and Initialize Address Lookup Plugin for FormAssembly Source: https://docs.addresszen.com/docs/integrations/formassembly This JavaScript code snippet demonstrates how to include the AddressZen Address Lookup library and initialize it on a FormAssembly page. It requires an API key and specific CSS selectors for mapping address output fields. Ensure to replace 'YOUR_API_KEY' and adjust the `outputFields` selectors to match your form's field names. ```html ``` -------------------------------- ### GET Request for Address Autocomplete Source: https://docs.addresszen.com/docs/api/find-address This snippet demonstrates how to make a GET request to the /autocomplete/addresses endpoint to retrieve address suggestions. It's the primary method for initiating an address search. ```HTTP GET /autocomplete/addresses ``` -------------------------------- ### Example Custom Address Fields (CAF) Configuration Source: https://docs.addresszen.com/docs/integrations/zoho-crm Provides an example of how to configure custom address fields (CAF) for Zoho CRM contacts and accounts. It demonstrates mapping input IDs to specific address components like line_1, post_town, postcode, and county. ```json [ { "line_1": "#Crm_Leads_LEADCF2", "post_town": "#Crm_Leads_CITY", "postcode": "#Crm_Leads_ZIP", "county": "#Crm_Leads_LEADCF3" }, { "line_1": "#Crm_Accounts_Lane", "post_town": "#Crm_Accounts_Town", "postcode": "#Crm_Accounts_Postal_Code", "county": "#Crm_Accounts_County", "country": "#Crm_Accounts_Country" } ] ``` -------------------------------- ### ES Module Integration with AddressLookup Setup Source: https://docs.addresszen.com/docs/address-lookup/script This snippet demonstrates integrating Address Lookup using an ES Module compatible build, suitable for modern browsers. It imports the AddressLookup class from a CDN and sets up the service with an API key and output field configurations. ```html ``` -------------------------------- ### Add Additional Output Fields to Address Finder Source: https://docs.addresszen.com/docs/integrations/forminator This example shows how to extend the Address Finder initialization to include additional output fields, such as a country field. It demonstrates adding a new key-value pair to the `outputFields` object, mapping 'country' to a specific input element. ```javascript outputFields: { line_1: 'input[name="text-1"]', line_2: 'input[name="text-2"]', city: 'input[name="text-3"]', state: 'input[name="text-4"]', zip_plus_4_code: 'input[name="text-5"]', country: 'input[name="text-6"]' } ``` -------------------------------- ### GET /keys/:key/lookups Source: https://docs.addresszen.com/docs/api/key-logs Reports lookup information on a key for paid lookups. Returns a CSV download of lookups performed and associated information. ```APIDOC ## GET /keys/:key/lookups ### Description Reports lookup information on a key for paid lookups. Returns a CSV download of lookups performed and associated information. ### Method GET ### Endpoint /keys/:key/lookups ### Parameters #### Path Parameters - **key** (string) - Required - The API key to look up. #### Query Parameters - **start_date** (string) - Optional - The start date for the lookup interval (YYYY-MM-DD). - **end_date** (string) - Optional - The end date for the lookup interval (YYYY-MM-DD). ### Request Example ``` GET /keys/YOUR_API_KEY/lookups?start_date=2023-01-01&end_date=2023-01-31 ``` ### Response #### Success Response (200) - **Content-Type**: text/csv - **Body**: CSV data containing lookup information. #### Error Response (400) - **Content-Type**: application/json - **Body**: JSON object with error code and message. ### Response Example (Error) ```json { "error_code": "INVALID_DATE_FORMAT", "message": "The provided date format is invalid." } ``` ``` -------------------------------- ### Address Verification with Node.js (Axios) Source: https://docs.addresszen.com/docs/address-verification/getting-started Shows how to perform address verification in Node.js using the Axios library. This example includes error handling for API requests and returns the verified address data. ```javascript const axios = require("axios"); const verifyAddress = async (address) => { try { const response = await axios.post( "https://api.addresszen.com/v1/verify/addresses?api_key=YOUR_API_KEY", { query: address }, { headers: { "Content-Type": "application/json", }, }, ); return response.data; } catch (error) { console.error("Verification error:", error.response?.data || error.message); throw error; } }; // Usage verifyAddress("123 Main St, Springfield, CO 81073").then((result) => console.log(result), ); ``` -------------------------------- ### Import React and AddressLookup Modules Source: https://docs.addresszen.com/docs/address-lookup/react Imports essential React hooks (`useEffect`, `useState`, `useRef`) and the `AddressLookup` component from the installed package. These are necessary for building the interactive address lookup feature. ```javascript import "./styles.css"; import React, { useEffect, useState, useRef } from "react"; import { AddressLookup } from "@addresszen/address-lookup"; ``` -------------------------------- ### Building Number Examples Source: https://docs.addresszen.com/docs/data/ecad Demonstrates various formats for building numbers, including simple numeric, alphanumeric concatenations (e.g., '2A'), dual numbers separated by '/', sequences using underscores '_', and ranges using dashes '-'. ```text 22 ``` ```text 63/64 ``` ```text 1_5 ``` ```text 63-66 ``` -------------------------------- ### GET /keys/:key/usage Source: https://docs.addresszen.com/docs/api/key-usage Reports the number of lookups consumed on a key for a range of days. Supports filtering by tags and has default date ranges if not specified. ```APIDOC ## GET /keys/:key/usage ### Description Reports the number of lookups consumed on a key for a range of days. A maximum interval of 90 days can be provided. If no start or end date is provided, the last 21 days will be used. You can append `tags` to scope the number of lookups to those with matching tag values. ### Method GET ### Endpoint /keys/:key/usage ### Parameters #### Path Parameters - **key** (string) - Required - The API key to retrieve usage stats for. #### Query Parameters - **start** (string) - Optional - The start date for the analysis (YYYY-MM-DD). Defaults to 21 days prior to the current time. - **end** (string) - Optional - The end date for the analysis (YYYY-MM-DD). Defaults to the current time. - **tags** (string) - Optional - Comma-separated list of tags to filter lookups. E.g., `tags=foo,bar`. ### Request Example ``` GET /keys/your_api_key/usage?start=2023-01-01&end=2023-01-31&tags=premium,enterprise ``` ### Response #### Success Response (200) - **usage_data** (object) - An object containing usage statistics. - **date** (string) - The date of the usage report. - **lookups** (integer) - The number of lookups for that date. - **tags** (array of strings) - The tags associated with the lookups. #### Response Example ```json { "usage_data": [ { "date": "2023-01-01", "lookups": 150, "tags": ["premium"] }, { "date": "2023-01-02", "lookups": 200, "tags": ["premium", "enterprise"] } ] } ``` #### Error Response (400) - **error** (string) - Description of the bad request. #### Error Example ```json { "error": "Invalid date format provided." } ``` ``` -------------------------------- ### Security - Wildcard Subdomain Allowed URLs Source: https://docs.addresszen.com/docs/changelog The system now permits wildcard subdomains in allowed URLs for security configurations. For example, '*.domain.com' will match 'domain.com' and all its subdomains. ```configuration *.domain.com ``` -------------------------------- ### Filtering - Combine Multiple Filters Source: https://docs.addresszen.com/docs/api/addresses Demonstrates combining multiple filters to further narrow down the results. This example restricts results to small user organisations in the 'N' postcode area. ```HTTP GET /addresses?su_organisation_indicator=Y&postcode_area=n ``` -------------------------------- ### GET Request for Postcode Lookup Source: https://docs.addresszen.com/docs/api/postcodes This snippet shows the basic GET request format to retrieve addresses associated with a given UK postcode. The API is case and space insensitive for postcodes. It returns a JSON list of addresses. ```HTTP GET /postcodes/:postcode ``` -------------------------------- ### Browser Integration (UMD) with AddressLookup Setup Source: https://docs.addresszen.com/docs/address-lookup/script This snippet shows how to include the Address Lookup UMD script from a CDN and initialize it with an API key and specific output field mappings. It targets IE11 and upwards, providing a polyfilled and minified package for easy integration. ```html ``` -------------------------------- ### Find Place Suggestions via GET /places Source: https://docs.addresszen.com/docs/api/find-place Retrieves a list of suggested geographical places based on a query. This is the first step in extracting full place information. The response includes place name, descriptive name, and an ID. ```HTTP GET /places ``` -------------------------------- ### GET Request to Retrieve Address by UDPRN Source: https://docs.addresszen.com/docs/api/udprn This snippet shows the HTTP GET request format to retrieve address details using a UDPRN. The UDPRN is a path parameter that uniquely identifies a delivery point. ```HTTP GET /udprn/:udprn ``` -------------------------------- ### Address Validation Setup with AddressLookup Source: https://docs.addresszen.com/docs/address-lookup/validate-before-submitting Sets up the AddressLookup component with an API key and configures output fields. It also attaches a submit event listener to the form to prevent submission until a valid address is populated via the onAddressPopulated callback. ```javascript let shouldFormSubmit = false; AddressZen.AddressLookup.setup({ apiKey: "ak_test", outputFields: { line_1: "#line_1", line_2: "#line_2", city: "#city", state: "#state", zip_plus_4_code: "#zipcode", }, onLoaded: function () { const form = this.input.closest("form"); if (form === null) return; form.addEventListener("submit", (e) => { if (shouldFormSubmit === false) { e.preventDefault(); // Add custom action - E.g. show a warning alert("Please select an address before proceeding"); return false; } }); }, onAddressPopulated: function () { shouldFormSubmit = true; }, }); ``` -------------------------------- ### Add Optional AddressZen Output Fields Source: https://docs.addresszen.com/docs/integrations/elementor This example demonstrates how to include additional output fields for AddressZen's AddressLookup, such as building name, to enhance address capture in Elementor forms. ```javascript outputFields: { building_or_firm_name: '#form-field-building_name', line_1: '#form-field-line_1', line_2: '#form-field-line_2', line_3: '#form-field-line_3', post_town: '#form-field-post_town', postcode: '#form-field-postcode' } ``` -------------------------------- ### GET /keys/:key Source: https://docs.addresszen.com/docs/api/key-availability Fetches public information about a given API Key, including its availability status and the contexts it supports. This is useful for determining if a key is active and understanding its potential use cases based on user location. ```APIDOC ## GET /keys/:key ### Description Returns public information on your API Key, including its availability status and supported contexts. This endpoint can be used to determine if the key is currently usable, identify available contexts, and understand the likely context of a user based on their location. ### Method GET ### Endpoint /keys/:key ### Parameters #### Path Parameters - **key** (string) - Required - Your API Key (starts with `ak_`) or Sub-licensed Key (starts with `sl_`). ### Responses #### Success Response (200) - **available** (boolean) - Indicates if the API Key is currently usable. - **contexts** (array of strings) - A list of contexts supported by the API Key. - **likely_context** (string) - The most probable context for a user associated with this key, often determined by location. #### Error Response (404) - **error** (string) - Description of the error, e.g., "Invalid Key". ``` -------------------------------- ### Address - String Type Source: https://docs.addresszen.com/docs/data/gnaf The house number or address uniquely identifying the location on a street. Can be an empty string if not present. Example: '16'. ```string "address" ``` -------------------------------- ### Address Line One - String Type Source: https://docs.addresszen.com/docs/data/gnaf Represents the first line of an address. It can be an empty string if not present. Example: '30 Hampton Cct'. ```string "line_1" ``` -------------------------------- ### GET /postcodes/:postcode Source: https://docs.addresszen.com/docs/changelog Retrieves postcode information. If an exact match isn't found, it suggests up to 5 similar postcodes, checking for common character mix-ups. For all responses, it includes 'total', 'limit', and 'page' attributes. ```APIDOC ## GET /postcodes/:postcode ### Description Retrieves postcode information. If an exact match isn't found, it suggests up to 5 similar postcodes, checking for common character mix-ups. For all responses, it includes 'total', 'limit', and 'page' attributes. ### Method GET ### Endpoint /postcodes/:postcode ### Parameters #### Path Parameters - **postcode** (string) - Required - The postcode to search for. #### Query Parameters - **limit** (integer) - Optional - The maximum number of results to return. - **page** (integer) - Optional - The page number for paginated results. ### Response #### Success Response (200) - **suggestions** (array) - A list of suggested postcodes if no exact match is found. - **total** (integer) - The total number of results available. - **limit** (integer) - The maximum number of results per page. - **page** (integer) - The current page number. - **postcodes** (array) - A list of postcode objects matching the query. ``` -------------------------------- ### Address Lookup Setup in Gravity Forms (JavaScript) Source: https://docs.addresszen.com/docs/integrations/gravity-forms This snippet sets up the Address Lookup functionality provided by AddressZen within a Gravity Forms form. It requires an API key and maps Address Lookup output fields to specific input fields in the Gravity Form. Ensure to replace 'YOUR_API_KEY' and adjust the input field selectors based on your form's field IDs. ```html ``` -------------------------------- ### Initialize Address Lookup Plugin in Unbounce Source: https://docs.addresszen.com/docs/integrations/unbounce This script initializes the Address Lookup plugin for AddressZen. It requires an API key and maps output fields to specific HTML element IDs within your Unbounce form. Ensure your API key starts with 'ak_'. ```javascript ``` -------------------------------- ### Create Configuration API Source: https://context7_llms Creates a new configuration object. ```APIDOC ## POST /docs/api/create-config.md ### Description Creates a new configuration. ### Method POST ### Endpoint /docs/api/create-config.md ### Parameters #### Request Body - **config_name** (string) - Required - The name of the configuration. - **config_details** (object) - Required - The details of the configuration. ### Request Example { "config_name": "default_config", "config_details": { "setting1": "value1", "setting2": "value2" } } ### Response #### Success Response (200) - **message** (string) - Confirmation message. - **config_name** (string) - The name of the created configuration. #### Response Example { "message": "Configuration created successfully.", "config_name": "default_config" } ``` -------------------------------- ### Address Lookup: onMounted Callback Source: https://docs.addresszen.com/docs/address-lookup/callbacks Triggered when the Address Lookup controller attaches to the DOM. This is typically used for DOM manipulation or setup after the component is ready. ```javascript instance.onMounted = function() { console.log('Address Lookup mounted to DOM.'); }; ``` -------------------------------- ### Retrieve API Key Information (GET /keys/:key) Source: https://docs.addresszen.com/docs/api/key-availability This endpoint allows you to retrieve public information about your API key. It helps determine key usability, available contexts, and the likely context of a user based on their location. Both API Keys (ak_) and Sub-licensed Keys (sl_) are supported. ```http GET /keys/:key ``` -------------------------------- ### Salesforce Custom Object Field Mapping Source: https://docs.addresszen.com/docs/integrations/salesforce Example JSON configuration for mapping AddressZen address fields to Salesforce Custom Object fields. This allows Address Lookup to populate specific fields within your custom objects. ```json [ { "line_1": "Address_Line_One__c", "post_town": "Town_or_City__c", "postcode": "Postcode__c" }, { "line_1": "Customer_Line_1__c", "line_2": "Customer_Line_2__c", "post_town": "Customer_Post_Town__c", "postcode": "Customer_Postcode__c", "county": "Customer_UPRN__c" } ] ``` -------------------------------- ### Eircode Format Example Source: https://docs.addresszen.com/docs/data/ecad Illustrates the standard seven-character Eircode format (A65 F4E2) used in Irish postal addresses. The Eircode is a mandatory element and is typically placed on its own line. ```text A65 R2AF ``` -------------------------------- ### Custom Address Fields for Wizards (Example) Source: https://docs.addresszen.com/docs/integrations/zoho-crm Illustrates the configuration for custom address fields specifically for Zoho CRM wizards. It shows how to append 'input' to the identified element IDs within the 'crm-create-fields' parent element for accurate mapping. ```json [ { "line_1": "#Crm_Leads_LEADCF2 input", "post_town": "#Crm_Leads_CITY input", "postcode": "#Crm_Leads_ZIP input", "county": "#Crm_Leads_LEADCF3 input" } ] ``` -------------------------------- ### GET /places - Find Place Source: https://docs.addresszen.com/docs/api/find-place Query for geographical places across countries. Each query returns a list of place suggestions, including place name, descriptive name, and ID. Ideal for identifying places and their geolocation. ```APIDOC ## GET /places ### Description Query for geographical places across countries. Each query will return a list of place suggestions, which consists of a place name, descriptive name and id. This API returns geographical information such as countries, capitals, administrative areas and more. It is ideal for correctly identifying a place along with any other details like geolocation. ### Method GET ### Endpoint /places ### Parameters #### Query Parameters * **query** (string) - Required - The search query for places. ### Request Example ``` GET /places?query=New%20York ``` ### Response #### Success Response (200) - **places** (array) - A list of place suggestions. - **name** (string) - The name of the place. - **description** (string) - A descriptive name for the place. - **id** (string) - The unique identifier for the place. #### Response Example ```json { "places": [ { "name": "New York City", "description": "New York, NY, USA", "id": "ChIJp8Mp6fYEaQARufjO2_yP6Lw" } ] } ``` #### Error Response (400) - **error** (string) - A message describing the bad request. #### Response Headers - **X-RateLimit-Limit** (integer) - The maximum number of requests that can be made in 5 minutes. - **X-RateLimit-Remaining** (integer) - The remaining requests within the current rate limit window. - **X-RateLimit-Reset** (integer) - The time when the rate limit window resets in Unix Time (seconds) or UTC Epoch seconds. ``` -------------------------------- ### Custom Form Fields for Billing Address (JavaScript/HTML) Source: https://docs.addresszen.com/docs/integrations/magento This snippet demonstrates the structure for defining custom input fields for a billing address form. It includes common address components like street lines, city, state, and zip code, using specific input names compatible with AddressZen's API. ```javascript [ { 'line_1': 'input[name="billing_street0"]', 'line_2': 'input[name="billing_street1"]', 'city': 'input[name="billing_city"]', 'state': 'input[name="billing_state"]', 'zip_plus_4_code': 'input[name="billing_zipcode"]' } ] ``` -------------------------------- ### GET /autocomplete/addresses Source: https://docs.addresszen.com/docs/api/find-address Retrieves address suggestions based on a provided query. Supports various filters and bias options for refining search results. Rate limiting and cost details are also provided. ```APIDOC ## GET /autocomplete/addresses ### Description This endpoint provides address suggestions in order of relevance based on a provided query. It is designed to aid real-time address autofill implementations. ### Method GET ### Endpoint /autocomplete/addresses ### Query Parameters - **query** (string) - Required - The search query for address suggestions. - **postcode** (string) - Optional - Filters results by postcode. Supports multiple terms separated by commas. - **postcode_outward** (string) - Optional - Filters results by postcode outward. Supports multiple terms separated by commas. - **su_organisation_indicator** (string) - Optional - Filters results by organisation indicator. Supports multiple terms separated by commas. - **postcode_area** (string) - Optional - Filters results by postcode area. Supports multiple terms separated by commas. - **bias_postcode_area** (string) - Optional - Biases results towards specified postcode areas. Supports multiple terms separated by commas. ### Request Example ```json { "query": "10 downing street", "postcode": "sw1a2aa", "bias_postcode_area": "SW,SE" } ``` ### Response #### Success Response (200) - **suggestions** (array) - A list of address suggestions. The format is subject to change and should be used as-is. **Response Headers** - **X-RateLimit-Limit** (integer) - The maximum number of requests that can be made in 5 minutes. - **X-RateLimit-Remaining** (integer) - The remaining requests within the current rate limit window. - **X-RateLimit-Reset** (integer) - The time when the rate limit window resets in Unix Time (seconds) or UTC Epoch seconds. #### Response Example ```json { "suggestions": [ { "id": "123e4567-e89b-12d3-a456-426614174000", "address_line_1": "10 Downing Street", "address_line_2": "", "city": "London", "postcode": "SW1A 2AA" } ] } ``` #### Error Response (400) - **error** (string) - Description of the bad request. #### Error Example ```json { "error": "Invalid query parameter provided." } ``` ``` -------------------------------- ### Instantiate Address Lookup Source: https://docs.addresszen.com/docs/address-lookup/npm Sets up the Address Lookup service by instantiating it with your API key and specifying the output fields to be mapped to your HTML elements. ```javascript import { AddressLookup } from "@addresszen/address-lookup"; const controller = AddressLookup.setup({ apiKey: "zenkey", outputFields: { line_1: "#line_1", line_2: "#line_2", city: "#city", state: "#state", zip_plus_4_code: "#zipcode", }, }); ``` -------------------------------- ### Biasing - Multiple Postcode Outward Codes Source: https://docs.addresszen.com/docs/api/addresses Allows scoping multiple terms for the same bias attribute, separated by commas. This example boosts results for outward codes E1, E2, and E3. ```HTTP GET /addresses?bias_postcode_outward=e1,e2,e3 ``` -------------------------------- ### GET /addresses Source: https://docs.addresszen.com/docs/api/addresses Extracts a list of complete addresses matching the query, ordered by relevance. Supports optional limit and page parameters. If a postcode is provided, it returns all addresses for that postcode, ignoring limit and page. ```APIDOC ## GET /addresses ### Description Extracts a list of complete addresses that match the query ordered by relevance score. This query accepts an optional limit and page query (defaults to 10 and 0 respectively). If a valid postcode is passed as the query string, the entire address list for that postcode is passed as a result. Note, in these cases, limit and page parameters are ignored. ### Method GET ### Endpoint /addresses ### Query Parameters - **limit** (integer) - Optional - The maximum number of addresses to return. - **page** (integer) - Optional - The page number for pagination. - **postcode** (string) - Optional - Filters addresses by a specific postcode. - **q** (string) - Optional - The search query string for addresses. - **lat** (number) - Optional - Latitude for reverse geocoding. - **lon** (number) - Optional - Longitude for reverse geocoding. - **postcode_outward** (string) - Optional - Filters addresses by postcode outward codes (comma-separated). - **postcode_area** (string) - Optional - Filters addresses by postcode area (comma-separated). - **su_organisation_indicator** (string) - Optional - Filters by SU Organisation indicator. - **bias_postcode_area** (string) - Optional - Biases results by postcode area (comma-separated). - **bias_postcode_outward** (string) - Optional - Biases results by postcode outward codes (comma-separated). - **uprn** (integer) - Optional - Filters addresses by UPRN. ### Request Example ```json { "request": "GET /addresses?postcode=SW1A 2AA&limit=5" } ``` ### Response #### Success Response (200) - **addresses** (array) - A list of address objects. - **total_results** (integer) - The total number of matching addresses. #### Response Example ```json { "addresses": [ { "full_address": "10 Downing Street, London, SW1A 2AA" } ], "total_results": 1 } ``` ### Error Handling - **4020** - No lookups remaining. - **4021** - Daily or individual lookup limit breached. - **400** - Bad Request - **404** - Postcode Not Found ``` -------------------------------- ### List Configurations API Source: https://context7_llms Lists configurations associated with an API key. ```APIDOC ## GET /docs/api/list-configs.md ### Description Lists all configurations linked to the current API key. ### Method GET ### Endpoint /docs/api/list-configs.md ### Response #### Success Response (200) - **configurations** (array) - List of configuration names. #### Response Example { "configurations": ["default_config", "secondary_config"] } ``` -------------------------------- ### Create Licensee API Source: https://context7_llms Creates a licensee for a specified API Key. ```APIDOC ## POST /docs/api/create-licensee.md ### Description Creates a licensee associated with an API Key. ### Method POST ### Endpoint /docs/api/create-licensee.md ### Parameters #### Request Body - **api_key** (string) - Required - The API Key to associate the licensee with. - **licensee_details** (object) - Required - Details about the licensee. ### Request Example { "api_key": "YOUR_API_KEY", "licensee_details": { "name": "Example Corp", "email": "contact@example.com" } } ### Response #### Success Response (200) - **message** (string) - Confirmation message. - **licensee_id** (string) - The ID of the newly created licensee. #### Response Example { "message": "Licensee created successfully.", "licensee_id": "LIC12345" } ``` -------------------------------- ### ShopWired Integration Basic Configuration Source: https://docs.addresszen.com/docs/integrations/shopwired Provides the essential configuration snippet for the AddressZen ShopWired integration, primarily setting the API key. ```javascript ``` -------------------------------- ### Filtering - Restrict Address Search by Postcode Source: https://docs.addresszen.com/docs/api/addresses Narrows down search results by applying filters to address attributes. For example, restricting results to a specific postcode by appending the 'postcode' filter. ```HTTP GET /addresses?postcode=SW1A 2AA ``` -------------------------------- ### Filtering - Multiple Postcode Outward Codes Source: https://docs.addresszen.com/docs/api/addresses Allows scoping results using multiple terms for the same filter, separated by commas. This example restricts results to outward codes E1, E2, and E3. ```HTTP GET /addresses?postcode_outward=e1,e2,e3 ``` -------------------------------- ### GET /umprn/:umprn Source: https://docs.addresszen.com/docs/api/umprn Retrieves a multiple occupancy address identified by its UMPRN (Unique Property Reference Number). UMPRNs are unique numeric codes for multiple residence households. ```APIDOC ## GET /umprn/:umprn ### Description Retrieves a multiple occupancy address identified via its UMPRN (Unique Property Reference Number). UMPRNs are a unique numeric code for any Multiple Residence household on the optional Multiple Residence dataset. ### Method GET ### Endpoint /umprn/:umprn ### Parameters #### Path Parameters - **umprn** (integer) - Required - The Unique Property Reference Number to look up. ### Request Example (No request body for GET requests) ### Responses #### Success Response (200) - **address** (string) - The multiple occupancy address associated with the UMPRN. #### Response Example ```json { "address": "123 Multiple Occupancy Lane, Any Town, AT1 2BC" } ``` #### Error Responses - **404**: UMPRN not found. (Example response: "UMPRN not found") - **4020**: No lookups remaining. (Example response: "no lookups remaining") - **4021**: Daily or individual lookup limit breached. (Example response: "daily (or individual) lookup limit breached") ``` -------------------------------- ### Get Key Usage Statistics Source: https://docs.addresszen.com/docs/api/key-usage Retrieves the number of lookups consumed for a given API key within a specified date range. Supports a maximum interval of 90 days. Defaults to the last 21 days if no dates are provided. Can be filtered by tags. ```HTTP GET /keys/:key/usage ``` -------------------------------- ### GET /addresses - Extract Address List Source: https://docs.addresszen.com/docs/api/addresses Retrieves a list of complete addresses matching a query, ordered by relevance. Supports optional limit and page parameters. If a valid postcode is provided, the entire address list for that postcode is returned, ignoring limit and page. ```HTTP GET /addresses ``` -------------------------------- ### GET /udprn/:udprn Source: https://docs.addresszen.com/docs/api/udprn Retrieves address details using the Unique Delivery Point Reference Number (UDPRN). UDPRNs are eight-digit unique numeric codes identifying UK premises in the Postcode Address File. ```APIDOC ## GET /udprn/:udprn ### Description Retrieves an address as identified by its Unique Delivery Point Reference Number (UDPRN). ### Method GET ### Endpoint /udprn/:udprn ### Parameters #### Path Parameters - **udprn** (string) - Required - The Unique Delivery Point Reference Number for the address. ### Request Example ``` GET /udprn/25962203 ``` ### Response #### Success Response (200) - **address** (object) - The address details. - **udprn** (string) - The UDPRN of the address. #### Response Example ```json { "address": { "building_name": "Example House", "sub_building_name": "Flat 1", "department_name": "Sales", "organisation_name": "Example Corp", "po_box_number": "PO Box 123", "address_line1": "1 Example Street", "address_line2": "Example Road", "address_line3": "Example Village", "town_city": "Example Town", "county": "Exampleshire", "postcode": "EX1 2MP" }, "udprn": "25962203" } ``` #### Error Response (404) - **error** (string) - Description of the error, e.g., "UDPRN not found". #### Error Response Example ```json { "error": "UDPRN not found" } ``` ``` -------------------------------- ### Biasing - Boost Addresses by Postcode Area Source: https://docs.addresszen.com/docs/api/addresses Boosts certain address results based on address attributes. This example boosts addresses in postcode areas 'SW' and 'SE'. Unmatched addresses may still appear but will rank lower. ```HTTP GET /addresses?bias_postcode_area=SW,SE ``` -------------------------------- ### Versioning Source: https://docs.addresszen.com/docs/api/api-reference Understand how the AddressZen API is versioned and how to utilize different versions for compatibility. ```APIDOC ## Versioning This API is versioned with a simple prefix in the URL. The current version is `/v1/`. We will maintain backwards-compatibility by releasing breaking changes under a new version. Please note that the following changes are backwards-compatible: * Adding new properties to existing API responses * Adding new API endpoints * Adding new optional request parameters to existing API endpoints * Changing the order of properties in existing API responses * Changing the autocomplete address suggestion format ```