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

# Find users

`GET /api/v2/user-search/{projectKey}/{environmentKey}`

> **Deprecated.**

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

## Path parameters

- `projectKey` string, string, required — The project key
- `environmentKey` string, string, required — 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 — Specifies the maximum number of items in the collection to return (max: 50, default: 20)
- `offset` integer — Deprecated, use `searchAfter` instead. Specifies the first item to return in the collection.
- `after` integer — 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

## Response `200`

Users collection response

- Users
  - `_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)
