- [HTTP request](https://developers.google.com/health/reference/rest/v4/users/getIdentity#body.HTTP_TEMPLATE)
- [Path parameters](https://developers.google.com/health/reference/rest/v4/users/getIdentity#body.PATH_PARAMETERS)
- [Request body](https://developers.google.com/health/reference/rest/v4/users/getIdentity#body.request_body)
- [Response body](https://developers.google.com/health/reference/rest/v4/users/getIdentity#body.response_body)
  - [JSON representation](https://developers.google.com/health/reference/rest/v4/users/getIdentity#body.Identity.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://developers.google.com/health/reference/rest/v4/users/getIdentity#body.aspect)
- [Examples](https://developers.google.com/health/reference/rest/v4/users/getIdentity#examples)
- [Try it!](https://developers.google.com/health/reference/rest/v4/users/getIdentity#try-it)

Gets the user's identity.

It includes the legacy Fitbit user ID and the Google user ID and it can be used by migrating clients to map identifiers between the two systems.

### HTTP request

`GET https://health.googleapis.com/v4/{name=users/*/identity}`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax. To know more about valid error responses that can be thrown by this HTTP request, please refer to the [service error catalog](https://developers.google.com/health/reference/rest/v4/errors)

### Path parameters

| Parameters ||
|---|---|
| `name` | `string` Required. The resource name of the Identity. Format: `users/me/identity` It takes the form `users/{user}/identity`. |

### Request body

The request body must be empty.

### Response body

Represents details about the Google user's identity.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "name": string, "legacyUserId": string, "healthUserId": string } ``` |

| Fields ||
|---|---|
| `name` | `string` Identifier. The resource name of this Identity resource. Format: `users/me/identity` |
| `legacyUserId` | `string` Output only. The legacy Fitbit User identifier. This is the Fitbit ID used in the legacy Fitbit APIs (v1-v3). It can be referenced by clients migrating from the legacy Fitbit APIs to map their existing identifiers to the new Google user ID. It **must not** be used for any other purpose. It is not of any use for new clients using only the Google Health APIs. Valid values are strings of 1-63 characters, and valid characters are lowercase and uppercase letters, numbers, and hyphens. |
| `healthUserId` | `string` Output only. The Google User Identifier in the Google Health APIs. It matches the `{user}` resource ID segment in the resource name paths, e.g. `users/{user}/dataTypes/steps`. Valid values are strings of 1-63 characters, and valid characters are lowercase and uppercase letters, numbers, and hyphens. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/googlehealth.profile.readonly`
- `
  https://www.googleapis.com/auth/googlehealth.settings.readonly`
- `
  https://www.googleapis.com/auth/googlehealth.activity_and_fitness.readonly`
- `
  https://www.googleapis.com/auth/googlehealth.health_metrics_and_measurements.readonly`
- `
  https://www.googleapis.com/auth/googlehealth.nutrition.readonly`
- `
  https://www.googleapis.com/auth/googlehealth.sleep.readonly`
- `
  https://www.googleapis.com/auth/googlehealth.irn.readonly`
- `
  https://www.googleapis.com/auth/googlehealth.ecg.readonly`
- `
  https://www.googleapis.com/auth/googlehealth.reproductive_health.readonly`
- `
  https://www.googleapis.com/auth/googlehealth.logged_symptoms.readonly`
- `
  https://www.googleapis.com/auth/googlehealth.mindfulness.readonly`

For more information, see the [OAuth 2.0 Overview](https://developers.google.com/identity/protocols/OAuth2).