> ## 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.

# Update a topic

> Rename a topic using the ETag you last read in If-Match. Prompt associations and retained answers are preserved when the name of the topic changes.

Renames one topic. Its prompt associations and retained answers are preserved.

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.

**text** `string` *required*

Topic text, 1 to 255 characters after trimming.

## Response

Returns `200` with a `topic` object in the same shape as
[Get a topic](https://docs.qwairy.co/developers/endpoints/keywords/get.md) and a new `ETag`. The mutation response has no
top-level `success` field. Treat versions as opaque values, not counters.

## Synthetic request and response

Read [the current topic](https://docs.qwairy.co/developers/endpoints/keywords/get.md) first. This example assumes its
ETag is `"4"`.

```bash theme={null}
curl -X PATCH "https://www.qwairy.co/api/v1/brands/$BRAND_ID/keywords/$TOPIC_ID" \
  -H "Authorization: Bearer $QWAIRY_API_TOKEN" \
  -H 'If-Match: "4"' \
  -H "Content-Type: application/json" \
  -d '{"text":"Pricing and plans"}'
```

```json theme={null}
{
  "topic": {
    "id": "11111111-0000-4000-8000-000000000000",
    "text": "Pricing and plans",
    "version": 5,
    "createdAt": "2026-09-01T09:00:00.000Z",
    "updatedAt": "2026-09-01T10:00:00.000Z"
  }
}
```

## Errors

| Status | Code | Cause |
| - | - | - |
| 400 | `INVALID_REQUEST` | Invalid topic fields |
| 404 | `RESOURCE_NOT_FOUND` | Workspace or topic is missing or inaccessible |
| 409 | `CONFLICT` | Another topic already uses this name |
| 412 | `PRECONDITION_FAILED` | The ETag is stale or invalid |
| 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.