---
title: "List users"
method: GET
path: "/api/v2/users/{projectKey}/{environmentKey}"
tags: ["Users"]
deprecated: true
---

# List users

`GET /api/v2/users/{projectKey}/{environmentKey}`

> **Deprecated.**

> ### Use contexts instead
>
> After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Search for contexts](https://launchdarkly.com/docs/api/contexts/search-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](https://launchdarkly.com/docs/api#representations).

## Path parameters

- `projectKey` string, string, required — The project key
- `environmentKey` string, string, required — The environment key

## Query parameters

- `limit` integer — 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.

## Response `200`

Users collection response

- UsersRep
  - `_links` object — The location and content type of related resources
  - `totalCount` integer, required — The total number of users in the environment
  - `items` UserRecord[], required — Details on the users
    - `lastPing` string, date-time — Timestamp of the last time this user was seen
    - `environmentId` string
    - `ownerId` string
    - `user` User
      - `key` string — The user key. This is the only mandatory user attribute.
      - `secondary` string — If provided, used with the user key to generate a variation in percentage rollouts
      - `ip` string — The user's IP address
      - `country` string — The user's country
      - `email` string — The user's email
      - `firstName` string — The user's first name
      - `lastName` string — The user's last name
      - `avatar` string — An absolute URL to an avatar image.
      - `name` string — The user's full name
      - `anonymous` boolean — Whether the user is anonymous. If true, this user does not appear on the Contexts list in the LaunchDarkly user interface.
      - `custom` object — Any other custom attributes for this user. Custom attributes contain any other user data that you would like to use to conditionally target your users.
      - `privateAttrs` string[] — A list of attribute names that are marked as private. You can use these attributes in targeting rules and segments. If you are using a server-side SDK, the SDK will not send the private attribute back to LaunchDarkly. If you are using a client-side SDK, the SDK will send the private attribute back to LaunchDarkly for evaluation. However, the SDK won't send the attribute to LaunchDarkly in events data, LaunchDarkly won't store the private attribute, and the private attribute will not appear on the Contexts list.
    - `sortValue` string — If this record is returned as part of a list, the value used to sort the list. This is only included when the <code>sort</code> query parameter is specified. It is a time, in Unix milliseconds, if the sort is by <code>lastSeen</code>. It is a user key if the sort is by <code>userKey</code>.
    - `_links` object — The location and content type of related resources
    - `_access` Access
      - `denied` AccessDenied[], required
        - `action` string, required
        - `reason` AccessDeniedReason, required
          - `resources` string[] — Resource specifier strings
          - `notResources` string[] — Targeted resources are the resources NOT in this list. The <code>resources</code> and <code>notActions</code> fields must be empty to use this field.
          - `actions` ActionSpecifier[] — Actions to perform on a resource
          - `notActions` ActionSpecifier[] — Targeted actions are the actions NOT in this list. The <code>actions</code> and <code>notResources</code> fields must be empty to use this field.
          - `effect` 'allow' | 'deny', required — Whether this statement should allow or deny actions on the resources.
          - `role_name` string
      - `allowed` AccessAllowedRep[], required
        - `action` string, required
        - `reason` AccessAllowedReason, required
          - `resources` string[] — Resource specifier strings
          - `notResources` string[] — Targeted resources are the resources NOT in this list. The <code>resources</code> and <code>notActions</code> fields must be empty to use this field.
          - `actions` ActionSpecifier[] — Actions to perform on a resource
          - `notActions` ActionSpecifier[] — Targeted actions are the actions NOT in this list. The <code>actions</code> and <code>notResources</code> fields must be empty to use this field.
          - `effect` 'allow' | 'deny', required — Whether this statement should allow or deny actions on the resources.
          - `role_name` string

## Other responses

- `400` — Invalid request
- `401` — Invalid access token
- `403` — Forbidden
- `404` — Invalid resource identifier
- `429` — Rate limited

---

[API](https://skmtc.dev/launchdarkly/apis/launchdarkly-rest-api.md) · [All operations](https://skmtc.dev/launchdarkly/apis/launchdarkly-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/launchdarkly/launchdarkly-rest-api/revisions/69c5c9aafe78/schema)
