# Disconnect and erase a user
URL: https://musicapi.com/docs/connect-users/disconnect-users.md

> Delete a connected user when your own user deletes their account. What gets erased, what stays, and why the call needs your Client Secret.

Product: MusicAPI Core and MusicAPI Managed Transfers. Section: Connect your users.

When one of your users deletes their account, or disconnects a music service in your app, delete the connected user in MusicAPI too. One call from your backend does it.

```bash
curl -X DELETE "https://api.musicapi.com/public/integrations/user/3f0b8c1e-6a4d-4c7a-9a55-2f1e7d9b0c11" \
  -u "$MUSICAPI_CLIENT_ID:$MUSICAPI_CLIENT_SECRET"
```

## Answers

| Status | Meaning                                            |
| ------ | -------------------------------------------------- |
| `204`  | The user is erased. No body.                       |
| `400`  | The uuid is not a valid UUID.                      |
| `401`  | The request has no credential.                     |
| `403`  | The credential is not your Client Secret.          |
| `404`  | Your account has no connected user with this uuid. |

The call is idempotent: a second delete of the same user answers `204` again, so you can retry it safely.

> **Client Secret only:** Only Basic authentication can delete a user. A Client ID token, a DevToken, a one-time token and a docs session get `403`, because each of them can sit in a browser or an app.

## What gets erased

- The music-service access and refresh tokens. MusicAPI can no longer act for this user.
- The user's name, email and profile image.
- The copy of the user's library that Managed Transfers keeps.

## What stays

MusicAPI keeps the uuid, the service's own user id and the country code, so your usage numbers and transfer history stay correct. None of them names a person on its own.

If the same person connects the same music account again later, they get the same `integrationUserUUID` back.

## At the music service

Deleting the user in MusicAPI does not remove the permission at the music service. The user can remove the app in the "connected apps" settings of their music account.
