Users

LaunchDarkly creates a record for each user passed in to variation calls. This record powers the autocomplete functionality on the Feature Flag management page, as well as the Users page.

LaunchDarkly also offers an API that lets you tap into this data. You can use the users API to see what user data is available to LaunchDarkly, as well as determine which flag values a user will receive. You can also explicitly set which flag value a user will receive via this API.

Users are always scoped within a project and environment. In other words, each environment has its own set of user records.

Find users

Search users in LaunchDarkly based on their last active date, a user attribute filter set, or a search query. Do not use to list all users in LaunchDarkly. Instead, use the List users API resource.

An example user attribute filter set is filter=firstName:Anna,activeTrial:false. This matches users that have the user attribute firstName set to Anna, that also have the attribute activeTrial set to false.

offset is deprecated

offset is deprecated and will be removed in a future API version. You can still use offset and limit for pagination, but we recommend you use sort and searchAfter instead. searchAfter allows you to page through more than 10,000 users, but offset and limit do not.

Request
Security:
ApiKey (readwrite)
path Parameters
projKey
required
string <string>

The project key

envKey
required
string <string>

The environment key

query Parameters
q
string <string>

Full-text search for users based on name, first name, last name, e-mail address, or key

limit
integer <int64>

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

offset
integer <int64>

Specifies the first item to return in the collection

after
integer <int64>

A unix epoch time in milliseconds specifying the maximum last time a user requested a feature flag from LaunchDarkly

sort
string <string>

Specifies a field by which to sort. LaunchDarkly supports the userKey and lastSeen fields. Fields prefixed by a dash ( - ) sort in descending order.

searchAfter
string <string>

Limits results to users with sort values after the value you specify. You can use this for pagination, but we recommend using the next link we provide instead.

filter
string <string>

A comma-separated list of user attribute filters. Each filter is in the form of attributeKey:attributeValue

Responses
200

Users collection response

400

Invalid request

401

Invalid access token

403

Forbidden

404

Invalid resource identifier

429

Rate limited

get/api/v2/user-search/{projKey}/{envKey}
Request samples
curl -i -X GET \
  https://app.launchdarkly.com/api/v2/user-search/:projKey/:envKey \
  -H 'Authorization: YOUR_API_KEY_HERE'
Response samples
application/json
{
  • "_links": {
    },
  • "totalCount": 0,
  • "items": [
    ]
}

List users

List all users in the environment. Includes the total count of users. In each page, there is up to limit users returned. The default is 20. This is useful for exporting all users in the system for further analysis. To paginate through, follow the next link in the _links object, as described in Representations.

Request
Security:
ApiKey (readwrite)
path Parameters
projKey
required
string <string>

The project key

envKey
required
string <string>

The environment key

query Parameters
limit
integer <int64>

The number of elements to return per page

searchAfter
string <string>

Limits results to users with sort values after the value you specify. You can use this for pagination, but we recommend using the next link we provide instead.

Responses
200

Users collection response

400

Invalid request

401

Invalid access token

403

Forbidden

404

Invalid resource identifier

429

Rate limited

get/api/v2/users/{projKey}/{envKey}
Request samples
curl -i -X GET \
  https://app.launchdarkly.com/api/v2/users/:projKey/:envKey \
  -H 'Authorization: YOUR_API_KEY_HERE'
Response samples
application/json
{
  • "_links": {
    },
  • "totalCount": 0,
  • "items": [
    ]
}

Get user

Get a user by key. The user object contains all attributes sent in variation calls for that key.

Request
Security:
ApiKey (readwrite)
path Parameters
projKey
required
string <string>

The project key

envKey
required
string <string>

The environment key

key
required
string <string>

The user key

Responses
200

User response

400

Invalid request

401

Invalid access token

403

Forbidden

404

Invalid resource identifier

429

Rate limited

get/api/v2/users/{projKey}/{envKey}/{key}
Request samples
curl -i -X GET \
  https://app.launchdarkly.com/api/v2/users/:projKey/:envKey/:key \
  -H 'Authorization: YOUR_API_KEY_HERE'
Response samples
application/json
{
  • "lastPing": "2019-08-24T14:15:22Z",
  • "environmentId": "string",
  • "ownerId": "string",
  • "user": {
    },
  • "sortValue": null,
  • "_links": {
    },
  • "_access": {
    }
}

Delete user

Delete a user by key

Request
Security:
ApiKey (readwrite)
path Parameters
projKey
required
string <string>

The project key

envKey
required
string <string>

The environment key

key
required
string <string>

The user key

Responses
204

Action succeeded

401

Invalid access token

403

Forbidden

404

Invalid resource identifier

409

Status conflict

429

Rate limited

delete/api/v2/users/{projKey}/{envKey}/{key}
Request samples
curl -i -X DELETE \
  https://app.launchdarkly.com/api/v2/users/:projKey/:envKey/:key \
  -H 'Authorization: YOUR_API_KEY_HERE'
Response samples
application/json
{
  • "code": "unauthorized",
  • "message": "invalid key"
}