# Get a user

> One end user, by their usr_… id or by your own id for them.

<Endpoint method="GET" path="/v1/users/{id}" />

<CodeTabs>

```bash tab="cURL"
curl https://api.muzekit.com/v1/users/user_42 \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY"
```

```javascript tab="Node"
const res = await fetch("https://api.muzekit.com/v1/users/user_42", {
  headers: { Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}` },
});
const user = await res.json();
```

```python tab="Python"
import os
import requests

user = requests.get(
    "https://api.muzekit.com/v1/users/user_42",
    headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
).json()
```

</CodeTabs>

`{id}` is the user's `usr_…` id or the id your server gave them (`external_id`), URL-encoded. A value that reads as a `usr_…` id is looked up as one first; if no user has that id, it is tried as your own id. The user must be in this key's environment: a Test key doesn't see Live users. A user that isn't there answers `404 user_not_found`.

## Examples

### Look a user up by your own id

Your ids may hold characters that aren't safe in a path, such as `|` or `@`. Encode them.

<CodeTabs>

```bash tab="cURL"
curl "https://api.muzekit.com/v1/users/$(jq -rn --arg id 'auth0|5f1c' '$id|@uri')" \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY"
```

```javascript tab="Node"
const id = encodeURIComponent("auth0|5f1c");
const res = await fetch(`https://api.muzekit.com/v1/users/${id}`, {
  headers: { Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}` },
});
if (res.status === 404) {
  // Not in Muzekit yet: create them with POST /v1/users
}
const user = await res.json();
```

```python tab="Python"
import os
from urllib.parse import quote

import requests

res = requests.get(
    f"https://api.muzekit.com/v1/users/{quote('auth0|5f1c', safe='')}",
    headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
)
user = res.json() if res.ok else None  # 404: not in Muzekit yet
```

</CodeTabs>

Reading a user never creates one and doesn't change `last_active_at`. To create or update a user, use [Create or update a user](/docs/api-reference/users-upsert).

## Response

```json
{
  "object": "user",
  "id": "usr_8fK2mQ1xZpR",
  "external_id": "user_42",
  "name": "Ada",
  "email": "ada@example.com",
  "locale": "en",
  "metadata": { "plan": "pro" },
  "last_active_at": "2026-10-16T21:35:00.000Z",
  "created_at": "2026-10-02T09:12:44.000Z"
}
```
