# Disconnect

> Stop reading one of an app user's connected apps, and, if you ask, erase what it delivered to their memory.

`POST /v2/connections/disconnect`

- Auth: read and write key (project)
- Cost: free; never refused for your plan

Disconnects one app of the app user named in `X-Alexein-User`. Nothing more is read from it, and the sign-in it
held is deleted. See [Connect your users' apps](/guides/connect-apps).

**Without `forget`, memory keeps what the app already delivered.** To erase that too, send `"forget": true`. The
answer's `forgotten: true` means the erasure of what that connection delivered has been asked for and is queued:
it is not done when the answer comes, and it completes once erasure by connection is available. Items you added
yourself are not touched. To erase the whole app user, use [`users/delete`](/api/users/delete), which disconnects
every app they connected first.

## Headers

- `Authorization` (string, required): `Bearer ax_…`, an API key. The key must read and write.
- `X-Alexein-User` (string, required): The app user whose app to disconnect. See [App users](/concepts/app-users).
- `X-Request-Id` (string): Your id for this request, echoed on the response.

## Body

- `id` (string, required): The connection's id, from [`connections`](/api/connections) or the `connection_id` the person came back
  with.
- `forget` (boolean): `true` to erase what this connection delivered from the app user's memory. Default `false`: memory keeps it.

## Response

- `id` (string): The connection disconnected.
- `status` (string): `revoked`.
- `forgotten` (boolean): `true` when you asked for `forget`: the erasure of what it delivered is queued, and completes once erasure by
  connection is available. `false` when memory keeps it.

## Errors

- `400` (bad request): `X-Alexein-User` is missing or not a usable id.
- `401` (unauthorized): The bearer is not a key this service issued.
- `403` (forbidden): `This API key only reads: ...`; a [personal key](/concepts/personal-memory#personal-keys), whose own apps
  are under My memory › Connectors; or the organisation has been closed in the console.
- `404` (not found): `no such connection`: no connection of this app user has that id. A connection of another app user, project
  or organisation answers the same.
- `422` (invalid): No `id`, or an unknown field.
- `429` (too many requests): Past your organisation's rate limits. Retry after `Retry-After` seconds. See
  [Limits](/concepts/limits#rate-limits).
- `503` (unavailable): Connecting apps cannot be reached just now. Retry after `Retry-After` seconds.
```bash title="Request"
curl https://api.alexein.ai/v2/connections/disconnect \
  -H "Authorization: Bearer $ALEXEIN_API_KEY" \
  -H "X-Alexein-User: user_42" \
  -H "Content-Type: application/json" \
  -d '{"id": "6f1c2d9e-4b7a-4e3f-9a51-0c8d2e7b4f13", "forget": true}'
```

```json title="200 OK"
{
  "id": "6f1c2d9e-4b7a-4e3f-9a51-0c8d2e7b4f13",
  "status": "revoked",
  "forgotten": true
}
```
