# Delete a profile

> DELETE /api/v0/profiles: delete a customer profile and the profiles merged into it, by id, email or phone number, from your server.

`DELETE https://releva.ai/api/v0/profiles` deletes a customer profile. The profile, every profile merged into it and its anonymous ids are deleted together.

## When to use it

GDPR gives users the right to be forgotten. Call it from your server to respect that right in an automated way, or to remove test profiles. To keep a copy for the person first, run [Export a profile’s data](https://releva.ai/documentation/reference/profiles/export-a-profiles-data/) before you delete.

## Authentication

Send your shop’s Secret Key as a bearer token, from your server only:

```plaintext
authorization: Bearer $RELEVA_SECRET_KEY
```

Find the key under **Settings › Shop & Integration**; see [Find your Access Token and Secret Key](https://releva.ai/documentation/guides/shop-settings/find-your-api-keys/). Authentication failures answer `400`, not `401` (see [Errors](https://releva.ai/documentation/reference/profiles/delete-a-profile/#errors)).

## Request

`DELETE /api/v0/profiles` with one or more of these query parameters. Each one you send is deleted.

| Parameter     | Notes                                                                                      |
| ------------- | ------------------------------------------------------------------------------------------ |
| `profileId`   | Your customer id.                                                                          |
| `email`       | A valid email address.                                                                     |
| `phoneNumber` | International form only: `+` and digits. Send `+` as `%2B`. National numbers are rejected. |

```plaintext
# By email
curl -X DELETE 'https://releva.ai/api/v0/profiles?email=maria@example.com' \
  -H "authorization: Bearer $RELEVA_SECRET_KEY" \
  -H 'content-type: application/json'


# By your customer id
curl -X DELETE 'https://releva.ai/api/v0/profiles?profileId=DEMO-1001' \
  -H "authorization: Bearer $RELEVA_SECRET_KEY" \
  -H 'content-type: application/json'


# By phone number: send + as %2B
curl -X DELETE 'https://releva.ai/api/v0/profiles?phoneNumber=%2B15555550199' \
  -H "authorization: Bearer $RELEVA_SECRET_KEY" \
  -H 'content-type: application/json'
```

## Response

`202 Accepted` with the body `{}`. The call also answers `202` when nothing matched, and when you send no parameter at all. To confirm the deletion, call [Get a profile](https://releva.ai/documentation/reference/profiles/get-a-profile/): it answers `404`.

## Errors

Errors have one shape, `{ "message": "..." }`.

| Status | When                                      | Message                                                                                                           |
| ------ | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `400`  | No `authorization` header                 | `Authorization header is missing.`                                                                                |
| `400`  | The header is not `Bearer <token>`        | ``Authorization header is malformed. It should look like `Bearer <string>`.``                                     |
| `400`  | The token is not a UUID                   | `Authorization header contains an invalid Bearer token.`                                                          |
| `400`  | No shop has this key                      | `Domain with the provided secret key cannot be found.`                                                            |
| `400`  | Bad email                                 | `The 'email' field must be a valid e-mail.`                                                                       |
| `400`  | National phone number, for example `0888` | `phoneNumber must be a valid telephone number starting with + and international code, e.g. +1. Got 0888 instead.` |
| `400`  | Unknown parameter, for example `foo`      | `The object '' contains forbidden keys: 'foo'.`                                                                   |
| `402`  | The shop is disabled                      | `Domain is disabled. Please reach out to support@releva.ai to enable it.`                                         |
| `500`  | Unexpected error                          | `An internal error occurred.` Retry later.                                                                        |

## Limits

* One `profileId`, one `email` and one `phoneNumber` per request.
* Rate limits: none on this endpoint.

## Next steps

* [Export a profile’s data](https://releva.ai/documentation/reference/profiles/export-a-profiles-data/): Send the person a copy of their data before you delete it.
* [Edit a customer profile and add tags](https://releva.ai/documentation/guides/profiles/edit-a-profile/): Delete a single profile from the admin instead.
* [How customer profiles work](https://releva.ai/documentation/learn/profiles/how-profiles-work/): Learn which profiles are merged together and are deleted with it.