flaggator

HTTP API

JSON in, JSON out, UTF-8. Every resource except health lives under /v1. Paths use public keys, not database ids. A write returns the new representation, including the new version when the resource has one.

Every route except GET /health requires Authorization: Bearer <token>. A missing or unknown token is 401. A valid token on a route it cannot call is 403.

Credentials

TokenMay call
Management token Projects, environments, flags, targeting, SDK keys, and the audit log. It can also evaluate, and then must name the project and environment.
SDK key Evaluation for one environment. The environment is implied by the key. A mismatched project or environment on the request is 403.

Health

Projects

Management token. Creating a key that already exists is 409.

Environments

SDK keys

Flags

Targeting

One environment’s configuration is replaced as a whole document. The body carries the version the client read. A stale version is 409; the client reads again and retries.

Audit

Evaluation

SDK key or management token. An unknown flag still returns 200: value is the caller’s default, reason is flag_not_found.

POST /v1/evaluate
{
  "project_key": "shop",
  "environment_key": "prod",
  "flag_key": "checkout-v2",
  "context": { "key": "user-123", "attributes": { "country": "IT" } },
  "default": false
}

Errors

The body is {"error": {"code", "message", "details"}}. details lists {"field", "message"} for validation, and is empty otherwise.

HTTPcodeWhen
400validation_errorMalformed input, or a domain rule rejected the command.
401unauthenticatedMissing or unknown credential.
403forbiddenThe credential is valid and not allowed to do this.
404not_foundUnknown project, environment, or flag on a management route.
409conflictDuplicate key, or a stale config version.
500storage_errorDatabase failure. The message is generic.

Lists

List routes take limit and cursor. limit defaults to 50 and must be a whole number from 1 to 200. cursor is opaque; the client sends back the next_cursor it received. A null cursor means the page is the last one.