---
title: "Delete a user from every store"
description: "Erase a user: identity, auth row, threads, checkpoints, queued work,\nmemory graph and overlay, owned resources, uploaded files, caches.\n\n``user_id`` is the Truememory UUID (the ``user_id`` your other calls\nreturn). Service callers may address the user with ``X-On-Behalf-Of`` or\n``X-External-User-Id`` instead, as long as it matches the path.\n\nAnswers 202 as soon as the user is marked deleted and their deletion\nworkflow is started. From the mark on, any request with the user's token\nor naming them in a subject header answers 410 ``USER_DELETED``. The\nworkflow (one per user) removes the identity and every store on the\nmaintenance lane, normally within seconds, retrying a store that fails.\nPoll ``GET /users/{user_id}/deletion`` or pass ``callback_url``. A second\ncall for a deletion that completed returns ``completed``; otherwise it\nstarts the workflow again, which is a no-op while one is in flight and a\nretry when the last one ended failed.\n\n``?dry_run=true`` returns row counts per store and the memory scopes that\nwould be removed, and writes nothing."
---

> Documentation Index
> Fetch the complete documentation index at: https://truememory-docs.mvstg.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: AI Gateway API › Users

`DELETE /users/{user_id}`

Erase a user: identity, auth row, threads, checkpoints, queued work,
memory graph and overlay, owned resources, uploaded files, caches.

``user_id`` is the Truememory UUID (the ``user_id`` your other calls
return). Service callers may address the user with ``X-On-Behalf-Of`` or
``X-External-User-Id`` instead, as long as it matches the path.

Answers 202 as soon as the user is marked deleted and their deletion
workflow is started. From the mark on, any request with the user's token
or naming them in a subject header answers 410 ``USER_DELETED``. The
workflow (one per user) removes the identity and every store on the
maintenance lane, normally within seconds, retrying a store that fails.
Poll ``GET /users/{user_id}/deletion`` or pass ``callback_url``. A second
call for a deletion that completed returns ``completed``; otherwise it
starts the workflow again, which is a no-op while one is in flight and a
retry when the last one ended failed.

``?dry_run=true`` returns row counts per store and the memory scopes that
would be removed, and writes nothing.

## Authentication

- `HTTPBearer`, http, header `Authorization`

## Path parameters

- `user_id` (`delete_user.path.user_id`; string, required)

## Query parameters

- `dry_run` (`delete_user.query.dry_run`; boolean, optional)
  - default `false`

## Header parameters

- `X-On-Behalf-Of` (`delete_user.header.X-On-Behalf-Of`; any of, optional)
  - any of: `string`, `null`
- `X-External-User-Id` (`delete_user.header.X-External-User-Id`; any of, optional)
  - any of: `string`, `null`
- `X-App-Id` (`delete_user.header.X-App-Id`; any of, optional)
  - any of: `string`, `null`

## Request body

Any of:

- `UserDeletionRequest`
- `null`

## Example request

```json
{
  "reason": "gdpr_art17",
  "callback_url": "http://example.com",
  "include_linked": false
}
```

## Code samples

### cURL

```bash
curl --request DELETE \
  --url 'https://truememory-api.mvstg.com/users/<user_id>' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "reason": "gdpr_art17",
  "callback_url": "http://example.com",
  "include_linked": false
}
'
```

### TypeScript

```typescript
const url = 'https://truememory-api.mvstg.com/users/<user_id>';
const options = {
  method: 'DELETE',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    reason: 'gdpr_art17',
    callback_url: 'http://example.com',
    include_linked: false
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://truememory-api.mvstg.com/users/<user_id>"

payload = {
    "reason": "gdpr_art17",
    "callback_url": "http://example.com",
    "include_linked": False
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.delete(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 202

Successful Response

#### Example

```json
{
  "user_id": "string",
  "status": "accepted",
  "requested_at": "2019-08-24T14:15:22Z",
  "completed_at": "2019-08-24T14:15:22Z"
}
```

Any of:

- `UserDeletionStatus`
- `UserDeletionDryRun`

### 422

Validation Error

#### Example

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

- `detail` (`delete_user.response.422.detail`; array<object>, optional)
  - `loc` (`delete_user.response.422.detail.loc`; array<any of>, required)
    - any of: `string`, `integer`
  - `msg` (`delete_user.response.422.detail.msg`; string, required)
  - `type` (`delete_user.response.422.detail.type`; string, required)
  - `input` (`delete_user.response.422.detail.input`; unknown, optional)
  - `ctx` (`delete_user.response.422.detail.ctx`; object, optional)


Source: https://truememory-docs.mvstg.com/api/users/delete/index.md
