2s Geocode API
The geocode API from 2s — 2 operation(s) for geocode.
The geocode API from 2s — 2 operation(s) for geocode.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/2s-io:2s-io-geocode-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: 2s — the (most) everything Geocode API
version: '1'
summary: The (most) everything API.
description: 'The (most) everything API for AI agents: 575+ pay-per-call endpoints on one origin.'
contact:
name: 2s
url: https://2s.io
email: alley@2s.io
x-logo:
url: https://2s.io/icon-512.png
altText: 2s
x-guidance: 'Pay-per-call REST API for AI agents — hundreds of endpoints returning ground-truth data (US public records, company & legal identifiers, finance/SEC, crypto/web3, security & CVEs, medical codes, weather & geocoding, agriculture, energy, maritime, music, and more). Every endpoint is paid per call in USDC via x402 (Base or Solana) — no API key, no signup. Call any endpoint with no auth to get a 402 PaymentRequirements envelope, sign it (EIP-3009 on Base, partial SPL transfer on Solana), and retry with the PAYMENT-SIGNATURE header. Add ?trial=1 for one free real call per endpoint per hour to test before paying. To discover the right endpoint: GET https://2s.io/api/directory for the full catalog, or GET https://2s.io/api/search/endpoints?q=<natural-language task> for a ranked match. Per-call price is on each operation as x-payment-info (from $0.001). Batch up to 50 calls behind one payment via POST https://2s.io/api/batch/run.'
servers:
- url: https://2s.io
tags:
- name: Geocode
paths:
/api/geocode/address:
get:
tags:
- Geocode
summary: Forward geocoding - free-text address or place name
description: 'Forward geocoding — free-text address or place name → latitude/longitude plus structured address components (houseNumber, road, suburb, city, county, state, postcode, country, countryCode). Query: q (2-500 chars), limit (1-10, default 5), country (optional 2-letter ISO 3166-1 bias). Underlying data is OpenStreetMap (ODbL). Sister: /api/geocode/reverse.'
operationId: geocode_address
deprecated: false
security:
- x402Payment: []
responses:
'200':
description: 'Normalized envelope: items = geocode matches (formattedAddress, latitude, longitude, boundingBox, class, type, importance, structured address); total = null (no upstream total); meta.query echoes the request, meta.cacheHit flags a cache serve.'
content:
application/json:
schema:
type: object
required:
- data
- meta
properties:
data:
type: object
properties:
ok:
type: boolean
enum:
- true
items:
type: array
items:
type: object
properties:
formattedAddress:
type: string
latitude:
type: number
longitude:
type: number
boundingBox:
type: array
items:
type: number
nullable: true
description: '[south, north, west, east]; null for points.'
class:
type: string
description: OSM categorization, e.g. 'place', 'highway', 'boundary'.
type:
type: string
description: OSM subtype, e.g. 'house', 'street', 'city', 'country'.
importance:
type: number
description: 0..1 relevance score; higher = better match.
address:
type: object
properties:
houseNumber:
type: string
nullable: true
road:
type: string
nullable: true
suburb:
type: string
nullable: true
city:
type: string
nullable: true
county:
type: string
nullable: true
state:
type: string
nullable: true
postcode:
type: string
nullable: true
country:
type: string
nullable: true
countryCode:
type: string
nullable: true
required:
- houseNumber
- road
- suburb
- city
- county
- state
- postcode
- country
- countryCode
additionalProperties: false
required:
- formattedAddress
- latitude
- longitude
- boundingBox
- class
- type
- importance
- address
additionalProperties: false
total:
type: integer
nullable: true
description: Total matching rows upstream; null when unknown.
source:
$ref: '#/components/schemas/Source'
meta:
type: object
properties:
query:
type: object
properties:
kind:
type: string
input:
type: string
required:
- kind
- input
additionalProperties: false
cacheHit:
type: boolean
required:
- query
- cacheHit
additionalProperties: false
required:
- ok
- items
- total
- source
additionalProperties: false
meta:
$ref: '#/components/schemas/CallMeta'
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/PaymentRequired'
'405':
$ref: '#/components/responses/MethodNotAllowed'
'500':
$ref: '#/components/responses/ServerError'
'502':
$ref: '#/components/responses/UpstreamError'
x-2s-id: geocode.address
x-2s-version: null
x-2s-price:
usd: 0.0025
x-2s-accepts:
- x402
x-2s-response-shape: normalized
x-payment-info:
price:
mode: fixed
currency: USD
amount: '0.002500'
protocols:
- x402: {}
parameters:
- name: q
in: query
required: true
description: Free-text search query.
schema:
type: string
minLength: 2
maxLength: 500
- name: limit
in: query
required: false
description: Maximum number of results to return.
schema:
type: integer
minimum: 1
maximum: 10
default: 5
- name: country
in: query
required: false
description: Country name or ISO country code.
schema:
type: string
pattern: ^[a-z]{2}$
- $ref: '#/components/parameters/TrialMode'
/api/geocode/reverse:
get:
tags:
- Geocode
summary: Reverse geocoding - latitude/longitude nearest formatted
description: 'Reverse geocoding — latitude/longitude → nearest formatted address plus structured components (houseNumber, road, suburb, city, county, state, postcode, country, countryCode). Query: lat (-90..90), lon (-180..180). Underlying data is OpenStreetMap (ODbL). Sister: /api/geocode/address.'
operationId: geocode_reverse
deprecated: false
security:
- x402Payment: []
responses:
'200':
description: 'Normalized envelope: items = [address] (nearest formatted address + structured components; empty if none); total = items.length; meta.query echoes the request, meta.cacheHit flags a cache serve.'
content:
application/json:
schema:
type: object
required:
- data
- meta
properties:
data:
type: object
properties:
ok:
type: boolean
enum:
- true
items:
type: array
items:
type: object
properties:
formattedAddress:
type: string
latitude:
type: number
longitude:
type: number
boundingBox:
type: array
items:
type: number
nullable: true
description: '[south, north, west, east]; null for points.'
class:
type: string
description: OSM categorization, e.g. 'place', 'highway', 'boundary'.
type:
type: string
description: OSM subtype, e.g. 'house', 'street', 'city', 'country'.
importance:
type: number
description: 0..1 relevance score; higher = better match.
address:
type: object
properties:
houseNumber:
type: string
nullable: true
road:
type: string
nullable: true
suburb:
type: string
nullable: true
city:
type: string
nullable: true
county:
type: string
nullable: true
state:
type: string
nullable: true
postcode:
type: string
nullable: true
country:
type: string
nullable: true
countryCode:
type: string
nullable: true
required:
- houseNumber
- road
- suburb
- city
- county
- state
- postcode
- country
- countryCode
additionalProperties: false
required:
- formattedAddress
- latitude
- longitude
- boundingBox
- class
- type
- importance
- address
additionalProperties: false
total:
type: integer
nullable: true
description: Total matching rows upstream; null when unknown.
source:
$ref: '#/components/schemas/Source'
meta:
type: object
properties:
query:
type: object
properties:
kind:
type: string
input:
type: string
required:
- kind
- input
additionalProperties: false
cacheHit:
type: boolean
required:
- query
- cacheHit
additionalProperties: false
required:
- ok
- items
- total
- source
additionalProperties: false
meta:
$ref: '#/components/schemas/CallMeta'
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/PaymentRequired'
'405':
$ref: '#/components/responses/MethodNotAllowed'
'500':
$ref: '#/components/responses/ServerError'
'502':
$ref: '#/components/responses/UpstreamError'
x-2s-id: geocode.reverse
x-2s-version: null
x-2s-price:
usd: 0.0025
x-2s-accepts:
- x402
x-2s-response-shape: normalized
x-payment-info:
price:
mode: fixed
currency: USD
amount: '0.002500'
protocols:
- x402: {}
parameters:
- name: lat
in: query
required: true
description: Latitude in decimal degrees (WGS84).
schema:
type: number
minimum: -90
maximum: 90
- name: lon
in: query
required: true
description: Longitude in decimal degrees (WGS84).
schema:
type: number
minimum: -180
maximum: 180
- $ref: '#/components/parameters/TrialMode'
components:
schemas:
Source:
type: object
description: 'Provenance of the data: upstream provider, source URL, and license.'
properties:
provider:
type: string
description: Upstream data provider.
url:
type: string
description: Source URL or documentation link.
license:
type: string
description: License / usage terms for the data.
CallMeta:
type: object
description: Per-call meta envelope — endpoint id, cost, caller kind, settlement details.
X402PaymentRequiredV2:
type: object
description: x402 v2 PaymentRequired envelope. Pick any entry from accepts[], sign for that rail, retry with the PAYMENT-SIGNATURE header.
required:
- x402Version
- accepts
properties:
x402Version:
type: integer
const: 2
error:
type: string
description: Human-readable reason payment is required.
resource:
type: string
description: The resource URL being purchased.
accepts:
type: array
description: Payment requirement options, one per supported network (Base USDC, Solana USDC).
items:
type: object
required:
- scheme
- network
- amount
- asset
- payTo
- maxTimeoutSeconds
properties:
scheme:
type: string
enum:
- exact
network:
type: string
description: CAIP-2 network id, e.g. "eip155:8453" (Base) or "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp".
amount:
type: string
description: Price in atomic asset units (USDC has 6 decimals).
asset:
type: string
description: Asset contract address / mint.
payTo:
type: string
description: Treasury address to pay.
maxTimeoutSeconds:
type: integer
extra:
type: object
description: 'Rail-specific extras (EVM: EIP-712 domain name/version; Solana: feePayer).'
additionalProperties: true
extensions:
type: object
description: Optional discovery metadata (e.g. bazaar input/output schemas).
additionalProperties: true
responses:
PaymentRequired:
description: Payment required. Body contains the x402 PaymentRequirements envelope with a multi-network accepts array; the per-call price is in accepts[].amount (and on the operation as x-2s-price). Sign for whichever rail you hold USDC on (EIP-3009 for Base, partial SPL transfer for Solana) and retry with the PAYMENT-SIGNATURE header (X-PAYMENT also accepted for v1 clients).
content:
application/json:
schema:
$ref: '#/components/schemas/X402PaymentRequiredV2'
UpstreamError:
description: Upstream provider error.
MethodNotAllowed:
description: Method not allowed — see `Allow` header for the supported method.
ServerError:
description: Internal server error.
BadRequest:
description: Bad request — invalid parameters.
parameters:
TrialMode:
name: trial
in: query
required: false
description: 'Try before you buy. Set to 1 for one free real call per endpoint per hour — no wallet or payment needed — to verify the endpoint before paying. Equivalent to sending the "X-2s-Trial: 1" request header. Works on every endpoint.'
schema:
type: integer
enum:
- 1
securitySchemes:
x402Payment:
type: apiKey
in: header
name: PAYMENT-SIGNATURE
description: 'x402 protocol v2: base64-encoded PaymentPayload. Call any paid endpoint without auth to receive a 402 with a multi-network PaymentRequirements envelope. Sign for either rail: EIP-3009 transferWithAuthorization (Base USDC) OR a partial SPL token transfer (Solana USDC). Retry with PAYMENT-SIGNATURE header. X-PAYMENT is also accepted for v1 buyer clients. See https://x402.org.'