> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chamelio.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Current User

> Return the user, organization, and scopes behind the access token

Resolves an access token to the user it was issued to. This is the quickest way to confirm a token works
and to see exactly what it is allowed to do.

## Endpoint

```
GET /v2/users/user-info
```

## Authentication

This endpoint requires an OAuth access token. Send it as a bearer token:

```bash theme={null}
Authorization: Bearer your_access_token
```

**Required scope:** `users:read`

## Request Example

```bash cURL theme={null}
curl https://platform.chamelio.ai/v2/users/user-info \
  -H "Authorization: Bearer your_access_token"
```

```python Python theme={null}
import requests

url = "https://platform.chamelio.ai/v2/users/user-info"
headers = {
    "Authorization": "Bearer your_access_token"
}

response = requests.get(url, headers=headers)
print(response.json())
```

```javascript JavaScript theme={null}
const response = await fetch('https://platform.chamelio.ai/v2/users/user-info', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer your_access_token'
  }
});

const data = await response.json();
console.log(data);
```

## Response

### Success Response

**Status Code:** `200 OK`

```json theme={null}
{
  "user_id": 1001,
  "email": "john.doe@example.com",
  "first_name": "John",
  "last_name": "Doe",
  "role": "editor",
  "org_id": 123,
  "scopes": ["tasks:read", "tasks:write", "users:read"],
  "application_id": 42
}
```

### Response Fields

| Field | Type | Description |
| - | - | - |
| `user_id` | integer | Unique identifier of the user the token acts as |
| `email` | string | Email address of the user |
| `first_name` | string | First name of the user |
| `last_name` | string | Last name of the user |
| `role` | string | Organization role. One of `admin`, `editor`, `member`, `viewer` |
| `org_id` | integer | Organization the token is bound to |
| `scopes` | array of strings | Scopes granted to this token |
| `application_id` | integer or null | The OAuth application the token was issued to |

## Error Responses

### 400 Bad Request

Returned when the access token has no user behind it.
`client_credentials` tokens act as the admin who created the application, so this applies only to
tokens issued before application creators were recorded.

```json theme={null}
{
  "detail": "client_credentials tokens are not associated with a user"
}
```

### 401 Unauthorized

Returned when the access token is missing, unknown, revoked, or expired, or when an `X-API-Key` was
sent instead of a bearer token. See [OAuth error responses](https://docs.chamelio.ai/api-reference/oauth-apps.md#error-responses).

```json theme={null}
{
  "detail": "Invalid access token"
}
```

### 403 Forbidden

Returned when the token does not carry the required scope.

```json theme={null}
{
  "detail": "Insufficient scope; this endpoint requires: users:read"
}
```

### 404 Not Found

Returned when the token's user no longer exists in the organization.

```json theme={null}
{
  "detail": "User not found"
}
```

### 429 Too Many Requests

Returned when your organization exceeds its per-minute request limit.

```json theme={null}
{
  "detail": "Rate limit exceeded"
}
```

## Notes

> [!NOTE]
>
> This endpoint exists only on the OAuth surface. There is no API-key equivalent, because an API key is
> not tied to a specific end user.

> [!TIP]
>
> Read `scopes` from the response rather than tracking what you requested. It reflects what the user
> actually approved, which may be narrower.

> [!TIP]
>
> Cache the result for the life of a session. The values change only if the token is reissued.

## Use Cases

* **Token verification** - Confirm a freshly issued token works before making real calls
* **Capability discovery** - Enable or hide features in your UI based on the granted `scopes`
* **User identification** - Display who your integration is acting as
* **Debugging permissions** - Explain a `403` by checking the token's user and scopes
