Skip to main content

API Overview

The BreakGround REST API provides programmatic access to manage flows, audiences, analytics, content, and SDK integration. All endpoints return JSON.

Base URL

All API requests are made to:

https://api.breakground.io/api

For local development, the API runs at http://localhost:3001/api. The dashboard dev server proxies /api requests to the API automatically.

Authentication

Requests must be authenticated using either:

  • API keys (X-API-Key header) for SDK and server-to-server routes
  • JWT tokens (HttpOnly session_token cookie or Authorization: Bearer header) for dashboard routes

See Authentication for details.

Response Format

Success

All successful responses wrap data in a data field:

{
"data": {
"tenantId": "550e8400-e29b-41d4-a716-446655440000",
"name": "My Organization"
}
}

Paginated endpoints include a meta field:

{
"data": [...],
"meta": {
"total": 42,
"page": 1,
"limit": 20,
"totalPages": 3
}
}

Errors

All errors return a structured error object:

{
"error": {
"message": "Invalid request body",
"statusCode": 400,
"code": "VALIDATION_ERROR",
"category": "VALIDATION",
"details": [{ "path": "events.0.type", "message": "Invalid enum value" }]
}
}

See Error Codes for the full list.

Rate Limits

ScopeLimitScoped by
Global (all routes)100 requests/minIP address
Auth routes (/api/auth/*)10 requests/minIP address
Token refresh (/api/auth/refresh)20 requests/minIP address
SDK routes (/api/sdk/*)600 requests/minAPI key
Admin read (/api/admin/* GET)60 requests/minPlatform JWT
Admin write (/api/admin/* POST/PATCH)20 requests/minPlatform JWT
Admin critical (kill switch, GDPR delete)5 requests/minPlatform JWT

Rate-limited responses return HTTP 429 with a Retry-After header.

Request Headers

HeaderRequiredDescription
Content-TypeYes (POST/PUT/PATCH)Must be application/json
X-API-KeyYes (SDK routes)API key for SDK authentication
AuthorizationYes (dashboard routes)Bearer <jwt_token>

Route Prefixes

PrefixPurposeAuth method
/api/sdk/*SDK integration endpointsAPI key
/api/auth/*Authentication (login, register, refresh)None / JWT
/api/flows/*, /api/audiences/*, etc.Dashboard CRUDJWT
/api/admin/*Platform administrationPlatform JWT