> For the complete documentation index, see [llms.txt](https://docs.visualsentinel.com/llms.txt)

# User API

User profile and preferences. This page lists all 8 endpoints in the User area of the Visual Sentinel REST API.

Base URL: `https://visualsentinel.com`. Unless an endpoint says otherwise it accepts an API key or a session cookie, see [Authentication](https://docs.visualsentinel.com/guides/authentication.md). Most error responses use the [ErrorResponse](https://docs.visualsentinel.com/reference/models/error-response.md) shape, see [Errors](https://docs.visualsentinel.com/guides/errors.md) and [Rate limits](https://docs.visualsentinel.com/guides/rate-limits.md).

## Endpoints

- [Get user profile](#get-user-profile): `GET /api/user/profile`
- [Update user profile](#update-user-profile): `PUT /api/user/profile`
- [Upload avatar](#upload-avatar): `POST /api/user/profile/avatar`
- [Delete avatar](#delete-avatar): `DELETE /api/user/profile/avatar`
- [Delete account](#delete-account): `POST /api/user/delete-account`
- [Get digest preferences](#get-digest-preferences): `GET /api/user/digest-preferences`
- [Update digest preferences](#update-digest-preferences): `PUT /api/user/digest-preferences`
- [Switch organization](#switch-organization): `POST /api/user/organizations/switch`

## Get user profile

`GET /api/user/profile`

Get the current user's profile information.

**Responses**

- `200`: User profile.

## Update user profile

`PUT /api/user/profile`

Update the current user's profile (name, avatar, etc.).

Request body (required): object.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | No |   |
| `avatar` | string | No |   |

**Responses**

- `200`: Profile updated.

## Upload avatar

`POST /api/user/profile/avatar`

Upload a new avatar image for the current user. Accepts JPEG, PNG, WebP, or GIF up to 2MB. Replaces any existing avatar.

Request body (required): object (`multipart/form-data`).

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `file` | string (binary) | Yes | Avatar image file (JPEG, PNG, WebP, or GIF, max 2MB) |

**Responses**

- `200`: Avatar uploaded. Body: object.
- `400`: Invalid file type or file too large.
- `401`: Not authenticated.
- `503`: Database unavailable.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `avatar` | string | No | URL path to the uploaded avatar |

## Delete avatar

`DELETE /api/user/profile/avatar`

Remove the current user's avatar image and reset to default.

**Responses**

- `200`: Avatar deleted. Body: object.
- `401`: Not authenticated.
- `503`: Database unavailable.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `success` | boolean | No |   |

## Delete account

`POST /api/user/delete-account`

Permanently delete the user's account.

Authentication: session cookie only. API keys are refused.

**Responses**

- `200`: Account deleted.

## Get digest preferences

`GET /api/user/digest-preferences`

Get the user's email digest preferences.

**Responses**

- `200`: Digest preferences.

## Update digest preferences

`PUT /api/user/digest-preferences`

Update email digest frequency and settings.

**Responses**

- `200`: Preferences updated.

## Switch organization

`POST /api/user/organizations/switch`

Switch the active organization for the current session.

Authentication: session cookie only. API keys are refused.

Request body (required): object.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | string (uuid) | Yes |   |

**Responses**

- `200`: Organization switched.

Generated from the OpenAPI 3.1 specification at [https://docs.visualsentinel.com/openapi.json](https://docs.visualsentinel.com/openapi.json), the same file the interactive reference reads.
