Flag

Schema, including its fields, nested structure, and relationships

Definition

A Flag is a governed feature toggle/config key your application reads at runtime. Variations set flag values via modifications (e.g., "type": "FLAG" in a variation). Declaring flags centrally enforces naming, typing, and reuse across campaigns.

Payload Properties

When creating or updating a flag, the payload can include:

  • id (String, optional) – The flag's unique ID. Include this only when updating an existing flag.

  • name (String, required) — Unique flag key used in modifications.value.

  • type (String, required) — Expected value type (e.g., "string", "boolean", "number", "json").

  • description (String, optional) — Human-readable description.

  • source (String, optional) — Origin of the flag (e.g., "manual", "api").

  • default_value (Any, optional) — Default value returned when no override/experiment applies.

  • predefined_values (Array, optional) — Allowed values (for enums or UI pickers). Leave empty for free-form types.

Notes • Keep type consistent with the values you plan to set in variations. • Use predefined_values to constrain inputs (e.g., ["blue","green"]) when you want UI validation.

Example Project Payload:

{
  "name": "flag_created_with_resource_loader",
  "type": "string",
  "description": "Loaded from resource loader",
  "source": "manual",
  "default_value": "",
  "predefined_values": []
}

Response Fields

When a Flag is returned by the API/Resource Loader, you’ll receive server-managed metadata plus the normalized definition:

  • id (String) — Unique flag identifier.

  • name (String) — Flag key.

  • type (String) — Value type (e.g., "string").

  • description (String) — Description.

  • source (String) — Origin (e.g., "manual").

  • default_value (Any) — Default value when no overrides apply.

  • predefined_values (Array) — Allowed values, if any.

  • created_at (String, ISO-8601) — Creation timestamp.

Example Response

{
  "created_at": "2025-11-12T11:26:43+00:00",
  "default_value": "",
  "description": "Loaded from resource loader",
  "id": "flag_id",
  "name": "flag_created_with_resource_loader",
  "predefined_values": [],
  "source": "manual",
  "type": "string"
}

Error Codes

  • InvalidPayload – Missing project name when creating a project, or other payload formatting issues.

  • PermissionDenied – User not allowed to create projects (if such permission is restricted).

Last updated

Was this helpful?