Skip to main content

Base URL

All endpoints are versioned under /v1. Every request and response body is JSON. This is a hand-written API reference — there is no generated OpenAPI spec.

Endpoint groups

Variable evaluation

Used by applications and the SDK to read variable values at request time.

Variable management

Used by the CLI and dashboard to create, update, list, and delete variables.

CLI auth

Used by the CLI to establish and manage authenticated sessions via the device code flow.

Tooling


Request conventions

Content-Type: All POST requests must include Content-Type: application/json. Authorization: All endpoints except /v1/cli/device/start require an Authorization: Bearer <token> header. See Authentication for the two token types. Request body: All POST endpoints accept a JSON body. Required fields are documented per endpoint. CORS: All endpoints respond to OPTIONS preflight requests with appropriate CORS headers.

Headers

x-request-id

An optional client-supplied request ID for tracing. If provided, it is echoed back in every response under the requestId field. If not provided, Barekey generates one.

x-barekey-request-key

An idempotency key for evaluation and pull requests. Barekey uses this to deduplicate billing events — if the same key is sent twice within a short window, the second request is not billed again. Use a stable, unique key per logical evaluation event (e.g. a request ID from your application):
The request key must be unique per billing event. Reusing the same key for genuinely different requests will result in under-billing and may cause unexpected behavior.

Response shape

All successful responses return JSON with at minimum a requestId field. All error responses follow this shape:
See Error codes for the full list of codes and their HTTP statuses.