Eircode Lookup API

A simple JSON API for resolving Eircodes and Irish addresses to coordinates and a Google Maps link. Distributed exclusively via RapidAPI.

Base URL: https://eircode-api.p.rapidapi.comContent-Type: application/jsonGet an API key on RapidAPI →OpenAPI 3.0 spec
Open source on GitHub
forcequit/eircode-api — MIT licensed

Endpoint

GET/api/eircode?q=<query>

Look up an address or Eircode using a URL query parameter. Best for quick tests and sharing links.

Query parameters
NameTypeRequiredDescription
qstringYesEircode (e.g. D02 X285) or address (e.g. Trinity College Dublin). 2–200 chars.
curl "https://eircode-api.p.rapidapi.com/api/eircode?q=D02+X285" \
  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
  -H "X-RapidAPI-Host: eircode-api.p.rapidapi.com"

Response

The endpoint returns JSON. ok: true on success, ok: false on failure. HTTP status is 200 on success and 400 on errors (validation, no match, upstream failure).

Success fields (ok: true)
Returned when a result is found.
FieldTypeDescription
oktrueIndicates a successful lookup.
querystringThe original query you submitted.
formattedAddressstringHuman-readable address from Google Maps.
eircodestring | nullEircode in A65 F4E2 format, or null if not resolvable.
location.latnumberLatitude in decimal degrees (WGS84).
location.lngnumberLongitude in decimal degrees (WGS84).
placeIdstringGoogle Maps Place ID for further API calls.
embedUrlstringURL ready to drop into an <iframe> for a map preview.
tookMsnumberServer-side processing time in milliseconds (includes the upstream geocoding call).
Error fields (ok: false)
Returned with HTTP 400 when a lookup fails.
FieldTypeDescription
okfalseIndicates the lookup failed.
errorstringHuman-readable error message.
tookMsnumberServer-side processing time in milliseconds.

Success example

{
  "ok": true,
  "query": "D02 X285",
  "formattedAddress": "Saint Kevin's, Dublin, Co. Dublin, D02 X285, Ireland",
  "eircode": "D02 X285",
  "location": {
    "lat": 53.3320669,
    "lng": -6.255491699999999
  },
  "placeId": "ChIJgclyraMOZ0gRRA_QJFnS6VA",
  "embedUrl": "https://www.google.com/maps/search/?api=1&query=53.3320669,-6.255491699999999&query_place_id=ChIJgclyraMOZ0gRRA_QJFnS6VA",
  "tookMs": 111
}

Error example

{
  "ok": false,
  "error": "No match found in Ireland for that input.",
  "tookMs": 87
}

Self-host (open source)

The API is a small Cloudflare Worker. Run it yourself with your own Google Maps key — no RapidAPI subscription required.

Prerequisites

  • Bun (or Node.js 18+ with npm)
  • A free Cloudflare account (only needed to deploy)
  • A Google Maps API key with Geocoding API and Places API enabled — create one here

Run locally

git clone https://github.com/forcequit/eircode-api.git
cd eircode-api/oss

bun install
cp .dev.vars.example .dev.vars
# edit .dev.vars and set GOOGLE_MAPS_API_KEY=your_key_here

bun run dev
# Worker available at http://localhost:8787
curl "http://localhost:8787/eircode?q=D02+X285"

Deploy to Cloudflare

npx wrangler login
npx wrangler secret put GOOGLE_MAPS_API_KEY
npx wrangler secret put RAPIDAPI_PROXY_SECRET   # optional, locks the endpoint
bun run deploy

Full instructions and the source are on GitHub.

Status codes

CodeMeaning
200Successful lookup. ok: true in the body.
400Validation error, no match, or upstream geocoding failure. ok: false.