# Location Toolkit for AI agents: copy-paste examples

First 3 calls per day are free (no key, no signup). After that each call returns HTTP 402 with x402 payment details (USDC on Base).

## curl
```bash
# Coordinates -> DIGIPIN (India) + Plus Code (world)
curl -s -X POST https://location-toolkit.ameeras-official.workers.dev/code -H "content-type: application/json" -d '{"lat":13.0827,"lng":80.2707}'

# Any code -> coordinates
curl -s -X POST https://location-toolkit.ameeras-official.workers.dev/code -H "content-type: application/json" -d '{"code":"4P3-JK8-52C9"}'

# Indian PIN code lookup
curl -s -X POST https://location-toolkit.ameeras-official.workers.dev/pincode -H "content-type: application/json" -d '{"pincode":"600040"}'

# Nearest towns (worldwide)
curl -s -X POST https://location-toolkit.ameeras-official.workers.dev/reverse -H "content-type: application/json" -d '{"lat":48.8566,"lng":2.3522}'

# Postal code format check (240+ countries)
curl -s -X POST https://location-toolkit.ameeras-official.workers.dev/postal-check -H "content-type: application/json" -d '{"postal_code":"SW1A 1AA","country":"GB"}'

# Distance between a PIN code and a Plus Code
curl -s -X POST https://location-toolkit.ameeras-official.workers.dev/distance -H "content-type: application/json" -d '{"from":"600040","to":"7J4VXH8P+2C"}'

# Clean a messy address
curl -s -X POST https://location-toolkit.ameeras-official.workers.dev/address-clean -H "content-type: application/json" -d '{"address":"12 2nd main rd nr water tank anna nagar w chennai 600040","country":"IN"}'
```

## MCP (Claude Desktop, Cursor, any MCP client)
```json
{ "mcpServers": { "location-toolkit": { "url": "https://location-toolkit.ameeras-official.workers.dev/mcp" } } }
```

## Paying with x402 (TypeScript)
```ts
import { wrapFetchWithPayment } from "x402-fetch";
import { privateKeyToAccount } from "viem/accounts";
const pay = wrapFetchWithPayment(fetch, privateKeyToAccount("0xYOUR_AGENT_WALLET_KEY"));
const res = await pay("https://location-toolkit.ameeras-official.workers.dev/pincode", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ pincode: "110001" }) });
console.log(await res.json());
```

More: https://location-toolkit.ameeras-official.workers.dev/llms.txt - OpenAPI: https://location-toolkit.ameeras-official.workers.dev/openapi.json - Try it: https://location-toolkit.ameeras-official.workers.dev/try
