v5

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

Search for contexts

Search for contexts.

You can use either the query parameters or the request body parameters. If both are provided, there is an error.

To learn more about the filter syntax, read Filtering contexts and context instances. To learn more about contexts, read Contexts and context kinds.

post/api/v2/projects/{projectKey}/environments/{environmentKey}/contexts/search

Path parameters

projectKeystring string required

The project key

The project key

environmentKeystring string required

The environment key

The environment key

Query parameters

limitinteger

Specifies the maximum number of items in the collection to return (max: 50, default: 20)

Specifies the maximum number of items in the collection to return (max: 50, default: 20)

continuationTokenstring string

Limits results to contexts with sort values after the value specified. You can use this for pagination, however, we recommend using the next link we provide instead.

Limits results to contexts with sort values after the value specified. You can use this for pagination, however, we recommend using the next link we provide instead.

sortstring string

Specifies a field by which to sort. LaunchDarkly supports sorting by timestamp in ascending order by specifying ts for this value, or descending order by specifying -ts.

Specifies a field by which to sort. LaunchDarkly supports sorting by timestamp in ascending order by specifying ts for this value, or descending order by specifying -ts.

filterstring string

A comma-separated list of context filters. To learn more about the filter syntax, read Filtering contexts and context instances.

A comma-separated list of context filters. To learn more about the filter syntax, read Filtering contexts and context instances.

includeTotalCountboolean

Specifies whether to include or omit the total count of matching contexts. Defaults to true.

Specifies whether to include or omit the total count of matching contexts. Defaults to true.

Request body

filterstring

A collection of context filters

sortstring

Specifies a field by which to sort. LaunchDarkly supports sorting by timestamp in ascending order by specifying <code>ts</code> for this value, or descending order by specifying <code>-ts</code>.

limitinteger

Specifies the maximum number of items in the collection to return (max: 50, default: 20)

continuationTokenstring

Limits results to contexts with sort values after the value specified. You can use this for pagination, however, we recommend using the <code>next</code> link instead, because this value is an obfuscated string.

Example request

{
  "filter": "*.name startsWith Jo,kind anyOf [\"user\",\"organization\"]",
  "sort": "-ts",
  "limit": 10,
  "continuationToken": "QAGFKH1313KUGI2351"
}

Response

Contexts collection response

_linksobject

The location and content type of related resources

totalCountinteger

The number of contexts

_environmentIdstring required

The environment ID where the context was evaluated

continuationTokenstring

An obfuscated string that references the last context instance on the previous page of results. You can use this for pagination, however, we recommend using the <code>next</code> link instead.

Example response

{
  "_links": {
    "next": {
      "href": "/app.launchdarkly.com/api/v2/projects/my-project/environments/my-environment/contexts?filter=kind:{\"equals\": [\"organization\"]}&limit=2&continuationToken=QAGFKH1313KUGI2351",
      "type": "application/json"
    },
    "self": {
      "href": "/api/v2/projects/my-proj/environments/my-env/contexts?filter=kind:{\"equals\": [\"organization\"]}&limit=2&continuationToken=QAGFKH1313KUGI2351",
      "type": "application/json"
    }
  },
  "totalCount": 100,
  "_environmentId": "57be1db38b75bf0772d11384",
  "continuationToken": "QAGFKH1313KUGI2351",
  "items": [
    {
      "lastSeen": "2022-04-15T15:00:57.526470334Z",
      "applicationId": "GoSDK/1.2",
      "context": "{\"kind\": \"user\", \"key\": \"context-key-123abc\", \"name\": \"Sandy Smith\", \"email\": \"sandy@example.com\"}",
      "_links": {
        "parent": {
          "href": "/api/v2/projects/my-project/environments/my-environment",
          "type": "application/json"
        },
        "self": {
          "href": "/api/v2/projects/my-project/environments/my-env/contexts/organization:launch-darkly:user:henry?filter=applicationId:\"GoSDK/1.2\"",
          "type": "application/json"
        },
        "site": {
          "href": "/my-project/my-environment/context/organization:launch-darkly:user:henry",
          "type": "text/html"
        }
      },
      "_access": {
        "denied": [
          {
            "reason": {
              "resources": [
                "proj/*:env/*;qa_*:/flag/*"
              ],
              "actions": [
                "*"
              ],
              "effect": "allow"
            }
          }
        ],
        "allowed": [
          {
            "reason": {
              "resources": [
                "proj/*:env/*;qa_*:/flag/*"
              ],
              "actions": [
                "*"
              ],
              "effect": "allow"
            }
          }
        ]
      }
    }
  ]
}