Geocode + reverse geocode

Address to coordinates or coordinates to address from OpenStreetMap Nominatim, cached.

Geocoding with OpenStreetMap Nominatim: address or place name -> coordinates (up to 5 matches, optional country filter), or lat+lon -> structured address (reverse). Structured address fields, country code, bounding box, OSM id. Cached; ODbL attribution included.

$0.0015 per call in USDC on Base via x402, or pay by card with prepaid credits (1 credit) · 1 free call per caller · no signup · Listed on PayAPI Market (this route is not PayAPI-verified yet; 7 other routes are, each by one settled test payment)

GET https://freetier-agent-api.pages.dev/api/geocode

When to use it

Use geocode to turn an address or place into coordinates, or coordinates into an address (OpenStreetMap).

Parameters

NameTypeDescription
qstringaddress or place name (forward geocoding)
latstringlatitude for reverse geocoding (with lon)
lonstringlongitude for reverse geocoding (with lat)
limitstring1-5 matches, default 1
countrystringISO 3166-1 alpha-2 filter, e.g. dk or us,ca
langstringresult language, default en

Example output (real response, trimmed)

{
 "mode": "forward",
 "query": {
  "q": "Eiffel Tower, Paris",
  "limit": 1,
  "country": null
 },
 "count": 1,
 "results": [
  {
   "lat": 48.8582599,
   "lon": 2.2945006,
   "display_name": "Eiffel Tower, 5, Avenue Anatole France, Quartier du Gros-Caillou, 7th Arrondissement, Paris, Ile-de-France, Metropolitan France, 75007, France",
   "name": "Eiffel Tower",
   "category": "man_made",
   "type": "tower",
   "address": {
    "house_number": "5",
    "road": "Avenue Anatole France",
    "postcode": "75007",
    "city": "Paris",
    "county": null,
    "state": "Ile-de-France",
    "country": "France",
    "country_code": "FR"
   },
   "bbox": [
    48.8574753,
    48.8590453
   ],
   "osm": {
    "type": "way",
    "id": 5013364
   },
   "importance": 0.621
  }
 ],
 "attribution": "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright",
 "sources": [
  {
   "name": "OpenStreetMap Nominatim",
   "url": "https://nominatim.org/",
   "license": "ODbL 1.0"
  }
 ]
}

Try it

Free call (no wallet needed)

curl -s "https://freetier-agent-api.pages.dev/api/geocode?q=Eiffel+Tower%2C+Paris"

Pay by card (no wallet): prepaid credits

Buy a credit pack on Gumroad (1,000 credits $3), then send your license key. The X-Credits-Remaining response header shows your balance; failed calls are not charged.

curl -s "https://freetier-agent-api.pages.dev/api/geocode?q=Eiffel+Tower%2C+Paris" \
  -H 'X-License-Key: YOUR-LICENSE-KEY'

JavaScript / TypeScript (@x402/fetch)

// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.EVM_PRIVATE_KEY); // wallet with USDC on Base
const fetchWithPayment = wrapFetchWithPaymentFromConfig(fetch, {
  schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(account) }],
});
const res = await fetchWithPayment("https://freetier-agent-api.pages.dev/api/geocode?q=Eiffel+Tower%2C+Paris");
console.log(await res.json());

Python (x402 + httpx)

# pip install "x402[httpx,evm]" eth-account
import asyncio, os
from eth_account import Account
from x402 import x402Client
from x402.http.clients import x402HttpxClient
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client

async def main():
    client = x402Client()
    register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"])))
    async with x402HttpxClient(client) as http:
        r = await http.get("https://freetier-agent-api.pages.dev/api/geocode?q=Eiffel+Tower%2C+Paris")
        print(r.json())

asyncio.run(main())

A bare request without parameters returns the HTTP 402 payment challenge (x402 v2 in the PAYMENT-REQUIRED header, v1 in the body). Invalid input gets a 400 before any payment.

Billing policy

Failed calls are never charged. Failed calls are never charged: the payment is verified first, the request runs, and the payment is settled only if it succeeded. Errors (4xx/5xx) are not settled, and invalid input is rejected before any payment or free call.

Uptime and latency

Independent monitoring of this endpoint: 402index service page (health, 30-day uptime, p50 latency).

Also available as


Agent Extraction API by FreeTier Kits · Terms · llms.txt · /.well-known/x402 · MCP: https://freetier-agent-api.pages.dev/mcp · Contact: tec@mail.grokbot.com
This site and its texts were written with AI assistance and reviewed for accuracy; example outputs are real responses from the API.