v5

latestOpenAPI 3.0.3Apache 2.0raw.githubusercontent.com2026-02-283466592.5 MB
Contexts

Evaluate flags for context instance

Evaluate flags for a context instance, for example, to determine the expected flag variation. Do not use this API instead of an SDK. The LaunchDarkly SDKs are specialized for the tasks of evaluating feature flags in your application at scale and generating analytics events based on those evaluations. This API is not designed for that use case. Any evaluations you perform with this API will not be reflected in features such as flag statuses and flag insights. Context instances evaluated by this API will not appear in the Contexts list. To learn more, read Comparing LaunchDarkly's SDKs and REST API.

Filtering

LaunchDarkly supports the filter query param for filtering, with the following fields:

  • query filters for a string that matches against the flags' keys and names. It is not case sensitive. For example: filter=query equals dark-mode.
  • tags filters the list to flags that have all of the tags in the list. For example: filter=tags contains ["beta","q1"].

You can also apply multiple filters at once. For example, setting filter=query equals dark-mode, tags contains ["beta","q1"] matches flags which match the key or name dark-mode and are tagged beta and q1.

post/api/v2/projects/{projectKey}/environments/{environmentKey}/flags/evaluate

Path parameters

projectKeystring string required

The project key

The project key

environmentKeystring string required

The environment key

The environment key

Query parameters

limitinteger

The number of feature flags to return. Defaults to -1, which returns all flags

The number of feature flags to return. Defaults to -1, which returns all flags

offsetinteger

Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query limit.

Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query limit.

sortstring string

A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order

A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order

filterstring string

A comma-separated list of filters. Each filter is of the form field operator value. Supported fields are explained above.

A comma-separated list of filters. Each filter is of the form field operator value. Supported fields are explained above.

Request body

ContextInstance required

Response

Flag evaluation collection response

totalCountinteger

The number of flags

_linksobject required

The location and content type of related resources

Example response

{
  "items": [
    {
      "_links": {
        "self": {
          "href": "/api/v2/projects/{projectKey}/environments/{environmentKey}/flags/evaluate",
          "type": "application/json"
        },
        "site": {
          "href": "/my-project/my-environment/features/sort.order/targeting",
          "type": "text/html"
        }
      },
      "_value": true,
      "key": "sort.order",
      "name": "SortOrder",
      "reason": {
        "kind": "FALLTHROUGH"
      }
    },
    {
      "_links": {
        "self": {
          "href": "/api/v2/projects/{projectKey}/environments/{environmentKey}/flags/evaluate",
          "type": "application/json"
        },
        "site": {
          "href": "/my-project/my-environment/features/alternate.page/targeting",
          "type": "text/html"
        }
      },
      "_value": false,
      "key": "alternate.page",
      "name": "AlternatePage",
      "reason": {
        "kind": "RULE_MATCH",
        "ruleID": "b2530cdf-14c6-4e16-b660-00239e08f19b",
        "ruleIndex": 1
      }
    }
  ],
  "totalCount": 2,
  "_links": {
    "self": {
      "href": "/api/v2/projects/{projectKey}/environments/{environmentKey}/flags/evaluate",
      "type": "application/json"
    }
  }
}