Skip to content

API Reference

The RocketFlag API is designed to be simple and highly performant. The primary endpoint is used to evaluate the state of a feature flag.

https://api.rocketflag.app

This reference covers the public Evaluation API used by your applications to read flag state. It requires no account credentials. Flags are addressed by their Flag ID. It is safe to call from frontend, backend, and client-side code.

The Management API (reading and changing flag state from scripts and CI) is a separate, authenticated API that is available with API tokens. It is documented in the Management API reference. The wider set of console endpoints (projects, organisations and so on) remains private and is not part of any public reference.


A lightweight endpoint to verify the API is reachable.

GET /health

Returns a 200 OK when the service is healthy.


Returns the state of a specific feature flag. This endpoint supports both single-environment Flags and Multi-Environment (Group) Flags.

GET /v1/flags/{flag_id}

ParameterTypeRequiredDescription
cohortstringNoA unique identifier (e.g., email, user ID) to check against the flag’s cohort list. Letters, digits and . _ - + @ : only; URL-encode it (+ as %2B).
envstringYes*The environment label (e.g., production). Required for Group Flags.
targetingKeystringNoA stable identifier for the end user (a user ID, device ID or email). Makes percentage rollouts sticky: the same key always gets the same answer.
any other keystringNoAn attribute such as plan=pro or country=AU, matched against the flag’s audience. Only read when the flag has an audience.

URL-encode targetingKey and attribute values the same way as cohort. If a key is repeated, its first value is used.

cohort, env and targetingKey are reserved keys: they always keep their meaning above and cannot be used as audience attribute keys. Attribute matching is exact and case-sensitive, and an attribute you do not send never matches.

Terminal window
curl "https://api.rocketflag.app/v1/flags/ABC123def456?cohort=user@example.com&env=production"

With a sticky key and an audience attribute:

Terminal window
curl "https://api.rocketflag.app/v1/flags/ABC123def456?targetingKey=user-42&plan=pro"
{
"id": "ABC123def456",
"name": "New Dashboard Feature",
"enabled": true
}
  • 400 Bad Request: Returned if the cohort query string could not be decoded, usually because it contains special characters (such as +) that weren’t URL-encoded. The response body explains how to fix it. Always URL-encode cohort values.
  • 403 Forbidden: Returned when access to the flag is not permitted.
  • 404 Not Found: Returned if the flag_id does not exist, or if env is missing for a Group Flag. An unknown environment returns enabled: false.
  • 500 Internal Server Error: Returned if an unexpected error occurs on the server.

The key used to bucket a percentage rollout is the first of these that is present: the targetingKey parameter, then the cohort parameter. With neither, each request is a fresh random roll. The bucket is computed as:

bucket = FNV1a64(flagId + ":" + key) % 100
enabled = bucket < trafficPercentage

FNV-1a 64-bit (offset basis 14695981039346656037, prime 1099511628211) over the flag ID, a single : byte, then the key. Group flags hash the group flag ID, and the environment is not part of the hash. A percentage of 100 or more is always enabled and 0 or less is always disabled. Test vectors:

Flag IDKeyBucket
flag_123user-4210
flag_123user-4321
abcalice@example.com92

See Sticky rollouts for the properties this gives you.

  1. A disabled flag (or an unknown or disabled environment) returns false.
  2. If cohort is in the flag’s cohort list, return true. This skips the audience and the percentage.
  3. If the flag has an audience and the request does not match it, return false.
  4. If there is no audience but cohorts are configured, return false.
  5. Apply the percentage: 100 or more is true, otherwise bucket the key, or roll randomly if there is no key.

See Audiences for detail. Audiences are served by the evaluation service release that carries them; an older release ignores the audience and serves the flag as if none were set.


Returns a list of all flags associated with a specific project.

GET /v1/flags/project/{project_id}

Takes the same cohort, targetingKey and attribute parameters as Evaluate a Flag, and applies them to every flag in the project. It does not take env.

[
{
"id": "flag_1",
"name": "Feature One",
"enabled": true
},
{
"id": "flag_2",
"name": "Feature Two",
"enabled": false
}
]

A project with no flags returns an empty list, [].

  • 400 Bad Request: Returned if the cohort query string could not be decoded, the same as for a single flag. Earlier versions answered with an empty list instead, which looked like a project with no flags. Always URL-encode cohort values.
  • A project_id that does not exist is not an error: the route returns 200 OK with an empty list, the same as a project with no flags.
  • 500 Internal Server Error: Returned if an unexpected error occurs on the server.