Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.swisstools.dev/llms.txt

Use this file to discover all available pages before exploring further.

Global flags are the simplest way to ship a feature behind a toggle. Each flag belongs to a project, has a human-readable name and a machine-readable key, and carries two runtime values: whether the flag is enabled and what percentage of checks should return active. You check them from your application via a REST endpoint or in the dashboard to verify state at a glance.

Flag fields

FieldDescription
NameHuman-readable label shown in the dashboard (e.g. New Dashboard).
KeyMachine-readable identifier used in API calls (e.g. new-dashboard). Must be unique within the project.
EnabledWhether the flag is on (true) or off (false). When disabled, the flag is inactive regardless of percentage.
PercentageA number from 0 to 100 representing what fraction of traffic should be considered active when the flag is enabled. Defaults to 100.
Keys should be lowercase and kebab-case: dark-mode, new-checkout, beta-export. Keys are unique per project — the API enforces this constraint.

Creating a flag

1

Open Feature Flags

Navigate to your project and select Feature Flags from the sidebar. Make sure the Flags tab is active.
2

Open the creation dialog

Click New Flag in the top-right corner of the flags table.
3

Fill in name and key

Enter a Name (e.g. New Dashboard) and a Key (e.g. new-dashboard). The key is what your code references at runtime.
4

Set enabled status and rollout percentage

Toggle Enabled on or off. Set the Percentage to control what fraction of traffic is exposed — 100 means all traffic, 0 means none.
5

Create the flag

Click Create. The flag appears immediately in the flags table.

Checking a flag via API

You can check a global flag from your application with either an API key or a dashboard session. The endpoint resolves the flag for an environment and returns its enabled state, configured rollout percentage, source, and the resolved environment.
GET /api/projects/:projectId/flags/check/:flagKey
Authorization: Bearer <api-key>
Example response:
{
  "enabled": true,
  "rollout": 75,
  "source": "global",
  "environment": { "id": "1Rkx7yLBcnX2tGZ4VqHfJp9wYsT", "name": "Production", "key": "production" }
}
enabled already reflects the rollout roll Swisstools performs for this call, so you can branch on it directly. source is "cache" when served from the 60-second Redis cache or "global" when freshly computed. Pass ?env= (an environment key or name) to target a specific environment; otherwise the project’s default is used.

Editing and deleting flags

Find the flag in the table on the Flags tab. Each row has two action icons:
  • Pencil icon — opens the edit dialog. You can update the name, enabled state, and percentage. The key is not editable after creation.
  • Trash icon — opens a confirmation dialog. Deleting a flag is permanent and removes it from all API responses immediately.