Hosted API: make a request

Addressr documents the request and response. RapidAPI handles your hosted account, API key, billing and plan changes.

  1. Start an Addressr plan on RapidAPI. Compare and select an Addressr plan on RapidAPI. RapidAPI is the authoritative source for current prices and request limits.
  2. Copy the API key from RapidAPI. Store it in the RAPIDAPI_KEY environment variable; do not put it in browser code or commit it to source control.
  3. Search for an address.
    curl "https://addressr.p.rapidapi.com/addresses?q=300+Barangaroo+Ave" \
      -H "x-rapidapi-key: $RAPIDAPI_KEY" \
      -H "x-rapidapi-host: addressr.p.rapidapi.com"
  4. Use the result. Each match includes a human-readable address in sla and a stable address identifier in pid. Follow the response links or use the identifier with the address-detail endpoint for structured fields and geocoding.

Self-hosted: run the service

Choose this path when your team can operate Node.js, OpenSearch and quarterly G-NAF updates. Allow about an hour for the first full download and index; timing depends on your machine and options.

Addressr requires Node.js 22 or newer. Continuous integration tests the current release with OpenSearch 2.19.5 and 3.5.0.

  1. Install Addressr.
    npm install --global @mountainpass/addressr
  2. Start OpenSearch for local evaluation.
    docker run --name addressr-opensearch \
      -p 9200:9200 -p 9300:9300 \
      -e "discovery.type=single-node" \
      -e "plugins.security.disabled=true" \
      opensearchproject/opensearch:3.5.0

    This example disables OpenSearch security and is for a local machine only. Do not expose it to a network or use it as a production security configuration.

  3. Start the API in a second terminal.
    export ELASTIC_HOST=localhost
    export ELASTIC_PORT=9200
    addressr-server-2
  4. Load G-NAF in a third terminal.
    export ELASTIC_HOST=localhost
    export ELASTIC_PORT=9200
    addressr-loader

    The loader downloads and indexes the Australian address data. Keep this terminal open until it completes.

  5. Check the local API.
    curl "http://localhost:8080/addresses?q=300+Barangaroo+Ave"

For geocoding, state filters, cached data and scheduled updates, use the maintained self-hosting reference in the Addressr repository.