# User Endpoints {#user-endpoints}


Manage user accounts, profiles, preferences, and user-organization associations.


## Base Path {#base-path}


```
/api/user
```


## Endpoints {#endpoints}



### Get Current User (Me) {#get-current-user-me}


Retrieves the currently authenticated user's profile.

```
GET /api/user/me
Authorization: Bearer {token}
```

**Query Parameters:**

| Parameter   | Type   | Description                                                         |
| ----------- | ------ | ------------------------------------------------------------------- |
| `relations` | string | Comma-separated relations to include (e.g., `role,tenant,employee`) |

**Allowed Relations:** `role`, `tenant`, `employee`, `candidate`, `tags`

**Response** `200 OK`:

```json
{
  "id": "uuid",
  "email": "user@example.com",
  "firstName": "John",
  "lastName": "Doe",
  "imageUrl": "https://...",
  "preferredLanguage": "en",
  "preferredComponentLayout": "TABLE",
  "role": { "id": "uuid", "name": "ADMIN" },
  "tenant": { "id": "uuid", "name": "My Company" },
  "employee": { "id": "uuid" }
}
```


### Find User by Email {#find-user-by-email}


```
GET /api/user/email/:email
Authorization: Bearer {token}
```


### List Users (Paginated) {#list-users-paginated}


```
GET /api/user/pagination
Authorization: Bearer {token}
```

**Query Parameters:**

| Parameter   | Type   | Description           |
| ----------- | ------ | --------------------- |
| `page`      | number | Page number (1-based) |
| `limit`     | number | Items per page        |
| `where`     | object | Filter conditions     |
| `relations` | array  | Relations to include  |


### Find All Users {#find-all-users}


```
GET /api/user
Authorization: Bearer {token}
```


### Find User by ID {#find-user-by-id}


```
GET /api/user/:id
Authorization: Bearer {token}
```


### Get User Count {#get-user-count}


```
GET /api/user/count
Authorization: Bearer {token}
```


### Create User {#create-user}


```
POST /api/user
Authorization: Bearer {token}
Content-Type: application/json

{
  "email": "newuser@example.com",
  "firstName": "Jane",
  "lastName": "Doe",
  "roleId": "uuid",
  "hash": "password_hash"
}
```

**Response** `201 Created`.


### Update User {#update-user}


```
PUT /api/user/:id
Authorization: Bearer {token}
Content-Type: application/json

{
  "firstName": "Updated Name",
  "imageUrl": "https://new-avatar.png"
}
```


### Update Preferred Language {#update-preferred-language}


```
PUT /api/user/preferred-language
Authorization: Bearer {token}
Content-Type: application/json

{
  "preferredLanguage": "fr"
}
```


### Update Preferred Component Layout {#update-preferred-component-layout}


```
PUT /api/user/preferred-component-layout
Authorization: Bearer {token}
Content-Type: application/json

{
  "preferredComponentLayout": "CARDS_GRID"
}
```

Available layouts: `TABLE`, `CARDS_GRID`, `SPRINT_VIEW`


### Delete User {#delete-user}


```
DELETE /api/user/:id
Authorization: Bearer {token}
```

**Response** `200 OK`.


### Factory Reset {#factory-reset}


Resets the entire system to its initial state. Requires `SUPER_ADMIN` role.

```
GET /api/user/reset
Authorization: Bearer {token}
```

> ⚠️ **Warning**: This removes all data and re-seeds the database. Use with extreme caution.


## Data Model {#data-model}


```typescript
interface IUser {
  id: string;
  email: string;
  firstName?: string;
  lastName?: string;
  hash?: string;
  imageUrl?: string;
  preferredLanguage?: string;
  preferredComponentLayout?: ComponentLayoutStyleEnum;
  thirdPartyId?: string;

  // Relations
  roleId?: string;
  role?: IRole;
  tenantId?: string;
  tenant?: ITenant;
  employee?: IEmployee;
  candidate?: ICandidate;
  tags?: ITag[];
}
```


## Permissions {#permissions}


| Action                  | Permission Required      |
| ----------------------- | ------------------------ |
| Get own profile (`/me`) | Authenticated user       |
| List/find users         | `ORG_USERS_VIEW`         |
| Create user             | `ORG_USERS_EDIT`         |
| Update user             | `ORG_USERS_EDIT` or self |
| Delete user             | `ORG_USERS_EDIT`         |
| Factory reset           | `SUPER_ADMIN`            |


## Related Pages {#related-pages}


- [Authentication Endpoints](https://sourcey-gauzy.pages.dev/api/authentication-endpoints/index.md) — login and registration
- [Employee Endpoints](https://sourcey-gauzy.pages.dev/api/employee-endpoints/index.md) — employee management
- [Role & Permission Endpoints](https://sourcey-gauzy.pages.dev/api/role-permission-endpoints/index.md) — role management
