---
title: "Evaluate Flag"
method: POST
path: "/admin/ld-flags/evaluate"
tags: ["admin", "ld-flags"]
---

# Evaluate Flag

`POST /admin/ld-flags/evaluate`

## Request

- Base URL: `https://api-docs.upsmith.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api-docs.upsmith.com/admin/ld-flags/evaluate`
- Auth: one of:
  - API key in header `x-api-key`
  - HTTP bearer

Evaluate a LaunchDarkly flag on behalf of a caller.

This endpoint is the single point where the LD SDK is consulted for every
non-api-service caller. The LD SDK's in-memory streaming cache answers in
microseconds; no second cache layer is needed here.

## Headers

- `organization-id` string, nullable
- `timezone` string
- `x-user-id` string, nullable
- `x-actor-email` string, nullable
- `x-request-source` string, nullable
- `x-operation-id` string, nullable
- `x-commit-message` string, nullable
- `x-confirmation-id` string, nullable
- `x-chat-id` string, nullable

## Request body

- EvaluateFlagRequest: Request body for POST /admin/ld-flags/evaluate. `context_kind` is "server" (global kill-switches), "organization" (org-scoped targeting), "agent_v2" (per-AgentV2 targeting), "user" (per-user targeting), "contact" (per-contact rollouts — percentage rollouts bucket by the contact key), or "engagement" (per-engagement rollouts — percentage rollouts bucket by the engagement key, so each engagement is bucketed independently). `context_key` is "server" for server context, the organization id for organization context, the AgentV2 id for AgentV2 context, the user's email for user context, the contact id for contact context, or the engagement id for engagement context. `context_name`, when set, is applied as the LD context's built-in `name` attribute so targeting rules that match on `name` (e.g. an org-name allowlist) fire for backend evaluations.
  - `key` string, required
  - `context_kind` 'server' | 'organization' | 'user' | 'contact' | 'engagement' | 'agent_v2', required
  - `context_key` string, required
  - `default` union, required
    - boolean
    - integer
    - number
    - string
  - `context_name` string, nullable
  - `additional_contexts` EvaluateFlagContext[]
    - `context_kind` 'server' | 'organization' | 'user' | 'contact' | 'engagement' | 'agent_v2', required
    - `context_key` string, required
    - `context_name` string, nullable
    - `attributes` object

## Response `200`

Successful Response

- EvaluateFlagResponse: Response body for POST /admin/ld-flags/evaluate.
  - `value` union, required
    - boolean
    - integer
    - number
    - string

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/upsmith/apis/upsmith-api.md) - [All operations](https://skmtc.dev/upsmith/apis/upsmith-api/llms.txt) - [OpenAPI document](https://skmtc.dev/upsmith/apis/upsmith-api/revisions/86e2c2bd93af?raw)
