# Remove a profile from a company

> DELETE /api/v0/roles/{companyId}/{emailOrPhone}: unlink one profile from one B2B company, from your server. The profile and the company are kept.

`DELETE https://releva.ai/api/v0/roles/{companyId}/{emailOrPhone}` removes the link between one profile and one company. The profile and the company are kept.

## When to use it

Call it from your server when a person leaves a company in your system, or after you delete a company with [Delete a company](https://releva.ai/documentation/reference/companies/delete-a-company/), which keeps its links.

## 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/companies/remove-a-profile-from-a-company/#errors)).

## Request

`DELETE /api/v0/roles/{companyId}/{emailOrPhone}`. No body.

| Path part        | Notes                                                                                                                                                             |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `{companyId}`    | The company’s id.                                                                                                                                                 |
| `{emailOrPhone}` | Read as an email address when it contains `@`, otherwise as a phone number. A phone number must be the stored international form; send its `+` as is or as `%2B`. |

```plaintext
curl -X DELETE 'https://releva.ai/api/v0/roles/DEMO-1001/maria@example.com' \
  -H "authorization: Bearer $RELEVA_SECRET_KEY" \
  -H 'content-type: application/json'
```

By phone number:

```plaintext
curl -X DELETE 'https://releva.ai/api/v0/roles/DEMO-1001/%2B15555550199' \
  -H "authorization: Bearer $RELEVA_SECRET_KEY" \
  -H 'content-type: application/json'
```

The older path `DELETE /api/v0/companies/{companyId}/{emailOrPhone}` does not exist and answers `404`.

## Response

`202 Accepted` with the body `{}`. The removal is queued and shows in the admin shortly after. If no profile matches, nothing changes and the response is still `202`.

## 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.`                        |
| `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 profile and one company per request.
* Rate limits: none on this endpoint.

## Next steps

* [Link profiles to companies](https://releva.ai/documentation/reference/companies/link-profiles-to-companies/): Link the person again, or to another company.
* [Companies and roles](https://releva.ai/documentation/learn/companies/companies-and-roles/): Learn how links, roles and deletes behave.