# Delete the account

`DELETE /api/v1/me`

Deletes the signed-in account and ends the session. [Get what deleting needs](https://docs.monitorly.cloud/api/reference/operations/get-account-deletion.md) says what blocks it and what proof it takes.

Sign-in: a dashboard session only. API tokens and OAuth sign-ins get `403 token.not_allowed`.

Section: Sign-in and account. Operation id in openapi.json: `delete_account`.

## Request body

Required: yes.

`application/json`: AccountDeletionInput

| Field | Type | Required | Description |
|---|---|---|---|
| `code` | string \| null | no | Six digits from the authenticator, when two-factor sign-in is on. |
| `confirmEmail` | string | yes | The account's email, typed again (letter case and surrounding spaces do not matter). |
| `password` | string \| null | no | The current password; may be left out after a provider re-authentication within the last 5 minutes. |

## Responses

Errors are `application/problem+json` (`Problem`); branch on `type`.

### 204

Deleted.

### 400

Bad Request.

- `request.malformed`: the body or a parameter is not of the expected shape
- `auth.credentials_conflict`: the request carries both a session cookie and a token

### 401

Unauthorized.

- `auth.unauthenticated`, `auth.session_expired`: no session, or it ended
- `token.invalid`: the token is malformed, unknown, revoked or expired, or its creator left the workspace

### 403

Forbidden.

- `auth.forbidden`: your role is too low for this
- `token.not_allowed`: this operation needs a signed-in session; tokens cannot call it
- `request.origin_mismatch`, `request.header_required`: a changing request with a session comes from another site or lacks `X-Monitorly-Request: 1`
- `account.reauth_required`: account deletion without a password and without a provider re-authentication in the last 5 minutes
- `account.password_required`: account deletion with a provider re-authentication instead of the password, while the account has a password and a provider linked less than 24 hours ago

### 409

Conflict.

- `account.owns_shared_workspaces`: account deletion while the person owns a workspace with other members: transfer it first
- `account.installation_owner`: the account owns the installation and cannot be deleted

### 413

Payload Too Large.

- `request.too_large`: the body is larger than 256 KiB

### 422

Unprocessable Entity.

- `field.required`, `field.too_long`, `field.invalid`: a field breaks a rule; `errors` points at it
- `account.email_mismatch`: account deletion: `confirmEmail` is not the account's email (`/confirmEmail`)
- `auth.current_password_invalid`: current password is wrong when changing the password (`/currentPassword`; counts as a failed sign-in attempt)

### 429

Too Many Requests.

- `session.rate_limited`: more than 5 changes a second from your sessions

Schemas named above are listed with their fields in [the schema list](https://docs.monitorly.cloud/api/reference/schemas.md).
