# Delete merchant

> Deletes a merchant of your company that has no linked data. A merchant with history cannot be deleted: use status inactive.

Página: https://doc.rapidchargeback.com/en/canais/merchants/remover-merchant/

Deletes a merchant of your company. It only works for a merchant **with no linked data**: no transaction, alert, event, dispute, evidence or enrollment. It is meant to undo a registration made by mistake.

A merchant with history cannot be deleted. To mark that it left, save `status: "inactive"` with [Edit merchant](https://doc.rapidchargeback.com/en/canais/merchants/editar-merchant/); to stop receiving its alerts, [request the deactivation](https://doc.rapidchargeback.com/en/canais/enrollments/pedir-desativacao/) of its enrollments.

## Endpoint

```
DELETE https://api.rapidchargeback.com/api/v1/merchants/:merchant_id
```

## Authentication

```
Authorization: Basic base64(client_id:client_secret)
```

---

## URL parameters

| Param | Type | Description |
|---|---|---|
| `merchant_id` | string (UUID) | The merchant `id` |

---

## Request example

```bash
curl -X DELETE https://api.rapidchargeback.com/api/v1/merchants/00000000-0000-0000-0000-000000000001 \
  -H "Authorization: Basic Y2xpZW50X2lkOmNsaWVudF9zZWNyZXQ="
```

---

## Response

### Deleted

```
HTTP/1.1 204 No Content
```

No body.

### Merchant with history

```
HTTP/1.1 409 Conflict
```

```json
{
  "error": {
    "code": "MERCHANT_HAS_HISTORY",
    "message": "Merchant has data (transactions, alerts, events, disputes or enrollments) and cannot be deleted. Set its status to inactive and request deactivation of its enrollments instead"
  }
}
```

Nothing was deleted. As the message says, save `status: "inactive"` and request the deactivation of its enrollments (see above).

### Errors

| HTTP | Code | When |
|---|---|---|
| 404 | `MERCHANT_NOT_FOUND` | The merchant does not exist, belongs to another company, or the id is not a UUID |
| 409 | `MERCHANT_HAS_HISTORY` | The merchant has linked data |
| 403 | `KYB_NOT_APPROVED`, `COMPANY_NOT_ACTIVE`, `COMPANY_BLOCKED` | Company without an approved registration, inactive or blocked |
| 429 | `RATE_LIMIT_EXCEEDED` | More than 60 writes per minute |
| 503 | `SERVICE_UNAVAILABLE` | Temporarily unavailable: repeat after `Retry-After` |

---

## Notes

- **Repeating after a `503`:** if the merchant had already been deleted, the new call responds `404 MERCHANT_NOT_FOUND`.
- **Activity:** the deletion shows up in the dashboard Activity as made by the integration.
