Skip to content

API Reference

Complete reference for all OneHazel API endpoints.

Base URL

https://api.onehazel.com/

All endpoints are Supabase Edge Functions served from this base URL. Append the function name and path to this URL.

Authentication

All API endpoints require authentication via the Authorization header:

Authorization: Bearer oh_live_YOUR_API_KEY

See Authentication for details on creating and managing API keys.

Response format

All endpoints return JSON responses with a consistent structure:

Success:

json
{
  "success": true,
  "data": { ... }
}

Error:

json
{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable description"
  }
}

Rate limiting

Rate limits are applied per operator. When exceeded, the API returns HTTP 429 with:

  • Retry-After header indicating seconds to wait
  • resetAt field in the response body with an ISO 8601 timestamp

API groups

Data Ingestion — operator-data-api

Push entities, events, and states into OneHazel.

MethodEndpointDescription
GET/operator-data-api/templatesList available data templates
GET/operator-data-api/settingsGet template and retention config
PUT/operator-data-api/settingsSet template and retention config
POST/operator-data-api/entitiesCreate or update an entity
GET/operator-data-api/entities/:externalIdGet an entity
DELETE/operator-data-api/entities/:externalIdSoft-delete entity (GDPR)
POST/operator-data-api/entities/:externalId/eventsRecord an event
GET/operator-data-api/entities/:externalId/eventsList entity events
PUT/operator-data-api/entities/:externalId/state/:keyUpdate a state snapshot
GET/operator-data-api/entities/:externalId/stateGet all states
GET/operator-data-api/entities/:externalId/state/:keyGet a single state
POST/operator-data-api/batch/entitiesBulk upsert entities (max 1000)
POST/operator-data-api/batch/eventsBulk insert events (max 5000)
POST/operator-data-api/batch/statesBulk upsert states (max 1000)
GET/operator-data-api/batch/jobs/:jobIdCheck batch job status

Gateway — gateway

Proxy requests through to supplier APIs with automatic auth and schema translation.

MethodEndpointDescription
POST/gatewayExecute a gateway operation

Webhooks — webhook-receiver

Receive inbound webhooks from external providers.

MethodEndpointDescription
POST/webhook-receiver/:connectionIdReceive a webhook

Analytics — analytics-api

Query aggregated analytics data.

MethodEndpointDescription
GET/analytics-api/analytics/kpisAggregate KPIs
GET/analytics-api/analytics/revenueRevenue time series
GET/analytics-api/analytics/playersPlayer list
GET/analytics-api/analytics/players/:idPlayer detail
GET/analytics-api/analytics/gamesGame performance
GET/analytics-api/analytics/providersPayment provider stats
POST/analytics-api/analytics/refreshRefresh materialized views

API Keys — api-keys

Manage your API keys.

MethodEndpointDescription
POST/api-keysCreate a new API key
GET/api-keysList API keys (masked)
PATCH/api-keysRename a key
DELETE/api-keys?id=...Revoke or delete a key