# agent402.tools Geo Distance (Haversine)

> agent402.tools Geo Distance (Haversine) is a paid API for AI agents from agent402.tools, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Calculates the great-circle distance between two latitude/longitude coordinate pairs using the haversine formula, returning the result in both kilometers and miles.

## Facts

- Endpoint: POST https://agent402.tools/api/geo-distance
- 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/agent402-tools-geo-distance-haversine-47987011
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_S0ebind7ZhKsZPc0dlooJ

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 agent402-tools-geo-distance-haversine-47987011 -d '<json body>'
```

Example prompt: What is the straight-line distance between New York City (40.7128, -74.0060) and Los Angeles (34.0522, -118.2437) in both kilometers and miles?

## When to prefer this

Use this endpoint when you need a precise, deterministic great-circle (as-the-crow-flies) distance between two geographic coordinates and want results in both kilometers and miles without setting up your own math. Prefer this over routing APIs when you only need straight-line distance, not road distance or travel time.

## Known failure modes

- Missing or malformed 'from' or 'to' object with lat/lng fields returns a validation error
- Coordinates outside valid range (lat -90 to 90, lng -180 to 180) may return an error
- Payment failure or insufficient USDC balance prevents the call from completing
- Network timeout if the service is temporarily unavailable

## How this service works

Great-circle distance between two latitude/longitude points using the haversine formula. Returns kilometers and miles. Deterministic.

## Output

Returns the great-circle distance between the two provided lat/lng points expressed in both kilometers and miles. The calculation is deterministic and uses the haversine formula.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "to": {
   "type": "object",
   "description": "{ lat, lng } in decimal degrees"
  },
  "from": {
   "type": "object",
   "description": "{ lat, lng } in decimal degrees"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "km": 3935.75,
  "miles": 2445.56
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-tools-geo-distance-haversine-47987011/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
