> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qwoty.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Category

> Soft delete a product category

## Authorization

**Authorization** `string` *required*

Bearer token for authentication. Format: `Bearer qwoty_your_token`

## Path Parameters

**id** `string` *required*

Category UUID

## Behavior

This endpoint performs a **soft delete** by setting the `deleted_at` timestamp on the category. The category will no longer appear in standard API queries but is not permanently removed from the database.

> [!WARNING]
>
> Deletion is **blocked** if the category is referenced by active discounts. In
> that case, you will receive a `409 Conflict` error. You must first remove or
> update the discount references before deleting the category.

## Examples

```bash cURL theme={null}
curl -X DELETE https://qwoty.app/api/categories/550e8400-e29b-41d4-a716-446655440001 \
  -H "Authorization: Bearer qwoty_your_token"
```

```javascript JavaScript theme={null}
const categoryId = '550e8400-e29b-41d4-a716-446655440001'

const response = await fetch(`https://qwoty.app/api/categories/${categoryId}`, {
  method: 'DELETE',
  headers: {
    Authorization: 'Bearer qwoty_your_token',
  },
})

const data = await response.json()
```

```python Python theme={null}
import requests

category_id = '550e8400-e29b-41d4-a716-446655440001'

response = requests.delete(
    f'https://qwoty.app/api/categories/{category_id}',
    headers={
        'Authorization': 'Bearer qwoty_your_token'
    }
)

data = response.json()
```

## Response

**success** `boolean`

Indicates whether the request was successful

**data** `object`

Deletion confirmation

**Deletion Object**

**id** `string`

UUID of the deleted category

**deleted** `boolean`

Always `true` when deletion succeeds

```json 200 Success theme={null}
{
  "success": true,
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440001",
    "deleted": true
  }
}
```

## Error Responses

```json 404 Not Found theme={null}
{
  "error": "Category not found"
}
```

```json 409 Conflict - Referenced by Discounts theme={null}
{
  "error": "CATEGORY_REFERENCED_IN_DISCOUNT"
}
```

## Cascade Effects

When a category is deleted:

* Products linked to this category through `category_ids` retain the reference (soft delete doesn't cascade)
* Child categories (with `parent_category_id` pointing to this category) are **not** automatically deleted
* Price percentage rules scoped to this category remain intact

> [!TIP]
>
> To permanently remove all traces of a category, you should first: 1. Remove
> the category from all products (`category_ids` field) 2. Update or delete all
> discounts referencing this category 3. Reassign or delete child categories 4.
> Then delete the category


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.