---
title: "Evaluate one flag as an app in the given environment would, for a context you supply. Read-only; the console's \"test this flag\" panel."
method: POST
path: "/projects/{project_id}/flags/{key}/evaluate"
tags: ["Feature Flags"]
---

# Evaluate one flag as an app in the given environment would, for a context you supply. Read-only; the console's "test this flag" panel.

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

## 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}/evaluate`
- Auth: HTTP bearer

## Path parameters

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

## Request body

- EvaluateFlagRequest: Evaluate one flag as an app in an environment would.
  - `attributes` object
  - `environment_id` integer, required
  - `key` string, nullable: Bucketing subject. Required for rules with a rollout or a split to apply.

## Response `200`

Evaluation

- Evaluation: The outcome of evaluating one flag. Always carries a usable value.
  - `reason` union, required: Why an evaluation produced the value it did. Part of the wire contract, and the only thing that makes "why is this user seeing the old checkout?" answerable.
    - object: No such flag, or it has been archived. The caller's fallback is served.
      - `kind` 'FLAG_NOT_FOUND', required
    - object: Kill switch engaged for this environment.
      - `kind` 'DISABLED', required
    - object: Targeting rule `index` (0-based) matched on its conditions alone.
      - `index` integer, required
      - `kind` 'RULE_MATCH', required
    - object: Targeting rule `index` matched and the subject's bucket decided the outcome: it was inside the rule's rollout percentage, or the rule split subjects across variants.
      - `index` integer, required
      - `kind` 'PERCENTAGE_ROLLOUT', required
    - object: An environment-specific value was set.
      - `kind` 'ENVIRONMENT_VALUE', required
    - object: Nothing more specific applied; the flag default was served.
      - `kind` 'DEFAULT', required
    - object: Evaluation degraded (malformed stored value or rule). The default is served and the caller is told the value is not trustworthy. Never panics.
      - `kind` 'ERROR', required
  - `value` unknown, required
  - `variant` string, nullable: The variant served, when a rule served one. `None` for plain values.

## Other responses

- `400`: Environment not in project, or the context exceeds the evaluation limits
- `401`: Unauthorized
- `403`: Insufficient permissions
- `404`: Flag or environment not found
- `500`: Internal server error

## Changes

- **2026-11-20** `68c970dc603c`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/projects/:project_id/flags/:key/evaluate/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)
