Technical Reference · HTTP API

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 & PathDescriptionKey Parameters
GET /v1/searchFreeform 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/structuredField-level geocoding with field_conflictshousenumber, street, unit, locality, region, postalcode, apn, address, profile, format
GET | POST /v1/verifyAddress verification, deliverability, formatted lines & correctionstext (or JSON { "query": "..." }), focus.point.lat/lon, focus.ip
GET /v1/autocompleteSub-5ms checkout typeahead with highlights & componentstext, size, focus.point.lat, focus.point.lon, focus.ip, format=compact
GET /v1/reverse4-tier reverse geocoding (Parcel -> Rooftop -> POI/Street -> Admin)point.lat, point.lon, size, boundary.circle.radius, format=compact
GET | POST /v1/nearbyRelational proximity & directional search (within 2km of, 200m north of)q, what, anchor, point.lat, point.lon, radius_m, direction, size, format=compact
POST /v1/batchRayon-parallel bulk geocoding (up to 10,000 queries/request)JSON { "queries": [...], "limit": 1, "profile": "balanced", "focus_ip": "auto" | "off" | "<ip>" }
GET /v1/geoipSub-0.05ms offline IPv4/IPv6 + ASN + timezone lookupip (omit to geolocate request IP via CF-Connecting-IP / X-Forwarded-For / socket)
POST /v1/geoip/batchParallel bulk offline GeoIPJSON { "ips": ["8.8.8.8", "1.1.1.1"] }
GET /v1/timezoneOffline IANA timezone + DST + local timelat & lon (or point.lat/point.lon or location=lat,lon), optional timestamp
POST /v1/timezone/batchParallel bulk offline timezone lookupJSON { "points": [{ "lat": 37.77, "lon": -122.42 }] }
GET /v1/metaActive shards, entity/parcel counts, bounding boxes, reload telemetry—
GET /healthLiveness & loaded shard health check—
GET /openapi.jsonMachine-readable OpenAPI 3.1 specification—
GET /llms.txtConcise agent discovery prompt—

Example Requests#

Search & Compact Mode#

bash
# 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)#

bash
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)#

bash
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#

bash
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:

ProfileBehavior
balanced (default)Calibrated GBDT ranker balancing precision, coverage, and prominence.
deliveryStrongly prioritizes deliverable rooftop, parcel, and building pins; penalizes broad city/ZIP fallbacks.
real_estateBoosts cadastral parcel polygons and APN/TMK matches.
consumerBoosts popular landmarks, campuses, venues, and localities.
emergencyPrioritizes 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>, or focus.ip=off.
  • Disable server-wide via --no-ip-focus, --ip-focus false, or TEXSPACE_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.