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

# Delete a topic

> Delete a topic label with the ETag you last read. Prompts, answers and history are retained, and the prompts are detached from the deleted topic.

Deletes the label and detaches it from prompts. Prompts and their retained answers
are preserved. The operation requires no request body.

Requires an active Business, Agency Business or Enterprise plan. Use an API token with write access enabled. See [Writing data](https://docs.qwairy.co/developers/writing-data.md) for
idempotency, conditional requests and error handling.

**Authorization** `string` *required*

Bearer token for your team.

**If-Match** `string` *required*

Copy the complete `ETag` from the latest GET, including its quotes.

**brandId** `string` *required*

Workspace identifier. The workspace must belong to the token's team.

**keywordId** `string` *required*

Topic identifier within this workspace.

## Response

Returns `200` with `deleted: true` and `topicId`.
Deleting an already absent label in an accessible workspace also succeeds.
For an existing label, a stale ETag returns `412` without deleting it.

## Synthetic request and response

Use the ETag from [Get a topic](https://docs.qwairy.co/developers/endpoints/keywords/get.md). This example assumes `"4"`.

```bash theme={null}
curl -X DELETE "https://www.qwairy.co/api/v1/brands/$BRAND_ID/keywords/$TOPIC_ID" \
  -H "Authorization: Bearer $QWAIRY_API_TOKEN" \
  -H 'If-Match: "4"'
```

```json theme={null}
{
  "deleted": true,
  "topicId": "11111111-0000-4000-8000-000000000000"
}
```

## Errors

| Status | Code | Cause |
| - | - | - |
| 404 | `RESOURCE_NOT_FOUND` | Workspace is missing or inaccessible |
| 412 | `PRECONDITION_FAILED` | The existing label changed since your read |
| 428 | `PRECONDITION_REQUIRED` | `If-Match` is missing |

See [Error codes](https://docs.qwairy.co/developers/errors.md) for authentication, plan, idempotency
and server errors. On `429`, honor `Retry-After`; writes can return
`503 SERVICE_UNAVAILABLE` if the write limiter is unavailable.


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