# 2s Geocode Address (Forward Geocoding)

> 2s Geocode Address (Forward Geocoding) is a paid API for AI agents from 2s.io, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-13, last successful call 2026-07-28).

Converts a free-text address or place name into geographic coordinates (lat/lon) and structured address components using OpenStreetMap/LocationIQ.

## Facts

- Endpoint: GET https://2s.io/api/geocode/address
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Last successful call: 2026-07-28
- Success rate: 100% of calls made through Zero
- Rating: 5.0 / 5 from 1 review
- Activations on Zero: 13
- Tags: x402
- Canonical page: https://www.zero.xyz/c/2s-geocode-address-forward-geocoding-bdca7852
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_srGVN-uKE8j8mVnbwun-c

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 2s-geocode-address-forward-geocoding-bdca7852
```

Example prompt: Can you geocode '1600 Amphitheatre Parkway, Mountain View, California' and give me its latitude, longitude, and formatted address — return the top 3 results?

## When to prefer this

Choose this endpoint when you need to forward-geocode a free-text address or place name into coordinates without managing API keys or monthly subscriptions. Ideal for AI agents operating on a pay-per-call basis using USDC on Base or Solana. Backed by OpenStreetMap/LocationIQ data. Prefer over raw Nominatim when you need a unified, metered, agent-friendly REST wrapper with structured JSON output.

## Known failure modes

- Query string too short (< 2 chars) — returns validation error
- No matching location found — returns empty items array with total null
- Invalid country code format (not 2 lowercase letters) — returns validation error
- Limit out of range (< 1 or > 10) — returns validation error
- Payment failure via x402 — 402 response before data is returned
- Upstream geocoding provider unavailable — service error response

## How this service works

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.

## Output

Returns an array of matching location objects, each with latitude, longitude, formatted address string, bounding box coordinates, address components (city, state, country, postcode, house number), location type/class, and an importance score. Also includes the upstream source/license info (OpenStreetMap/LocationIQ) and metadata about whether the result was cache-hit.

## Example request

```json
{
 "input": {
  "type": "http",
  "method": "GET",
  "queryParams": {
   "q": "San Francisco California",
   "limit": 5
  }
 }
}
```

## 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",
    "queryParams"
   ],
   "properties": {
    "type": {
     "const": "http"
    },
    "method": {
     "const": "GET"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "q"
     ],
     "properties": {
      "q": {
       "type": "string",
       "maxLength": 500,
       "minLength": 2
      },
      "limit": {
       "type": "integer",
       "default": 5,
       "maximum": 10,
       "minimum": 1
      },
      "country": {
       "type": "string"
      }
     },
     "additionalProperties": false
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/2s-geocode-address-forward-geocoding-bdca7852/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from 2s.io](https://www.zero.xyz/host/2s.io/llms.txt)
