---
title: "Plus code (Open Location Code) encoder and decoder"
method: GET
path: "/v1/geo/pluscode"
tags: ["deterministic", "no-api-key", "geo", "pluscode"]
---

# Plus code (Open Location Code) encoder and decoder

`GET /v1/geo/pluscode`

## Request

- Base URL: `https://api.duoleads.com`
- URL: `https://api.duoleads.com/v1/geo/pluscode`
- Auth: none declared

Plus code (Open Location Code) encoder and decoder: encode coordinates as a plus code at a chosen length, or decode a full code back to its bounding box and centre. Also shortens a full code against a reference coordinate and recovers a shortened code given a reference, which is how plus codes are normally exchanged in text. Returns code length, precision in metres and validity.

**Output (`data`):** code, length (integer|null, null for an invalid code), bbox {min_lat, min_lon, max_lat, max_lon}, center {lat, lon}, precision_m (cell height in metres, rounded to 0.1), is_full, is_short, valid, reason (string|null, null on success). Invalid codes on op=decode return 200 with valid:false and a reason (invalid character is checked before the + position); short codes decode to valid:true, is_short:true without a bbox. shorten also returns full_code. shorten/recover with a malformed code are 400 INVALID_PARAM.

Deterministic: identical input returns identical output, so the response is served with `Cache-Control: private, max-age=31536000, immutable` (the paying client may cache it indefinitely; shared caches must not, because the response is paid).

Price: $0.05 USDC per call (x402, Base). Route contract version 1.0.0. Docs: https://api.duoleads.com/docs#geo-pluscode

## Query parameters

- `op` 'encode' | 'decode' | 'shorten' | 'recover'
- `lat` number
- `lon` number
- `code` string
- `length` integer
- `ref_lat` number
- `ref_lon` number

## Response `200`

Paid and settled. `data` is route-specific; a route that judges its input returns 200 with `data.valid: false` for a bad value.

- object
  - `ok` unknown, required
  - `route` '/v1/geo/pluscode', required
  - `version` '1.0.0', required
  - `data` object, required: code, length (integer|null, null for an invalid code), bbox {min_lat, min_lon, max_lat, max_lon}, center {lat, lon}, precision_m (cell height in metres, rounded to 0.1), is_full, is_short, valid, reason (string|null, null on success). Invalid codes on op=decode return 200 with valid:false and a reason (invalid character is checked before the + position); short codes decode to valid:true, is_short:true without a bbox. shorten also returns full_code. shorten/recover with a malformed code are 400 INVALID_PARAM.
    - `code` string, required
    - `length` integer, nullable, required
    - `bbox` object
      - `min_lat` number, required
      - `min_lon` number, required
      - `max_lat` number, required
      - `max_lon` number, required
    - `center` object
      - `lat` number, required
      - `lon` number, required
    - `precision_m` number
    - `is_full` boolean, required
    - `is_short` boolean, required
    - `valid` boolean, required
    - `reason` string, nullable
    - `full_code` string
  - `meta` Meta, required
    - `disclaimer` string, required: Legal short disclaimer, identical on every response.
    - `request_id` string, required: ULID.
    - `computed_at` string, date-time, required: RFC 3339 UTC with milliseconds.
    - `price_usd` string, required: Decimal string, "0.05".
    - `deterministic` boolean, required
    - `sources` object[]: Present only on routes that read a vendored dataset: the exact edition that answered.
      - `id` string, required
      - `version` string, required
      - `published` string, required
      - `attribution` string
      - `licence` string

## Other responses

- `400`: MISSING_PARAM, INVALID_PARAM or UNSUPPORTED_VALUE. Not charged: validation runs before the paywall.
- `402`: Payment required. No valid PAYMENT-SIGNATURE was supplied: read the base64 PAYMENT-REQUIRED header (or this body) for the price ($0.05 = 50000 atomic USDC on eip155:8453), sign an EIP-3009 authorization and retry. Also returned when settlement is declined (PAYMENT_FAILED). Nothing is charged on a 402.
- `404`: NOT_FOUND: unknown path. Not charged.
- `405`: METHOD_NOT_ALLOWED: only GET and HEAD are served. Not charged.
- `413`: INPUT_TOO_LARGE: a parameter exceeded its documented maximum length. Not charged.
- `500`: INTERNAL: a server bug. Not charged.

---

[API](https://skmtc.dev/duoleads/apis/duo-data-utilities-iban-isin-vat-tax-id-barcode-timezone-geo.md) · [All operations](https://skmtc.dev/duoleads/apis/duo-data-utilities-iban-isin-vat-tax-id-barcode-timezone-geo/llms.txt) · [OpenAPI document](https://skmtc.dev/duoleads/apis/duo-data-utilities-iban-isin-vat-tax-id-barcode-timezone-geo/revisions/18790d59615e?raw)
