Skip to main content
Feature flags in Swisstools are organized at two levels. Global flags apply project-wide with an on/off toggle and an optional rollout percentage. Flag groups let you define a reusable set of flags (group flags) and then apply them to individual records — users, organizations, or any entity you identify — with per-record overrides. The SDK endpoint resolves all flag values for a record using an API key, so your application can fetch flag state at runtime without a session cookie. Every endpoint below is project-scoped and accepts either a dashboard session cookie or a project API key (Authorization: Bearer fk_… or the x-api-key header) — API keys are project-admin equivalent. The SDK endpoint (GET /api/flags/:recordId) is the one route that requires an API key. See Authentication for details. Project, flag, group, record, and environment IDs in these paths are public reference IDs (KSUIDs, ~27 chars) shown in the dashboard — the internal database UUID is not accepted in URLs. Flags and records resolve against an environment. Pass an optional ?env= query parameter (the environment’s key such as production, or its display name, case-insensitive) on read and check endpoints; when omitted, the project’s default environment is used.

Global Flags

List Flags

GET /api/projects/:projectId/flags Returns all global feature flags for the project, scoped to an environment. Path Parameters
string
required
The project’s public reference ID (KSUID), shown in Project settings → General.
string
Optional environment selector (the environment’s key or name). Defaults to the project’s default environment; an unknown value returns [].
Request
Response

Create Flag

POST /api/projects/:projectId/flags Creates a new global feature flag. Path Parameters
string
required
The project’s public reference ID (KSUID), shown in Project settings → General.
Request Body
string
required
Display name for the flag.
string
Optional user-supplied public reference ID (^[A-Za-z0-9_-]{1,128}$). Stored as-is and must be unique across the project’s flags. When omitted, a KSUID is generated.
string
A unique, URL-friendly identifier for the flag within this project (e.g., dark-mode). Defaults to a slug of name when omitted. Must be unique per project and environment.
boolean
Whether the flag is active. Defaults to false.
integer
Rollout percentage from 0 to 100. Defaults to 100.
string
Environment the flag is created in (accepts an environment key or name). Defaults to the project’s default environment.
Request
Response201 Created

Get Flag

GET /api/projects/:projectId/flags/:flagId Returns a single global flag by its ID. Path Parameters
string
required
The project’s public reference ID (KSUID), shown in Project settings → General.
string
required
The flag’s public reference ID — a KSUID, or the value you supplied as id when creating the flag.
Request
Response

Update Flag

PUT /api/projects/:projectId/flags/:flagId Updates a global flag’s name, enabled state, or rollout percentage. Path Parameters
string
required
The project’s public reference ID (KSUID), shown in Project settings → General.
string
required
The flag’s public reference ID — a KSUID, or the value you supplied as id when creating the flag.
Request Body
string
Updated display name.
boolean
Updated enabled state.
integer
Updated rollout percentage.
Request
Response

Delete Flag

DELETE /api/projects/:projectId/flags/:flagId Permanently deletes a global flag. Request
Response

Check Flag

GET /api/projects/:projectId/flags/check/:flagKey Checks whether a global flag is currently enabled by its key. Useful for server-side flag resolution without going through the SDK. Path Parameters
string
required
The project’s public reference ID (KSUID), shown in Project settings → General.
string
required
The key value of the flag (e.g., dark-mode).
string
Optional environment selector (the environment’s key or name, case-insensitive). Defaults to the project’s default environment; an unknown value returns 404. Results are cached for 60 seconds in Redis per (project, flagKey, env).
Request
Response
enabled already reflects the rollout roll. source is "cache" when served from the Redis cache or "global" when freshly computed.

Flag Groups

Groups are reusable collections of flags that you attach to records (users, orgs, etc.). Each group has its own set of group flags with default values; records in the group can override any flag’s value.

List Groups

GET /api/projects/:projectId/groups Request
Response

Create Group

