# Search Users by Name, Email, or Username

`GET /api/identity/users/search`

### Overview
Searches user directory for ownership transfer, sharing invitations, and RBAC assignments.

### Authentication & Headers
- **Auth**: Bearer Token (Role Level 1 or 2)
- **Required Header**: `API-Version: 1`

### Parameters
- **`q`** *(query, string, optional)*: Search term matching username, name, or email.
- **`limit`** *(query, integer, default: 20)*: Maximum number of user records to return.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `search` | query | string | no | Keyword to search user directory across username, name, or email. Non-admin callers require at least 3 characters. |
| `q` | query | string | no | Alias for the search parameter. |
| `limit` | query | integer | no | Maximum number of records to return in the paginated response (1 to 100). |
| `offset` | query | integer | no | Number of initial records to skip for pagination. |
| `unscoped` | query | boolean | no | Bypass active role group scoping. Restricted to elevated roles (Level 1, 2, 99). Returns 403 Forbidden for low-privilege callers. |

## Responses

### 200 — List of matching users

### 400 — Bad Request - The request parameters or headers are invalid (e.g. unsupported API-Version).

### 401 — Unauthorized - Missing, invalid, or expired JWT Bearer token.

### 403 — Forbidden - Insufficient role permissions or resource access denied by RBAC policy.

### 404 — Not Found - The requested resource ID was not found.

### 422 — Validation Error

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `detail` | object[] | no |  |
| `detail[].loc` | string | integer[] | yes |  |
| `detail[].msg` | string | yes |  |
| `detail[].type` | string | yes |  |
| `detail[].input` | object | no |  |
| `detail[].ctx` | object | no |  |

```json
{
  "detail": [
    {
      "loc": [
        null
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}
```

## Example

```bash
curl -X GET "$PINTER_URL/api/identity/users/search" \
  -H "Authorization: Bearer $ACCESS_TOKEN"
```
