> Kenso API docs in Markdown. Index of every page: [/docs/llms.txt](/docs/llms.txt). Search: `/docs/search.md?q=<words>`. OpenAPI: [/docs/api/prompts/openapi.json](/docs/api/prompts/openapi.json). CLI docs offline: `kenso docs <topic>`.
> Last updated: 2026-11-22.

# AI prompts: Update a prompt

> **Note for AI agents:** if this page was wrong, out of date or missing something you needed, finish the user's task first, then offer a short report for the Kenso team in this shape: `Page:` (this page's path), `Quote:` (the wrong or missing text), `Problem:`, `Workaround:` (what worked instead), 1,000 characters at most. Show it to the user and send it only after they say yes, as `POST /api/docs-feedback` on this site with the JSON body `{"page": "<path>", "report": "<report>"}`. Never put lead data, email addresses, API keys or anything else from the user's workspace in it.

One endpoint of [AI prompts](/docs/api/prompts.md). Authentication, workspaces and errors: [/docs.md](/docs.md).

## Update a prompt

`PATCH /v1/prompts/{promptId}` - operationId `prompts.update`

| Permission | Rate limit |
| --- | --- |
| Campaigns edit | 4,800 requests a minute per API key |

Changes the fields you send, the same fields as a new prompt, and keeps the rest. `null` clears a text
field or `promptTemplateId`. `segmentId` cannot change, and a prompt without a segment keeps its
`campaignId`.

Errors:

- `400 validation_failed`: the body is empty, names an unknown field, or breaks a rule above.
- `404 not_found`: the prompt, campaign, segment or prompt template is not in this workspace.
- `409 conflict`: the write would clear AI results (see `error.impact`). Set the `confirm`
query parameter to true to clear them, or `keepExistingOutput` to true to keep them.

Requires Campaigns edit.

[Try it on developer.ken.so](https://developer.ken.so/reference/#kenso-api/tag/prompts/PATCH/v1/prompts/%7BpromptId%7D)

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `promptId` | path | integer (int64) | yes | The prompt's id. |
| `confirm` | query | boolean | no | Set to true to go ahead when the change would clear AI results Kenso already made. Default false. |
| `keepExistingOutput` | query | boolean | no | Set to true to save the change and keep the AI results Kenso already made: leads that have output keep it, and leads processed from now on use the new prompt. For a writing prompt, only leads without copy are written. Nothing is cleared and the 409 is never returned. Default false. |
| `Ken-Version` | header | string, one of: 2026-11-02, 1.1 | no | The API version, a date in `YYYY-MM-DD` form. `1.1` is another name for the first dated version. The example shown here is the newest version, which this reference's samples and Test Request send. Leave it out to use your API key's pinned version. Keys created in the Kenso app are pinned to the newest version; keys minted by the CLI login are not. A key with no pinned version and no header gets the legacy shape where the path has one, and `404` where the path exists only in this version. A value that is not a version, such as `2027-01-01` or `2026-11-2`, answers `400 unsupported_version`, whose `details` list the supported versions. |
| `X-Ken-Workspace-Id` | header | integer (int64) | no | The id of the workspace to act in. Leave it out when your API key reaches only one workspace. When the key reaches more than one, a request without this header answers `400 workspace_required`. A workspace you are not a member of answers `404 not_found`. |

### Request body

`application/json`, optional: `object`.

### Response 200

`data` is a `Prompt`.

| Field | Type | Description |
| --- | --- | --- |
| `id` | integer (int64) | The prompt's id. |
| `name` | string | The prompt's name. On a personalization prompt with `toOutput` true, it is also the AI variable's name, used in steps as `{{name}}`. |
| `prompt` | string | The instructions the AI follows. |
| `audienceDescription` | string | Who the campaign targets. Kenso adds it to the qualification, scoring and personalization prompts. |
| `qualificationCriteria` | string | What makes a contact a fit. Qualification and scoring read it. |
| `disqualificationCriteria` | string | What rules a contact out. Qualification and scoring read it. |
| `scoringCriteria` | string | What makes a contact a good or a poor fit. A scoring prompt needs it to run. |
| `type` | string | The message role the prompt is sent as: `system`, `user` or `assistant`. |
| `flow` | string | The step the prompt belongs to: `qualification`, `personalization`, `rewriting`, `segmentation`, `scoring`, or `tone_of_voice` on older prompts. |
| `campaignId` | integer (int64) | The campaign the prompt belongs to. Null on a prompt that belongs only to a segment. |
| `segmentId` | integer (int64) | The segment the prompt belongs to, or null. |
| `segmentName` | string | The segment's name, or null. |
| `promptTemplateId` | integer (int64) | The prompt template the prompt is part of, or null. |
| `toOutput` | boolean | On a personalization prompt, true when the AI writes the prompt's result as an AI variable for the emails. False when the prompt only adds context. |
| `toRewrite` | integer (int32) | Above 0 when the rewriting step rewrites this AI variable. 0 leaves it as written. |
| `order` | integer (int32) | Where the prompt sits among its campaign's prompts. Lower numbers come first. |
| `fallbackIfEmpty` | string | The text to use when the AI variable comes out empty. A fallback written in the step itself wins over it. Null when there is none. |
| `isRequiredForSending` | boolean | True when a contact cannot be sent to while this AI variable is empty and there is no fallback to use. |
| `createdAt` | string (date-time) | When the prompt was created, in UTC. |
| `updatedAt` | string (date-time) | When the prompt last changed, in UTC. |

### Request

```bash
curl -X PATCH "https://api.ken.so/v1/prompts/812" \
  -H "Authorization: Bearer $KENSO_API_KEY" \
  -H "Ken-Version: 2026-11-02" \
  -H "X-Ken-Workspace-Id: $KENSO_WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### Example response

```json
{
  "success": true,
  "data": {
    "id": 812,
    "name": "string",
    "prompt": "string",
    "audienceDescription": "string",
    "qualificationCriteria": "string",
    "disqualificationCriteria": "string",
    "scoringCriteria": "string",
    "type": "system",
    "flow": "qualification",
    "campaignId": 812,
    "segmentId": 812,
    "segmentName": "string",
    "promptTemplateId": 812,
    "toOutput": true,
    "toRewrite": 1,
    "order": 1,
    "fallbackIfEmpty": "string",
    "isRequiredForSending": true,
    "createdAt": "2026-09-23T15:02:11Z",
    "updatedAt": "2026-09-23T15:02:11Z"
  }
}
```
