HTTP REST API Reference (texspace serve)
When self-hosting the local engine via texspace serve --db <DIR> --port 4000, texspace exposes Pelias-compatible GeoJSON endpoints by default, plus ?format=compact (~70% smaller JSON for APIs and AI agents), live OpenAPI 3.1 (/openapi.json), and agent discovery (/llms.txt).
A public demo server is also available at https://api.texspace.dev.
Endpoint Summary#
| Method & Path | Description | Key Parameters |
|---|---|---|
GET /v1/search | Freeform geocoding (addresses, APNs, intersections, POIs, coords) | text, size, profile, focus.point.lat, focus.point.lon, focus.ip, boundary.rect.*, format=compact |
GET | POST /v1/search/structured | Field-level geocoding with field_conflicts | housenumber, street, unit, locality, region, postalcode, apn, address, profile, format |
GET | POST /v1/verify | Address verification, deliverability, formatted lines & corrections | text (or JSON { "query": "..." }), focus.point.lat/lon, focus.ip |
GET /v1/autocomplete | Sub-5ms checkout typeahead with highlights & components | text, size, focus.point.lat, focus.point.lon, focus.ip, format=compact |
GET /v1/reverse | 4-tier reverse geocoding (Parcel -> Rooftop -> POI/Street -> Admin) | point.lat, point.lon, size, boundary.circle.radius, format=compact |
GET | POST /v1/nearby | Relational proximity & directional search (within 2km of, 200m north of) | q, what, anchor, point.lat, point.lon, radius_m, direction, size, format=compact |
POST /v1/batch | Rayon-parallel bulk geocoding (up to 10,000 queries/request) | JSON { "queries": [...], "limit": 1, "profile": "balanced", "focus_ip": "auto" | "off" | "<ip>" } |
GET /v1/geoip | Sub-0.05ms offline IPv4/IPv6 + ASN + timezone lookup | ip (omit to geolocate request IP via CF-Connecting-IP / X-Forwarded-For / socket) |
POST /v1/geoip/batch | Parallel bulk offline GeoIP | JSON { "ips": ["8.8.8.8", "1.1.1.1"] } |
GET /v1/timezone | Offline IANA timezone + DST + local time | lat & lon (or point.lat/point.lon or location=lat,lon), optional timestamp |
POST /v1/timezone/batch | Parallel bulk offline timezone lookup | JSON { "points": [{ "lat": 37.77, "lon": -122.42 }] } |
GET /v1/meta | Active shards, entity/parcel counts, bounding boxes, reload telemetry | — |
GET /health | Liveness & loaded shard health check | — |
GET /openapi.json | Machine-readable OpenAPI 3.1 specification | — |
GET /llms.txt | Concise agent discovery prompt | — |
Example Requests#
Search & Compact Mode#
# Pelias-compatible GeoJSON FeatureCollection
curl "https://api.texspace.dev/v1/search?text=2750+Middlefield+Rd+Palo+Alto+CA&size=3"
# Compact JSON (~70% smaller — ideal for backends & LLM tools)
curl "https://api.texspace.dev/v1/search?text=2750+Middlefield+Rd+Palo+Alto+CA&size=3&format=compact"Address Verification (POST /v1/verify)#
curl -X POST https://api.texspace.dev/v1/verify \
-H "Content-Type: application/json" \
-d '{"query":"4865 Mission St Apt 4B 94112 Oakland"}'Parallel Batch Geocoding (POST /v1/batch)#
curl -X POST https://api.texspace.dev/v1/batch \
-H "Content-Type: application/json" \
-d '{
"queries": [
"2750 Middlefield Rd, Palo Alto, CA 94306",
"10 Downing Street, London, SW1A 2AA",
"4865 Mission St, San Francisco, CA 94112"
],
"limit": 1,
"profile": "delivery"
}'Offline GeoIP & IANA Timezone#
curl "https://api.texspace.dev/v1/geoip?ip=8.8.8.8"
curl "https://api.texspace.dev/v1/timezone?lat=37.7749&lon=-122.4194"Ranking Profiles (profile=)#
Pass profile=<name> to /v1/search, /v1/search/structured, or /v1/batch to tune scoring for your product vertical:
| Profile | Behavior |
|---|---|
balanced (default) | Calibrated GBDT ranker balancing precision, coverage, and prominence. |
delivery | Strongly prioritizes deliverable rooftop, parcel, and building pins; penalizes broad city/ZIP fallbacks. |
real_estate | Boosts cadastral parcel polygons and APN/TMK matches. |
consumer | Boosts popular landmarks, campuses, venues, and localities. |
emergency | Prioritizes exact street intersections, addresses, and directional concordance. |
Origin-IP Proximity Focus (focus.ip)#
When geoip.db is loaded in the data directory, /v1/search, /v1/autocomplete, and /v1/nearby automatically bias ambiguous results toward the caller's city:
- Override per request with explicit
focus.point.lat&focus.point.lon,focus.ip=<ip>, orfocus.ip=off. - Disable server-wide via
--no-ip-focus,--ip-focus false, orTEXSPACE_IP_FOCUS=false.
Zero-Downtime Hot Reload#
When running texspace update --db <DIR> or texspace sync-osm --db <DIR> --watch, texspace serve automatically watches shard files (and handles SIGHUP) to atomically swap updated datasets and osm_delta.db with zero dropped connections.
Related References#
- CLI Reference — Flags for
texspace serve,pull,update, andsync-osm. - Hosting, Caching & Self-Hosting — Systemd, Docker, reverse proxy, and production deployment.
- AI Agents & MCP Guide — Using
texspace mcpalongside/llms.txtand?format=compact.