## Delete a payer type

`DELETE /v1/person-types/:id`

Deletes a payer type from the online store list by ID. You cannot restore a deleted type through the API. Create a new type if needed.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Payer type ID, a non-negative integer. List: [`GET /v1/person-types`](./list.md) |

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/person-types/21" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/person-types/21" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/person-types/21', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

if (res.status === 204) {
  console.log('Payer type deleted')
}
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/person-types/21', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

if (res.status === 204) {
  console.log('Payer type deleted')
}
```

## Response

Successful deletion returns HTTP `204 No Content` with an empty body. Check the status code to confirm success.

## Response example

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

## Error response example

404 — the payer type has already been deleted:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "person type is not exists"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | The path `id` is not a non-negative integer |
| 404 | `ENTITY_NOT_FOUND` | The payer type with this `id` does not exist or has already been deleted. Message: `person type is not exists` |
| 422 | `BITRIX_ERROR` | A type with `code: "CRM_CONTACT"` or `code: "CRM_COMPANY"` is protected from deletion. Message: `person type code is protected`, `b24Code`: `200750000003` |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected deletion for another reason. The reason is in `message` |
| 403 | `BITRIX_ACCESS_DENIED` | The key owner lacks permission to modify payer types in Bitrix24 |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode |
| 403 | `SCOPE_DENIED` | The API key lacks the `sale` scope |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |

For the full list of common API errors, see [Error codes](/docs/errors).

## Known specifics

To deactivate your own type instead of deleting it, send its name and `active: false` in [`PATCH /v1/person-types/:id`](./update.md).

## See also

- [Payer types](/docs/entities/person-types)
- [Update a payer type](./update.md)
- [Get a payer type](./get.md)
- [Create a payer type](./create.md)
