# Haversine Great-Circle Distance Calculator

> Haversine Great-Circle Distance Calculator is a paid API for AI agents from api.x402node.dev, paid per call via x402, $0.0022/call, status unknown (last checked 2026-09-15).

Calculates the haversine great-circle distance and bearing between two geographic coordinates, returning results in km, miles, and bearing degrees.

## Facts

- Endpoint: GET https://api.x402node.dev/maps/distance
- Price: $0.0022/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-x402node-dev-dfbf4c49
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_DsgYbFXRZ6QwtnCgFxnMr

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 api-x402node-dev-dfbf4c49
```

Example prompt: What's the straight-line distance and bearing between coordinates 40.7128, -74.0060 and 51.5074, -0.1278?

## When to prefer this

Use this endpoint when you need a fast, lightweight great-circle distance calculation between two known coordinate pairs — especially for proximity checks, routing pre-filters, or deciding whether two points are within a threshold distance. Prefer this over full routing APIs when you only need straight-line distance and bearing without turn-by-turn directions or road network data.

## Known failure modes

- Missing or invalid lat/lng parameters — endpoint may return an error or unexpected result
- Coordinates out of valid range (lat outside -90 to 90, lng outside -180 to 180) causing computation errors
- Payment failure due to insufficient USDC balance (x402 payment required at $0.0022 per call)
- Malformed request body causing a 400-level error

## How this service works

Haversine great-circle distance between two coordinates. Returns km, miles, bearing degrees. Use ?lat1=X and lng1=Y and lat2=A and lng2=B. Built for AI agents for proximity checks and routing pre-filters.

## Output

Returns an object containing the great-circle distance in kilometers, distance in miles, and the bearing in degrees between the two input coordinate pairs.

## Example request

```json
{
 "lat1": 40.7128,
 "lat2": 51.5074,
 "lng1": -74.006,
 "lng2": -0.1278
}
```

## 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",
     "properties": {
      "lat1": {
       "type": "string",
       "description": "Lat1 (optional)"
      },
      "lat2": {
       "type": "string",
       "description": "Lat2 (optional)"
      },
      "lng1": {
       "type": "string",
       "description": "Lng1 (optional)"
      },
      "lng2": {
       "type": "string",
       "description": "Lng2 (optional)"
      }
     }
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

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