---
title: "v2PostPrompts | TypeScript SDK | AEO API"
description: "Create a prompt for a market and intent. Other actions build suggestions, preview candidates or import a set."
url: "https://aeoapi.dev/docs/sdks/typescript/v2PostPrompts"
canonical: "https://aeoapi.dev/docs/sdks/typescript/v2PostPrompts"
last_updated: "2026-11-30"
---

# v2PostPrompts

Create a prompt for a market and intent. Other actions build suggestions, preview candidates or import a set.

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

## Signature

```
v2PostPrompts(
  body: Record<string, unknown>,
  options?: {
    signal?: AbortSignal;
    idempotencyKey?: string;
    hubspotAccessToken?: string;
  },
): Promise<ApiResponse<unknown>>
```

## Parameters

**`body`**

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

**`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.

## Return value

Promise\<ApiResponse\<unknown\>\>. For create, HTTP 201 returns the saved prompt in body.data. Keep its id, version and 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.

## 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" });

const body = {
  "action": "create",
  "category_ids": [
    "gcid:plumber"
  ],
  "intent": "evaluation",
  "market": {
    "city": "Chicago",
    "country": "US",
    "language": "en"
  },
  "text": "What should homeowners compare when choosing a plumber in Chicago?"
};
const response = await client.v2PostPrompts(body);
console.log(response.status, response.body);
```

## Requests by feature

### Prompts and topics

- [Create a prompt](https://aeoapi.dev/docs/features/prompts-and-topics/post-prompts-create)
- [Import prompts](https://aeoapi.dev/docs/features/prompts-and-topics/post-prompts-import)
- [Build prompts from a template](https://aeoapi.dev/docs/features/prompts-and-topics/post-prompts-build)
- [Generate prompt suggestions](https://aeoapi.dev/docs/features/prompts-and-topics/post-prompts-generate)
- [Preview local prompts](https://aeoapi.dev/docs/features/prompts-and-topics/post-prompts-preview-local)
- [Preview HubSpot questions](https://aeoapi.dev/docs/features/prompts-and-topics/post-prompts-preview-hubspot)
- [Preview questions from text](https://aeoapi.dev/docs/features/prompts-and-topics/post-prompts-preview-conversations)

See [TypeScript client setup](https://aeoapi.dev/docs/sdks/typescript) for authentication, timeouts and retry settings.
