---
title: "v2PatchPrompts | TypeScript SDK | AEO API"
description: "Change a tracked prompt, prompt set or topic. To revise a question, pass its prompt_id and new text with the current revision."
url: "https://aeoapi.dev/docs/sdks/typescript/v2PatchPrompts"
canonical: "https://aeoapi.dev/docs/sdks/typescript/v2PatchPrompts"
last_updated: "2026-11-30"
---

# v2PatchPrompts

Change a tracked prompt, prompt set or topic. To revise a question, pass its prompt_id and new text with the current revision.

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

## Signature

```
v2PatchPrompts(
  body: Record<string, unknown>,
  options?: {
    signal?: AbortSignal;
    brand_id?: string;
    website?: string | null;
    idempotencyKey?: string;
    ifMatch?: string | number;
  },
): Promise<ApiResponse<unknown>>
```

## Parameters

**`body`**

JSON object for this action. The example includes the fields for update.

**`options`**

Pass the named options in the signature. The selected action or view determines which fields are required.

**`options.signal`**

Optional AbortSignal to cancel the HTTP request.

**`options.idempotencyKey`**

The SDK generates a request key when you omit it. Pass the same key and body to retry this write in a separate call.

**`options.ifMatch`**

Pass the current revision as a number or quoted ETag.

## Return value

Promise\<ApiResponse\<unknown\>\>. An update returns the revised prompt, including data.text, data.version and data.revision.

## Errors

- The SDK throws AeoApiError if the API returns an error. Inspect status, code, fieldErrors and requestId.
- AeoTransportError means the request failed to connect or the client could not finish reading a successful response. Invalid JSON in a successful response throws SyntaxError. If you abort the request, the SDK throws the reason from the AbortSignal.
- For HTTP 422, check fieldErrors for the input field and validation message.
- A missing or invalid ifMatch raises Error before the request. Read the current revision before retrying a rejected update.

## TypeScript example

```
import { AeoClient } from "@aeoapi/aeo-sdk";

const apiKey = process.env.AEO_API_KEY;
if (!apiKey) throw new Error("Set AEO_API_KEY on your server.");
const client = new AeoClient(apiKey, { baseUrl: "https://api.aeoapi.dev" });

// Replace 1 with the current prompt revision.
// Substitute your own record IDs and values.
const body = {
  "action": "update",
  "prompt_id": "00000000-0000-4000-8000-000000000001",
  "text": "How should a homeowner compare plumbing services in Chicago?"
};
const response = await client.v2PatchPrompts(body, {
  "ifMatch": 1
});
console.log(response.status, response.body);
```

## 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 [TypeScript client setup](https://aeoapi.dev/docs/sdks/typescript) for authentication, timeouts and retry settings.
