---
title: "Bring an archived flag back."
method: POST
path: "/projects/{project_id}/flags/{key}/restore"
tags: ["Feature Flags"]
---

# Bring an archived flag back.

`POST /projects/{project_id}/flags/{key}/restore`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/projects/{project_id}/flags/{key}/restore`
- Auth: HTTP bearer

Archiving is otherwise one-way: the key stays reserved so the flag cannot
even be re-created under the same name, which makes an accidental archive
unrecoverable through the API.

## Path parameters

- `project_id` integer, required
- `key` string, required

## Response `200`

Flag restored

- FlagResponse
  - `archived_at` string, nullable
  - `client_visible` boolean, required
  - `created_at` string, required
  - `default_value` unknown, required
  - `description` string, nullable
  - `environments` FlagEnvironmentResponse[], required: Per-environment overrides. Empty means the flag inherits its default everywhere.
    - `enabled` boolean, required
    - `environment_id` integer, required
    - `rules` FlagRule[], required: Ordered targeting rules; first match wins.
      - `conditions` RuleCondition[]: All must hold. Empty means every subject.
        - `attribute` string, required: Context attribute name, e.g. `plan`, `country`, `email`.
        - `operator` 'eq' | 'neq' | 'in' | 'not_in' | 'contains' | 'not_contains' | 'matches' | 'gt' | 'gte' | 'lt' | 'lte' | 'exists' | 'not_exists', required: Comparison applied by one rule condition.
        - `value` union: The right-hand side of a condition: one value, or a list for `in`/`not_in`.
          - AttributeValue[]
            - union: A targeting attribute: what the caller (or the server, implicitly) knows about the subject.
              - …
          - union: A targeting attribute: what the caller (or the server, implicitly) knows about the subject.
            - boolean
            - number, double
            - string
      - `description` string, nullable: Free text shown in the console, e.g. "Beta customers".
      - `rollout_percentage` number, double, nullable: Share of matching subjects the rule applies to, `0..=100`. `None` means all of them. Ramping it up never removes anyone already included.
      - `serve` union, required: What a matching rule serves.
        - object: A literal value of the flag's type.
          - `kind` 'value', required
          - `value` unknown, required
        - object: One declared variant.
          - `kind` 'variant', required
          - `variant` string, required
        - object: Subjects split across declared variants by weight, stably per subject.
          - `kind` 'split', required
          - `split` VariantWeight[], required
            - `variant` string, required: A variant key declared on the flag.
            - `weight` integer, required: Share of the rule's subjects, in whole percent. A split's weights sum to 100.
    - `rules_valid` boolean, required: `false` when the stored rules could not be decoded. The flag then serves its default with reason `ERROR` until they are replaced.
    - `updated_at` string, required: Send back as `expected_updated_at` when replacing the rules.
    - `value` unknown
  - `exposure_sample_rate` number, double, required: Share of subjects whose browser records exposure events. 0 = off.
  - `id` integer, required
  - `key` string, required
  - `last_evaluated_at` string, nullable: When an app last actually evaluated this flag. `None` means never seen, which is a real answer rather than missing data.
  - `updated_at` string, required: Send back as `expected_updated_at` to make an update conditional.
  - `value_type` string, required
  - `variants` FlagVariant[], required: Named values targeting rules may serve.
    - `description` string, nullable
    - `key` string, required: `[a-z0-9][a-z0-9._-]*`, unique within the flag.
    - `value` unknown, required

## Other responses

- `401`: Unauthorized
- `403`: Insufficient permissions
- `404`: Flag not found
- `500`: Internal server error

## Changes

- **2026-11-20** `68c970dc603c`: 5 info
  - added the required property `environments/items/rules` to the response with the `200` status
  - added the required property `environments/items/rules_valid` to the response with the `200` status
  - added the required property `environments/items/updated_at` to the response with the `200` status
  - added the required property `exposure_sample_rate` to the response with the `200` status
  - …1 more
- **2026-08-04** `c647b6ab1d2c`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/projects/:project_id/flags/:key/restore/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
