# Duo Data Utilities – Geohash Encode/Decode

> Duo Data Utilities – Geohash Encode/Decode is a paid API for AI agents from api.duoleads.com, paid per call via x402, $0.05/call, status unknown (last checked 2026-10-02).

Encodes WGS-84 lat/lon to a geohash string (with neighbours) or decodes a geohash to its bounding box, centre point, and error bounds in metres

## Facts

- Endpoint: GET https://api.duoleads.com/v1/geo/geohash?utm_source=zero.xyz
- Price: $0.05/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/duo-data-utilities-geohash-encode-decode-7197e4f7
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_dw31EnkLLdmVtIKNTB4mt

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability duo-data-utilities-geohash-encode-decode-7197e4f7
```

Example prompt: Encode latitude 52.37279 and longitude 4.89362 to a geohash at precision 9, and give me the 8 neighbouring cells so I can do a proximity search against my geohash-indexed store.

## When to prefer this

Choose this endpoint when you need deterministic, serverless geohash encoding or decoding without standing up a spatial database or importing a geohash library. It is especially useful when you need the 8 neighbours of a cell in the same call, which is the standard pattern for radius queries over geohash-indexed data. Prefer it over full spatial databases when the only operation needed is index-key computation at a known precision.

## Known failure modes

- Missing required lat/lon when op=encode returns a validation error
- Missing geohash parameter when op=decode returns a validation error
- Latitude out of -90 to 90 range causes a bad-request error
- Longitude out of -180 to 180 range causes a bad-request error
- Precision outside 1-12 range causes a validation error
- Geohash containing invalid characters (not in base-32 alphabet) returns a pattern-mismatch error
- Payment failure (x402) if USDC funds are insufficient or wallet is not configured

## How this service works

Encode a WGS-84 latitude and longitude to a geohash at a chosen precision, or decode a geohash back to its bounding box, centre point and error bounds in metres. Encoding also returns the eight neighbouring cells, which is what a caller needs to do proximity search over a geohash-indexed store without a spatial database.

## Output

For encode: the geohash string at the requested precision, plus an object with the 8 cardinal and diagonal neighbour geohash strings. For decode: the bounding box (min/max lat and lon), the centre lat/lon, precision length, and positional error in metres for both axes. All responses include a request ID, timestamp, determinism flag, and price metadata.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [],
     "properties": {
      "op": {
       "enum": [
        "encode",
        "decode"
       ],
       "type": "string",
       "default": "encode",
       "maxLength": 64,
       "description": "encode (default): lat/lon to geohash. decode: geohash to bounding box."
      },
      "lat": {
       "type": "string",
       "pattern": "^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][+-]?\\d+)?$",
       "maxLength": 64,
       "description": "WGS-84 latitude, -90 to 90. Required when op=encode."
      },
      "lon": {
       "type": "string",
       "pattern": "^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][+-]?\\d+)?$",
       "maxLength": 64,
       "description": "WGS-84 longitude, -180 to 180. Required when op=encode."
      },
      "geohash": {
       "type": "string",
       "pattern": "^[0-9bcdefghjkmnpqrstuvwxyz]{1,12}$",
       "maxLength": 64,
       "description": "Geohash to decode, 1-12 characters. Required when op=decode."
      },
      "precision": {
       "type": "string",
       "default": "9",
       "pattern": "^[+-]?\\d+$",
       "maxLength": 64,
       "description": "Geohash length 1-12, default 9 (about 4.8 m)."
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "required": [
      "ok",
      "route",
      "version",
      "data",
      "meta"
     ],
     "properties": {
      "ok": {
       "const": true
      },
      "data": {
       "type": "object",
       "required": [
        "geohash",
        "precision",
        "bbox",
        "center",
        "error_m"
       ],
       "properties": {
        "bbox": {
         "type": "object",
         "required": [
          "min_lat",
          "min_lon",
          "max_lat",
          "max_lon"
         ],
         "properties": {
          "max_lat": {
           "type": "number"
          },
          "max_lon": {
           "type": "number"
          },
          "min_lat": {
   
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "data": {
   "bbox": {
    "max_lat": 52.37281322479248,
    "max_lon": 4.893636703491211,
    "min_lat": 52.37277030944824,
    "min_lon": 4.893593788146973
   },
   "center": {
    "lat": 52.37279176712036,
    "lon": 4.893615245819092
   },
   "error_m": {
    "lat": 2.39,
    "lon": 1.46
   },
   "geohash": "u173zq5mt",
   "precision": 9,
   "neighbours": {
    "e": "u173zq5mw",
    "n": "u173zq5mv",
    "s": "u173zq5mm",
    "w": "u173zq5ms",
    "ne": "u173zq5my",
    "nw": "u173zq5mu",
    "se": "u173zq5mq",
    "sw": "u173zq5mk"
   }
  },
  "meta": {
   "price_usd": "0.05",
   "disclaimer": "Factual output of a deterministic computation over public data. Provided as is, with no warranty of accuracy, completeness or availability. Not investment, financial, legal, tax, medical or any other professional advice, and not a recommendation. Verify before relying on it. Terms: https://api.duoleads.com/terms",
   "request_id": "01K6B7Q4ZC8H3F2M9WXR5TYN0D",
   "computed_at": "2026-09-28T12:00:00.000Z",
   "deterministic": true
  },
  "route": "/v1/geo/geohash",
  "version": "1.0.0"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/duo-data-utilities-geohash-encode-decode-7197e4f7/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.duoleads.com](https://www.zero.xyz/host/api.duoleads.com/llms.txt)
