# x402 Geocoding API

> x402 Geocoding API is a paid API for AI agents from geocoding-x402.royaldemocracy.workers.dev, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Converts a street address to lat/lon coordinates (forward geocoding) or coordinates to a human-readable address (reverse geocoding) for $0.001 USDC per request via x402 pay-per-call.

## Facts

- Endpoint: GET https://geocoding-x402.royaldemocracy.workers.dev/api/geocode
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-geocoding-api-11364c7d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_5dvS6QPz4RF2AdXtJVnas

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 x402-geocoding-api-11364c7d
```

Example prompt: What are the latitude and longitude coordinates for 1600 Pennsylvania Avenue NW, Washington DC?

## When to prefer this

Choose this endpoint when you need lightweight, on-demand geocoding without managing API keys or subscriptions — ideal for AI agents that need pay-per-use access to geocoding via x402 and USDC on Base. Best for low-volume or bursty workloads where a flat per-call fee is preferable to a monthly subscription.

## Known failure modes

- Address not found or ambiguous — may return empty or null result
- Invalid coordinate format for reverse geocoding — malformed lat/lon
- Payment failure via x402 — request rejected if USDC payment not completed
- Rate or quota limits on the underlying geocoding data source
- Network timeout from Cloudflare Workers edge node

## How this service works

Convert addresses to coordinates or coordinates to addresses for $0.001 per request. No API key or subscription. Pay with USDC on Base via x402.

## Output

Returns a JSON object with latitude (lat), longitude (lon), and a human-readable display_name string representing the resolved location (e.g. {"lat":42.36,"lon":-71.06,"display_name":"Boston, MA, USA"}).

## 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"
    }
   }
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "lat": 38.8976763,
  "lon": -77.0365298,
  "display_name": "1600 Pennsylvania Ave NW, Washington, DC 20500, USA"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-geocoding-api-11364c7d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from geocoding-x402.royaldemocracy.workers.dev](https://www.zero.xyz/host/geocoding-x402.royaldemocracy.workers.dev/llms.txt)
