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

# User Details API

> Retrieve user details for a specific its identifier

## Authentication

All requests require an API key in the request headers.

**Headers:**

```
Authorization: Api-Key YOUR_API_KEY
```

## Request

**Content-Type:** `application/json`

### Path Parameters

| Parameter | Type   | Required | Description                                                                                     |
| --------- | ------ | -------- | ----------------------------------------------------------------------------------------------- |
| `id`      | string | Yes      | The unique identifier of the User to retrieve. If you pass 'me' as param, it gives your details |

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET https://api.pazy.io/v1.0/user/<userId> \
    -H "Authorization: Api-Key YOUR_API_KEY"
  ```

  ```javascript JavaScript (Fetch API) theme={null}
  const response = await fetch("https://api.pazy.io/v1.0/user/<userId>", {
    method: "GET",
    headers: {
      Authorization: "Api-Key YOUR_API_KEY",
    },
  });

  const result = await response.json();
  ```

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

  url = "https://api.pazy.io/v1.0/user/<userId>"
  headers = {
      "Authorization": "Api-Key YOUR_API_KEY"
  }

  response = requests.get(url, headers=headers)
  result = response.json()
  ```
</CodeGroup>

## Success Response

**HTTP Status:** `200 OK`

**Response Fields:**

| Field                    | Type    | Description                                                 |
| ------------------------ | ------- | ----------------------------------------------------------- |
| `ok`                     | boolean | Indicates whether the request was successful                |
| `data`                   | object  | Contains the user response data                             |
| `data.id`                | string  | Unique identifier for the user                              |
| `data.name`              | string  | Name of the user                                            |
| `data.email`             | string  | Email address of the user                                   |
| `data.role`              | string  | Role of the user in the organization e.g. `ADMIN`, `MEMBER` |
| `data.organization`      | object  | Information about the user's organization                   |
| `data.organization.id`   | string  | Unique identifier for the organization                      |
| `data.organization.name` | string  | Name of the organization                                    |

### Response Example

```json theme={null}
{
  "ok": true,
  "data": {
    "id": "<userId>",
    "name": "John Doe",
    "email": "johndoe@pazy.io",
    "role": "ADMIN",
    "organization": {
      "id": "<orgId>",
      "name": "JOHN DOE ORG PRIVATE LIMITED"
    }
  }
}
```

## Error Responses

### Missing User ID

**HTTP Status:** `400 Bad Request`

```json theme={null}
{
  "ok": false,
  "error": {
    "code": "MISSING_REQUIRED_FIELD",
    "message": "User ID is required"
  }
}
```

### User Not Found

**HTTP Status:** `404 Not Found`

```json theme={null}
{
  "ok": false,
  "error": {
    "code": "USER_NOT_FOUND",
    "message": "User not found"
  }
}
```

### Access Denied

**HTTP Status:** `403 Forbidden`

```json theme={null}
{
  "ok": false,
  "error": {
    "code": "ACCESS_DENIED",
    "message": "Access denied: You can only view your own users or users where you are the user owner"
  }
}
```

### Authentication Errors

**HTTP Status:** `401 Unauthorized`

```json theme={null}
{
  "ok": false,
  "error": {
    "code": "MISSING_CREDENTIALS",
    "message": "Missing Credentials"
  }
}
```

```json theme={null}
{
  "ok": false,
  "error": {
    "code": "INVALID_API_KEY",
    "message": "Invalid API Key"
  }
}
```

### Permission Errors

**HTTP Status:** `403 Forbidden`

```json theme={null}
{
  "ok": false,
  "error": {
    "code": "INSUFFICIENT_PERMISSIONS",
    "message": "Permission check failed - PERMISSION_CHECK_FAILED"
  }
}
```

## Best Practices

### Access Control

* Only your data you can view. You can view all users data, only if you are 'admin'.
