---
title: "v2_patch_prompts | Python SDK | AEO API"
description: "Update a prompt, change a set, or edit a topic. Archive a prompt to stop tracking it while keeping its history."
url: "https://aeoapi.dev/docs/sdks/python/v2-patch-prompts"
canonical: "https://aeoapi.dev/docs/sdks/python/v2-patch-prompts"
last_updated: "2026-11-30"
---

# v2_patch_prompts

Update a prompt, change a set, or edit a topic. Archive a prompt to stop tracking it while keeping its history.

See the REST reference for [`PATCH /v2/prompts`](https://aeoapi.dev/docs/api-reference#patch-v2-prompts).

## Signature

```
v2_patch_prompts(
    body: Mapping[str, Any],
    *,
    brand_id: str | None = None,
    website: str | None = None,
    idempotency_key: str | None = None,
    if_match: str | int | None = None,
) -> Response[Any]
```

## Parameters

**`body`**

Dictionary for the selected operation. See the REST reference for its required fields.

**`brand_id`**

Identifier for the brand.

**`website`**

Website for the selected brand or connection.

**`idempotency_key`**

Value for Idempotency-Key. For requests that require this header, the SDK generates a UUID if you omit it. Send the original value if your application repeats the same write.

**`if_match`**

Current revision as an integer, decimal string, or quoted numeric ETag. Required for edits that check the revision.

## Return value

For archive, response.data contains the prompt, including status and revision.

## Errors

- AeoApiError includes the HTTP status, error code and request ID. An invalid key raises UnauthenticatedError. Check the key’s scopes if you receive ForbiddenError.
- Invalid arguments can raise ValueError or TypeError before the SDK sends a request.
- AeoTransportError means the request could not reach the API after any allowed retries, or the response could not be read as JSON.
- PreconditionFailedError means the revision has changed. Read the current record before editing it again.
- For a conflict, read the error message before repeating the write. Check the saved record for a competing edit or a repeated request.

## Python example

```
import os
from aeo_sdk import AeoClient

with AeoClient(os.environ["AEO_API_KEY"], base_url=os.environ["AEO_API_BASE_URL"]) as client:
    response = client.v2_patch_prompts(
        body={
            'action': 'archive',
            'prompt_id': '00000000-0000-4000-8000-000000000001',
        },
        if_match=1,
    )
    print(response.body)
```

## Async example

```
import asyncio
import os
from aeo_sdk import AsyncAeoClient

async def main():
    async with AsyncAeoClient(os.environ["AEO_API_KEY"], base_url=os.environ["AEO_API_BASE_URL"]) as client:
        response = await client.v2_patch_prompts(
            body={
                'action': 'archive',
                'prompt_id': '00000000-0000-4000-8000-000000000001',
            },
            if_match=1,
        )
        print(response.body)

asyncio.run(main())
```

## Requests by feature

### Prompts and topics

- [Update a prompt](https://aeoapi.dev/docs/features/prompts-and-topics/patch-prompts-update)
- [Edit prompts in bulk](https://aeoapi.dev/docs/features/prompts-and-topics/patch-prompts-batch)
- [Assign prompt metadata](https://aeoapi.dev/docs/features/prompts-and-topics/patch-prompts-metadata)
- [Archive a prompt](https://aeoapi.dev/docs/features/prompts-and-topics/patch-prompts-archive)
- [Request prompt deletion](https://aeoapi.dev/docs/features/prompts-and-topics/patch-prompts-request-delete)
- [Approve a prompt set](https://aeoapi.dev/docs/features/prompts-and-topics/patch-prompts-set)
- [Save a topic](https://aeoapi.dev/docs/features/prompts-and-topics/patch-prompts-topic)
- [Remove a topic](https://aeoapi.dev/docs/features/prompts-and-topics/patch-prompts-topic-delete)

See [Python client setup](https://aeoapi.dev/docs/sdks/python) for the environment variables, response properties and retry settings.
