Contexts are now available
After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use Contexts instead of these endpoints. To learn more, read Contexts.
LaunchDarkly creates a record for each user passed in to variation
calls. This record powers the autocomplete functionality on the feature flag dashboard, as well as the Users page. To learn more, read Contexts.
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.
Use contexts instead
After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use Search for context instances instead of this endpoint.
Search users in LaunchDarkly based on their last active date, a user attribute filter set, or a search query.
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
.
To paginate through results, follow the next
link in the _links
object. To learn more, read Representations.
Users collection response
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
{- "_links": {
- "next": {
- "href": "/api/v2/user-search/my-project/my-environment?after=1647993600000&limit=20&searchAfter=my-user&sort=userKey",
- "type": "application/json"
}, - "self": {
- "href": "/api/v2/user-search/my-project/my-environment?after=1647993600000&limit=20&sort=userKey",
- "type": "application/json"
}
}, - "totalCount": 245,
- "items": [
- {
- "lastPing": "2022-06-28T23:21:29.176609596Z",
- "environmentId": "string",
- "ownerId": "string",
- "user": {
- "key": "user-key-123abc",
- "secondary": "2398127",
- "ip": "10.10.10.10",
- "country": "United States",
- "email": "sandy@example.com",
- "firstName": "Sandy",
- "lastName": "Smith",
- "name": "Sandy Smith",
- "anonymous": false,
- "custom": {
- "property1": null,
- "property2": null
}, - "privateAttrs": [
- "string"
]
}, - "sortValue": "user-key-123abc",
- "_links": {
- "parent": {
- "href": "/api/v2/users/my-project/my-environment",
- "type": "application/json"
}, - "self": {
- "href": "/api/v2/users/my-project/my-environment/my-user",
- "type": "application/json"
}, - "settings": {
- "href": "/api/v2/users/my-project/my-environment/my-user/flags",
- "type": "text/html"
}, - "site": {
- "href": "/my-project/my-environment/users/my-user",
- "type": "text/html"
}
}, - "_access": {
- "denied": [
- {
- "action": "string",
- "reason": {
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "notResources": [
- null
], - "actions": [
- "*"
], - "notActions": [
- null
], - "effect": "allow",
- "role_name": "string"
}
}
], - "allowed": [
- {
- "action": "string",
- "reason": {
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "notResources": [
- null
], - "actions": [
- "*"
], - "notActions": [
- null
], - "effect": "allow",
- "role_name": "string"
}
}
]
}
}
]
}
Use contexts instead
After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use Search for contexts instead of this endpoint.
List all users in the environment. Includes the total count of users. This is useful for exporting all users in the system for further analysis.
Each page displays users up to a set limit
. The default is 20. To page through, follow the next
link in the _links
object. To learn more, read Representations.
Users collection response
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
{- "_links": {
- "next": {
- "href": "/api/v2/users/my-project/my-environment?after=1647993600000&limit=20&searchAfter=my-user",
- "type": "application/json"
}, - "self": {
- "href": "/api/v2/users/my-project/my-environment?after=1647993600000&limit=20",
- "type": "application/json"
}
}, - "totalCount": 245,
- "items": [
- {
- "lastPing": "2022-06-28T23:21:29.176609596Z",
- "environmentId": "string",
- "ownerId": "string",
- "user": {
- "key": "user-key-123abc",
- "secondary": "2398127",
- "ip": "10.10.10.10",
- "country": "United States",
- "email": "sandy@example.com",
- "firstName": "Sandy",
- "lastName": "Smith",
- "name": "Sandy Smith",
- "anonymous": false,
- "custom": {
- "property1": null,
- "property2": null
}, - "privateAttrs": [
- "string"
]
}, - "sortValue": "user-key-123abc",
- "_links": {
- "parent": {
- "href": "/api/v2/users/my-project/my-environment",
- "type": "application/json"
}, - "self": {
- "href": "/api/v2/users/my-project/my-environment/my-user",
- "type": "application/json"
}, - "settings": {
- "href": "/api/v2/users/my-project/my-environment/my-user/flags",
- "type": "text/html"
}, - "site": {
- "href": "/my-project/my-environment/users/my-user",
- "type": "text/html"
}
}, - "_access": {
- "denied": [
- {
- "action": "string",
- "reason": {
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "notResources": [
- null
], - "actions": [
- "*"
], - "notActions": [
- null
], - "effect": "allow",
- "role_name": "string"
}
}
], - "allowed": [
- {
- "action": "string",
- "reason": {
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "notResources": [
- null
], - "actions": [
- "*"
], - "notActions": [
- null
], - "effect": "allow",
- "role_name": "string"
}
}
]
}
}
]
}
Use contexts instead
After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use Get context instances instead of this endpoint.
Get a user by key. The user
object contains all attributes sent in variation
calls for that key.
User response
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
{- "lastPing": "2022-06-28T23:21:29.176609596Z",
- "environmentId": "string",
- "ownerId": "string",
- "user": {
- "key": "user-key-123abc",
- "secondary": "2398127",
- "ip": "10.10.10.10",
- "country": "United States",
- "email": "sandy@example.com",
- "firstName": "Sandy",
- "lastName": "Smith",
- "name": "Sandy Smith",
- "anonymous": false,
- "custom": {
- "property1": null,
- "property2": null
}, - "privateAttrs": [
- "string"
]
}, - "sortValue": "user-key-123abc",
- "_links": {
- "parent": {
- "href": "/api/v2/users/my-project/my-environment",
- "type": "application/json"
}, - "self": {
- "href": "/api/v2/users/my-project/my-environment/my-user",
- "type": "application/json"
}, - "settings": {
- "href": "/api/v2/users/my-project/my-environment/my-user/flags",
- "type": "text/html"
}, - "site": {
- "href": "/my-project/my-environment/users/my-user",
- "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"
}
}
]
}
}
Use contexts instead
After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use Delete context instances instead of this endpoint.
Delete a user by key.
Action succeeded
Invalid access token
Forbidden
Invalid resource identifier
Status conflict
Rate limited
{- "code": "unauthorized",
- "message": "Invalid access token"
}