Get contexts
Get contexts based on kind and key.
Authorization
ApiKey read, writeIn: header
Scope: read, write
Path Parameters
The project key
stringThe environment key
stringThe context kind
stringThe context key
stringQuery Parameters
Specifies the maximum number of items in the collection to return (max: 50, default: 20)
int64Limits 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.
stringDeprecated. This endpoint does not support sorting. Requests that include this parameter are rejected with a 400 response, so omit it.
stringA comma-separated list of context filters. This endpoint only accepts an applicationId filter. To learn more about the filter syntax, read Filtering contexts and context instances.
stringSpecifies whether to include or omit the total count of matching contexts. Defaults to true.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X GET "https://example.com/api/v2/projects/string/environments/string/contexts/string/string"{ "_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+equals+%22GoSDK%2F1.2%22", "type": "application/json" }, "site": { "href": "/my-project/my-environment/context/organization:launch-darkly:user:henry", "type": "text/html" } }, "_access": { "denied": [ { "action": "string", "reason": { "resources": [ "proj/*:env/*;qa_*:/flag/*" ], "notResources": [ "string" ], "actions": [ "*" ], "notActions": [ "string" ], "effect": "allow", "role_name": "string" } } ], "allowed": [ { "action": "string", "reason": { "resources": [ "proj/*:env/*;qa_*:/flag/*" ], "notResources": [ "string" ], "actions": [ "*" ], "notActions": [ "string" ], "effect": "allow", "role_name": "string" } } ] }, "associatedContexts": 0 } ]}Search for contexts POST
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](https://launchdarkly.com/docs/api/contexts#filtering-contexts-and-context-instances). To learn more about contexts, read [Contexts and context kinds](https://launchdarkly.com/docs/home/observability/contexts#contexts-and-context-kinds).
Evaluate flags for context instance POST
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](https://launchdarkly.com/docs/guides/api/comparing-sdk-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`.