Skip to main content

Overview

The Loqate TypeScript SDK makes it easy to capture, verify, and enrich address data without handling HTTP requests or response parsing manually. It’s available as the @loqate/core package and can be used in Node.js, browser, or Next.js apps. You can call the same services exposed by our API — just faster, safer, and with full TypeScript support.
🔧 The SDK replaces direct API calls, but everything maps 1:1 to our REST API. You can still reference endpoint details in the API Reference.

Installation

Basic instructions for package managers:
npm install @loqate/core
# or
yarn add @loqate/core
# or
pnpm add @loqate/core

Initialisation and configuration

You can initialise the Loqate client by importing the LoqateClient class from the @loqate/core package and providing your API key in the configuration object, as shown below:
import { LoqateClient } from "@loqate/core";

const loqate = new LoqateClient({
  apiKey: process.env.LOQATE_API_KEY,
  serverURL: "https://api.addressy.com"
});
You can also configure additional options such as the server URL for the API. This is useful if you want to proxy requests through your own server or use a different endpoint. Your API key can be set on the client instance, or passed in per-request:
 const result = await loqate.capture.find({
    key: "AA11-AA11-AA11-AA11",
    text: "wr5 3da"
  });

Quick start examples

Address Capture

Address capture provides two main methods: find and retrieve.

Address Capture - Find

The find request is used to search for addresses based on user input.
 const result = await loqate.capture.find({
    text: "wr5 3da"
  });
You can also pass additional parameters to refine the search, such as container to specify a container ID.
 const result = await loqate.capture.find({
    text: "Baker Street",
    container: "123456789"
  });

Address Capture - Retrieve

The retrieve request is used to get the full address details for a specific address ID returned from a find request.
const details = await loqate.capture.retrieve({
    id: result.items?.[0].id,
  });
For interactive address search or autocomplete, see the Capture SDK guide.

Address Verify

Address verification provides a method to verify and standardize addresses.
const response = await loqate.cleansing.batch({
  addresses: [
    {
      address: "10 Downing St, Westminster, London SW1A 2AA, UK",
      country: "GB",
    },
    {
      address: "1600 Amphitheatre Parkway, Mountain View, CA 94043, USA",
      country: "US",
    },
  ],
  options: {
    serverOptions: {
      fieldStatus: "true",
    },
  },
});

Advanced usage

For more advanced usage and additional features, refer to the npm listing.