POST /api/projects/:projectId/groups Request Body
string
required
Display name for the group.
string
Unique identifier for the group within this project. Defaults to a slug of name when omitted.
string
A 2–5 character lowercase alphanumeric prefix used to namespace auto-generated record IDs in this group (e.g., beta). Must be unique per project. Auto-derived from name when omitted.
string
Optional description for the group.
string
Optional hex color used as the group’s label in the dashboard (e.g., #8C7AB0).
Request
Response201 Created

Get Group

GET /api/projects/:projectId/groups/:groupId Request
Response

Update Group

PUT /api/projects/:projectId/groups/:groupId Request Body
string
Updated display name.
string
Updated key.
string
Updated prefix.
Request
Response

Delete Group

DELETE /api/projects/:projectId/groups/:groupId Request
Response

Group Flags

Group flags are the individual flags within a group. Each has a defaultEnabled and defaultPercentage that applies to all records unless overridden.

List Group Flags

GET /api/projects/:projectId/groups/:groupId/flags Request
Response

Create Group Flag

POST /api/projects/:projectId/groups/:groupId/flags Request Body
string
required
Display name for the flag.
string
required
Unique identifier within the group.
boolean
Default enabled state for records that have no override. Defaults to false.
integer
Default rollout percentage. Defaults to 100.
Request
Response201 Created

Group Records

Records represent the entities (users, organizations, devices, etc.) that belong to a group. Each record’s id is either a stable identifier you supply from your own system, or — when you omit it — an auto-generated {groupPrefix}-{ksuid} value (e.g., beta-2a9bX1c0d3e4f5g6h7i8j9k0).

List Records

GET /api/projects/:projectId/groups/:groupId/records Request
Response

Create Record

POST /api/projects/:projectId/groups/:groupId/records Adds a record (entity) to the group. Request Body
string
Optional stable identifier from your own system (^[A-Za-z0-9_-]{1,128}$), stored verbatim and unique across all records. When omitted, the server generates {groupPrefix}-{ksuid}. Supplying your own entity ID lets SDK callers resolve flags via GET /api/flags/{yourId} directly.
string
Optional human-readable label for this record, shown in the dashboard.
object
Optional JSON object with arbitrary key-value pairs (e.g., plan, region, cohort).
Request — user-supplied ID
To let the server generate the ID instead, omit id (e.g. -d '{"name": "Alice"}'); the response id will be {groupPrefix}-{ksuid}. Response201 Created

Environments

Flags and overrides are scoped to environments (e.g. production, staging). Reference an environment by its key or name via the ?env= query parameter on read/check endpoints; omitting it uses the project’s default environment.

List Environments

GET /api/projects/:projectId/environments
Response

Create Environment

POST /api/projects/:projectId/environments Request Body
string
required
Display name for the environment (e.g., Staging).
string
URL-friendly identifier (e.g., staging). Defaults to a slug of name.
boolean
Whether this becomes the project’s default environment. Defaults to false.

Per-Record Overrides

Set or clear an individual record’s value for a group flag in a given environment: PUT /api/projects/:projectId/groups/:groupId/records/:recordId/values/:groupFlagId
To read the raw overrides currently set for a record (override-vs-default state, before the rollout roll), use GET /api/projects/:projectId/records/:recordId/values.

SDK Endpoint

GET /api/flags/:recordId Resolves all feature flag values for a given record. This endpoint uses API key bearer auth rather than a session cookie, so you can call it from your backend or edge functions at runtime. The response maps each group flag key to its resolved value for the specified record and environment, taking per-record overrides into account. enabled is the final decision — the server applies the rollout dice-roll, so a flag that is on but outside the rollout returns enabled: false. Path Parameters
string
required
The ID of the record whose flags you want to resolve — the auto-generated {groupPrefix}-{ksuid} form or the value you supplied as id. Must belong to the same project as the API key.
string
Optional environment selector (the environment’s key or name). Defaults to the project’s default environment. If it doesn’t match any environment, environment is null and flags is {}.
Request
Response
Each flag’s source is "record" when the value comes from a per-record override, or "group-default" when it falls back to the group flag’s defaultEnabled / defaultPercentage.