> For the complete documentation index, see [llms.txt](https://docs.abtasty.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.abtasty.com/server-side/command-line-interface/resource-loader/feature-experimentation/flag.md).

# 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:**

```json
{
  "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**

```json
{
  "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).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.abtasty.com/server-side/command-line-interface/resource-loader/feature-experimentation/flag.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
