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

# Get user

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

> **Deprecated.**

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

## Path parameters

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

## Response `200`

User response

- UserRecord
  - `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)
