Skip to content

API Reference

The Hub API is a Fastify HTTP server. All endpoints are under /api/.

Authentication

MethodDescription
JWT CookieSet by POST /api/auth/login, sent automatically by browsers
Bearer TokenAuthorization: Bearer <token> for mobile apps and API clients

Both resolve to a user identity with tenant role. Platform admins have cross-tenant access.


Auth

MethodPathAuthDescription
POST/auth/registerPublic*Register user (with optional invite token)
POST/auth/loginPublicLogin, returns JWT cookie (+ token if ?returnToken=true)
POST/auth/logoutAuthenticatedClear session
GET/auth/meAuthenticatedCurrent user, tenants, preferences
PUT/auth/me/preferencesAuthenticatedUpdate language preferences
POST/auth/invitesAdmin+Generate invite link (tenant + role)
GET/auth/invitesAdmin+List pending invites
DELETE/auth/invites/:idAdmin+Revoke invite
GET/auth/membersAdmin+List tenant members (excludes platform admins)
POST/auth/create-tenantLogged in*Create new tenant

*Gated by platform settings (allow_self_registration, allow_tenant_creation)

Detections

MethodPathAuthDescription
GET/detectionsViewer+List detections (filterable)
GET/detections/:idViewer+Detection detail with storage key
GET/detections/votesViewer+Get user's votes for detection IDs
POST/detections/:id/verifyMember+Submit verification vote

Query params for GET /detections:

  • tenantId — filter by tenant
  • satelliteId — filter by satellite
  • species — filter by species code
  • minConfidence — minimum confidence threshold
  • verificationStatuspending_review, confirmed, rejected, unverified
  • limit, offset — pagination

Satellites

MethodPathAuthDescription
GET/satellitesViewer+List satellites with latest telemetry
GET/satellites/:idViewer+Satellite detail
POST/satellitesAdmin+Register satellite (returns MQTT credentials)
PATCH/satellites/:idMember+Update satellite (rename)
POST/satellites/:id/profileAdmin+Push recording profile via MQTT
GET/satellites/:id/scheduleViewer+Resolved recording schedule with sun times
DELETE/satellites/:idAdmin+Delete satellite (revokes MQTT)

Audio

MethodPathAuthDescription
GET/audio/:chunkIdViewer+Stream audio WAV from MinIO

Alerts

MethodPathAuthDescription
GET/alertsViewer+List alerts (?acknowledged=true/false)
POST/alerts/:id/acknowledgeViewer+Dismiss alert

Export

MethodPathAuthDescription
GET/export/detectionsMember+Export CSV or JSON (?format=csv/json)
GET/export/ebirdMember+eBird checklist format
GET/export/inaturalistMember+iNaturalist observation format
GET/export/xenocantoMember+xeno-canto submission format

Stats

MethodPathAuthDescription
GET/stats/dashboardViewer+Species count, detection count, chunk count
GET/stats/trendsViewer+Daily detection trends (?days=30)
GET/stats/top-speciesViewer+Top species ranking
GET/stats/activityViewer+Hourly detection activity
GET/stats/verificationViewer+Verification progress counts
GET/stats/leaderboardViewer+Verification contributor ranking

Species

MethodPathAuthDescription
GET/species/languagesPublicAvailable translation languages
GET/species/translateViewer+Translate single species
POST/species/translateViewer+Bulk translate species names
POST/species/imagesViewer+Get image statuses (queues missing)
GET/species/image/proxyViewer+Serve species image from MinIO
GET/species/image-cache/statsPlatform AdminImage cache statistics
POST/species/image-cache/clearPlatform AdminClear entire image cache
POST/species/image-cache/retryPlatform AdminRe-queue failed downloads

Webhooks

MethodPathAuthDescription
GET/webhooksAdmin+List webhooks for tenant
POST/webhooksAdmin+Create webhook
DELETE/webhooks/:idAdmin+Delete webhook
POST/webhooks/:id/testAdmin+Send test payload

Webhook payload: Detection details with HMAC signature in X-Webhook-Signature header. Event types: detection.new, detection.rare, satellite.offline

Workers

MethodPathAuthDescription
GET/workersAdmin+Queue stats + connected workers
GET/workers/jobsAdmin+Recent completed jobs

Settings

MethodPathAuthDescription
GET/settings/tenantViewer+Tenant settings
PUT/settings/tenantAdmin+Update tenant settings
GET/settings/platformPlatform AdminPlatform settings
PUT/settings/platformPlatform AdminUpdate platform settings

Tenants

MethodPathAuthDescription
GET/tenantsAuthenticatedList tenants

Admin (Platform Admin only)

MethodPathDescription
GET/admin/usersList all users (with search)
GET/admin/users/:idUser detail
PUT/admin/users/:idUpdate user (name, email, admin flag)
POST/admin/users/:id/blockBlock/unblock user
POST/admin/users/:id/reset-passwordReset password
DELETE/admin/users/:idDelete user
POST/admin/users/:id/tenantsAdd user to tenant (409 if already member)
DELETE/admin/users/:id/tenants/:tidRemove from tenant
PUT/admin/members/:id/roleChange member role
DELETE/admin/members/:idRemove member from tenant

WebSocket

Connect to /ws/events?tenantId=<id> for real-time events.

Event types:

  • detection — new bird detected (species, confidence, satellite, rare flag)
  • alert — system alert (rare species, satellite offline, etc.)

Toast format: Rare species notifications show translated names (primary + secondary languages).

Health

MethodPathAuthDescription
GET/healthPublicReturns { status: "ok" }

Distributed bird sound identification