BXP REST API
The complete HTTP contract for a BXP v2.0 node. Every BXP node exposes this surface, so any client written against it can query any node.
Using the API
Submit a reading:
curl -X POST http://localhost:5000/bxp/v2/readings \
-H "Content-Type: application/json" \
-d '{"readings":[{"latitude":5.6037,"longitude":-0.1870,
"source":"native",
"agents":[{"agentId":"PM2_5","value":47.2,"unit":"ug/m3"}]}]}'
Find relevant observations near a point:
curl "http://localhost:5000/bxp/v2/nearby?lat=5.60&lon=-0.18&radiusKm=25"
Replicate from a peer node:
curl "http://localhost:5000/bxp/v2/sync?since=0"
Authentication
Reads are unauthenticated. Writes require a device token obtained from
POST /bxp/v2/devices/register, which is rate limited to 5 requests
per minute per IP. Inter-node replication uses a shared secret. Both mechanisms
are deliberately minimal — real node identity and trust are deferred to a future
RFC rather than left implied.
Version negotiation
The major path segment is the protocol major version. MINOR
additions are backward compatible: a server may add response fields, and clients
must ignore-and-preserve fields they do not recognise. Breaking changes require a
new major version with 18 months advance notice.
Readings
Get Location Aggregate
Privacy-safe aggregate (SPEC.md 9): only returned when >= 5 readings contribute.
Get Location History
Get Location Latest
Get Nearby
Relevance-ranked "closest useful observation" lookup (SPEC.md 7 Stage 6, 8.2.1) for a caller with no sensor of their own. Ranking blends distance, freshness and quality; see database.get_nearby_readings.
Get Readings
List stored readings (offset pagination). With no filters, returns live data for the default cities. format=binary returns one binary `.bxp` container (SPEC.md 5.4, fileType="aggregate") wrapping {"readings": [...]}.
Submit Readings
Accept BXP readings as JSON (SPEC.md 2) or a binary `.bxp` container (SPEC.md 5.1/5.2, auto-detected by magic number). The batch is stored atomically; a reading whose ID already exists is reported, never overwritten.
Delete Reading Endpoint
Delete a reading with cryptographic proof (SPEC.md 9). The authenticated device must be the one that submitted it. The reading's content is erased; only a tombstone remains so the deletion replicates to peers.
Get Reading By Id
format=binary returns the reading as a binary `.bxp` container (fileType="reading").
Verify Reading Endpoint
Search
Search by city name (live AQICN data) and/or coordinates (stored readings in that cell).
Compare View
Devices
Register Device Endpoint
Get Device Endpoint
Community
Get Reports
Submit Report
Federation
List Nodes
Announce Node
Register a peer node so it appears in GET /nodes. This is a directory entry only - this server never fetches the announced URL - and a node_id cannot be re-pointed at a different baseUrl (see database.upsert_node).
Sync Pull
Federation pull (SPEC.md 7 Stage 7, 8.2.2). Returns every change after the opaque cursor `since` (default 0 = from the beginning), oldest first, plus `nextCursor` to resume from. Deleted readings arrive as tombstones ({"readingId", "deleted": true, "deletionProof"}) that a replica must apply.
Operations
Root
Get City
Health
Dashboard Home
Dashboard
Map View
Metrics
Prometheus-compatible metrics.
Widget
Embeddable iframe widget.
23 paths · 26 operations · generated from the reference server's OpenAPI document. See also the prose API documentation.