# Delete a company

> DELETE /api/v0/companies/{companyId}: delete one B2B company of your shop from your server. Its roles are kept.

`DELETE https://releva.ai/api/v0/companies/{companyId}` deletes one company of your shop.

## When to use it

Call it from your server when a company is closed or removed in your system. The profiles linked to the company are not deleted, and their roles are kept: to unlink them, call [Remove a profile from a company](https://releva.ai/documentation/reference/companies/remove-a-profile-from-a-company/) for each one.

## 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/delete-a-company/#errors)).

## Request

`DELETE /api/v0/companies/{companyId}`, where `{companyId}` is the id you sent to [Create or update companies](https://releva.ai/documentation/reference/companies/create-or-update-companies/). Percent-encode reserved characters in the id. No body. A request without an id (`DELETE /api/v0/companies/`) answers `404`.

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

## Response

`202 Accepted` with the body `{}`. The deletion is queued, and the company leaves **Data Platform › Companies** shortly after. An unknown id also answers `202`. Sending the company again with [Create or update companies](https://releva.ai/documentation/reference/companies/create-or-update-companies/) brings it back.

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

## Next steps

* [Remove a profile from a company](https://releva.ai/documentation/reference/companies/remove-a-profile-from-a-company/): Unlink the people who were linked to the deleted company.
* [Edit or delete a company](https://releva.ai/documentation/guides/companies/edit-a-company/): Delete a company from the admin instead.
* [Companies and roles](https://releva.ai/documentation/learn/companies/companies-and-roles/): Learn how deletes and updates behave.