Skip to content

HTTP API ​

Machine-readable contract:

Authentication ​

AudienceMechanism
Device firmwareDevice key in /api/ingest/{deviceKey} (or X-Ingest-Key for MQTT bridge)
Pro integrationsBearer API key from Dashboard → Share
Browser dashboardSupabase session cookies (not for third-party clients)
Share linksOpaque token in the URL path

Endpoint map ​

MethodPathAuthPurpose
POST/api/ingest/{deviceKey}Path keyPush sensor readings
POST/api/ingest/mqttX-Ingest-KeyMQTT→HTTP bridge
POST/api/user/pull-setupSession cookieSave pull feeds + probe labels (JSON body)
GET/api/user/door-eventsSession cookieDoor openings: the latest limit (default 12, max 50), or with from / to (YYYY-MM-DD in your browser's time zone, or ISO timestamps) the openings that started in that range, newest first (limit default 100, max 500; adds range and truncated). Also live_sessions for the last 24 h
GET/api/door-events/export.csvSession cookie (CSV plan)Door openings with temperature and humidity at open and close (from, to, days, door); UTC times
POST/api/devices/reveal-ingest-keySession cookieRecover encrypted push ingest key (rate-limited; audited)
GET/api/v1/metricsBearer API key (read)Prometheus text exposition
GET/api/v1/devicesBearer API key (read)List household devices
POST/api/v1/devicesBearer API key (write)Create push device (returns its ingest key)
POST/api/v1/devices/sensors-batchBearer API key (write)Rename / hide sensors
POST/api/v1/pull-setupBearer API key (write)Replace the household's pull feeds + probe labels
POST/api/inbound/{token}Token + HMAC signature (timestamped V2 recommended)Snooze / vacation / status actions
GET/api/share/{token}/readingsShare tokenPublic JSON readings (Free family live; Pro expands scopes)
POST/api/pucks/registerCompanion sessionRegister claim-puck secret
POST/api/pucks/claim/startCompanion sessionIssue claim nonce
POST/api/pucks/claim/finishCompanion sessionVerify HMAC and bind bay
GET/api/bays/{bay_id}/moodCompanion sessionDerived bay mood (Bay Buddy / claim puck)
PUT/api/bays/{bay_id}/moodCompanion sessionOverride mood (demo / test)

Bearer API keys need the household owner's plan to include the API (Pro) at the time of each call. After a downgrade, /api/v1/* returns 403 {"error": "API access needs a Pro plan"}; creating a device past the plan's limit returns 403 with "code": "device_limit". Device ingest keys keep working.

API key scopes ​

Each API key is read-only (read, the default when you create one) or read and write (write). You pick it when creating the key, and the key list on Dashboard → Share → API shows each key's scope. Only the household owner and editors (full members) can create keys, of either scope.

  • read: GET /api/v1/metrics, GET /api/v1/devices. Use this for Prometheus, Grafana, Home Assistant scrapes.
  • write: everything read can do, plus POST /api/v1/devices, POST /api/v1/devices/sensors-batch, POST /api/v1/pull-setup.

A read-only key on a write endpoint gets 403:

json
{"error": "This API key is read-only. Create a key with write access (Dashboard → Share → API) to use this endpoint.", "code": "insufficient_scope", "required_scope": "write"}

(plus "ok": false on sensors-batch and pull-setup, whose other errors carry it too) and the header WWW-Authenticate: Bearer error="insufficient_scope", scope="write". Keys created before scopes existed are write, so they keep working as before. A key's scope can't be changed; create a new key and revoke the old one.

Claim puck ​

Physical RP2040-Zero presence key. Product page: probeharbor.dev/claim-puck. Firmware: probeharbor-claim-puck.

Auth matches Bay Buddy: Authorization: Bearer <access> + X-SB-Refresh-Token: <refresh>.

Flow: register → claim/start → device CHALLENGE + button → claim/finish → poll GET /api/bays/{bay}/mood.

Create an API key (Pro) ​

  1. Sign in → Dashboard → Share
  2. Create an API key (read-only unless you need the write endpoints); copy it once
  3. Call:
bash
curl -sS "https://probeharbor.dev/api/v1/metrics" \
  -H "Authorization: Bearer YOUR_API_KEY" | head

Example: list devices ​

bash
curl -sS "https://probeharbor.dev/api/v1/devices" \
  -H "Authorization: Bearer YOUR_API_KEY"

Spec versioning ​

openapi.yaml in the repo (public/openapi.yaml) is the source of truth. The docs build copies it into this site on every Pages deploy.

Legacy per-feed routes (/api/user/temp-feeds, /api/user/temp-probes) are retired — use POST /api/user/pull-setup instead.

App & product guides: probeharbor.dev · This site: developer reference