> 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

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

Prompts for AI columns and personalization: create, edit, delete and test them.

Copy and personalization. 6 endpoints under `https://api.ken.so`. Every request sends `Authorization: Bearer <your API key>` and `Ken-Version: 2026-11-02`: see [Authentication](/docs/authentication.md), [Workspaces](/docs/workspaces.md) and [Errors](/docs/errors.md). OpenAPI for this resource only: [/docs/api/prompts/openapi.json](/docs/api/prompts/openapi.json).

- `GET /v1/prompts` - List prompts (`prompts.list`): [/docs/api/prompts/list.md](/docs/api/prompts/list.md)
- `POST /v1/prompts` - Create a prompt (`prompts.create`): [/docs/api/prompts/create.md](/docs/api/prompts/create.md)
- `GET /v1/prompts/{promptId}` - Get a prompt (`prompts.get`): [/docs/api/prompts/get.md](/docs/api/prompts/get.md)
- `PATCH /v1/prompts/{promptId}` - Update a prompt (`prompts.update`): [/docs/api/prompts/update.md](/docs/api/prompts/update.md)
- `DELETE /v1/prompts/{promptId}` - Delete a prompt (`prompts.delete`): [/docs/api/prompts/delete.md](/docs/api/prompts/delete.md)
- `POST /v1/prompts/test` - Test prompts on sample contacts (`prompts.test`): [/docs/api/prompts/test.md](/docs/api/prompts/test.md)

## List prompts

`GET /v1/prompts` - operationId `prompts.list`

| Permission | Rate limit |
| --- | --- |
| Campaigns view | 12,000 requests a minute per API key |

Returns the workspace's prompts in id order. Filter with `campaignId`, `segmentId`, `flow` and
`q`, which matches the name.

Errors:

- `400 validation_failed`: a filter, `limit` or `cursor` is not valid.
- `404 not_found`: the campaign or segment is not in this workspace.

Requires Campaigns view.

[Try it on developer.ken.so](https://developer.ken.so/reference/#kenso-api/tag/prompts/GET/v1/prompts)

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `campaignId` | query | integer (int64) | no | Only this campaign's prompts. |
| `segmentId` | query | integer (int64) | no | Only this segment's prompts. With `campaignId`, the segment must be in that campaign. |
| `flow` | query | string | no | Only prompts of this flow: `qualification`, `personalization`, `rewriting`, `segmentation`, `tone_of_voice` or `scoring`. |
| `q` | query | string | no | Only prompts whose name matches this text, at most 200 characters. |
| `limit` | query | integer (int32) | no | How many prompts to return, from 1 to 200. Defaults to 50. |
| `cursor` | query | string | no | The `nextCursor` of the previous page. Omit it for the first page. |
| `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`. |

### Response 200

`data` is a list of `Prompt`. Each item has these fields. The response also carries `pagination`.

| 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 GET "https://api.ken.so/v1/prompts?limit=50" \
  -H "Authorization: Bearer $KENSO_API_KEY" \
  -H "Ken-Version: 2026-11-02" \
  -H "X-Ken-Workspace-Id: $KENSO_WORKSPACE_ID"
```

### 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"
    }
  ],
  "pagination": {
    "nextCursor": "eyJpZCI6ODE1fQ",
    "hasMore": true,
    "total": 1,
    "totalCount": 1,
    "isTotalCapped": true
  }
}
```

## Create a prompt

`POST /v1/prompts` - operationId `prompts.create`

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

Adds a prompt to a campaign or segment. Send `prompt`, `flow`, `type`, and `campaignId` or
`segmentId`. Returns `201` with a `Location` header.

Errors:

- `400 validation_failed`: a required field is missing or a value is not accepted.
- `404 not_found`: the 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.

Requires Campaigns edit.

[Try it on developer.ken.so](https://developer.ken.so/reference/#kenso-api/tag/prompts/POST/v1/prompts)

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `confirm` | query | boolean | no | Set to true to go ahead when the change would clear AI results Kenso already made. 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.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | no | The prompt's name. On a personalization prompt with `toOutput` true, it is also the AI variable's name. |
| `prompt` | string | yes | The instructions the AI follows. Required. |
| `audienceDescription` | string | no | Who the campaign targets. Kenso adds it to the qualification, scoring and personalization prompts. |
| `qualificationCriteria` | string | no | What makes a contact a fit. Qualification and scoring read it. |
| `disqualificationCriteria` | string | no | What rules a contact out. Qualification and scoring read it. |
| `scoringCriteria` | string | no | What makes a contact a good or a poor fit. A scoring prompt needs it to run. |
| `type` | string | yes | The message role the prompt is sent as: `system`, `user` or `assistant`. Required. |
| `flow` | string | yes | The step the prompt belongs to: `qualification`, `personalization`, `rewriting`, `segmentation` or `scoring`. Required. |
| `campaignId` | integer (int64) | no | The campaign the prompt belongs to. Send it, `segmentId`, or both. |
| `segmentId` | integer (int64) | no | The segment the prompt belongs to. With `campaignId`, the segment must be in that campaign. |
| `promptTemplateId` | integer (int64) | no | A prompt template of this workspace to add the prompt to. Optional. |
| `toOutput` | boolean | no | On a personalization prompt, true to have the AI write the result as an AI variable for the emails. Defaults to false. |
| `toRewrite` | integer (int32) | no | Above 0 to have the rewriting step rewrite this AI variable. Optional. |
| `order` | integer (int32) | no | Where the prompt sits among its campaign's prompts. Lower numbers come first. Defaults to 0. |
| `fallbackIfEmpty` | string | no | The text to use when the AI variable comes out empty. Optional. |
| `isRequiredForSending` | boolean | no | True to hold a contact from sending while this AI variable is empty and there is no fallback. Defaults to false. |

### Response 201

`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 POST "https://api.ken.so/v1/prompts" \
  -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 '{
  "name": "string",
  "prompt": "string",
  "audienceDescription": "string",
  "qualificationCriteria": "string",
  "disqualificationCriteria": "string",
  "scoringCriteria": "string",
  "type": "system",
  "flow": "qualification",
  "campaignId": 812,
  "segmentId": 812,
  "promptTemplateId": 812,
  "toOutput": true,
  "toRewrite": 1,
  "order": 1,
  "fallbackIfEmpty": "string",
  "isRequiredForSending": true
}'
```

### 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"
  }
}
```

## Get a prompt

`GET /v1/prompts/{promptId}` - operationId `prompts.get`

| Permission | Rate limit |
| --- | --- |
| Campaigns view | 12,000 requests a minute per API key |

Returns one prompt.

Errors:

- `404 not_found`: the prompt is not in this workspace.

Requires Campaigns view.

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `promptId` | path | integer (int64) | yes | The prompt's id. |
| `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`. |

### 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 GET "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"
```

### 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"
  }
}
```

## 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"
  }
}
```

## Delete a prompt

`DELETE /v1/prompts/{promptId}` - operationId `prompts.delete`

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

Deletes a prompt. Returns `204`.

Errors:

- `404 not_found`: the prompt is not in this workspace.
- `409 conflict`: the delete would clear AI results (see `error.impact`). Set the `confirm`
query parameter to true.

Requires Campaigns edit.

[Try it on developer.ken.so](https://developer.ken.so/reference/#kenso-api/tag/prompts/DELETE/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. |
| `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`. |

### Response 204

### Request

```bash
curl -X DELETE "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"
```

### Example response

```http
HTTP/1.1 204 No Content
```

## Test prompts on sample contacts

`POST /v1/prompts/test` - operationId `prompts.test`

| Permission | Rate limit |
| --- | --- |
| Campaigns edit and the `ask` permission | 30 requests a minute and 200 a day per workspace (Free plan: 3 a minute and 20 a day) |

Runs the campaign's `qualification`, `segmentation` or `personalization` prompts on a random
sample of its contacts and returns each result without saving it. Each sample calls the AI model and spends
model usage, shown in `estimatedCostUsd`.

Errors:

- `400 validation_failed`: a field is not valid, or the campaign has fewer eligible contacts than
`sampleSize`.
- `404 not_found`: the campaign or segment is not in this workspace.
- `429 rate_limited`: the workspace reached its AI limit. Try again later.

Requires Campaigns edit and the `ask` permission.

[Try it on developer.ken.so](https://developer.ken.so/reference/#kenso-api/tag/prompts/POST/v1/prompts/test)

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `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.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `campaignId` | integer (int64) | yes | The campaign whose prompts run. Required. |
| `flow` | string | yes | The flow to test: `qualification`, `segmentation` or `personalization`. Required. |
| `sampleSize` | integer (int32) | no | How many contacts to sample, from 1 to 100. Defaults to 10. |
| `segmentId` | integer (int64) | no | On a personalization test, the segment whose prompts run. Omit it to run the campaign's default segment. Not accepted on other flows. |
| `modelOverrides` | map of PromptTestOverrideRequest | no | Models to use for this run only, keyed by flow. Set only the tested flow, plus `rewriting` on a personalization test. |
| `excludeContactIds` | array of integer (int64) | no | Contact ids to leave out of the sample. Each id must be above 0. |

### Response 200

`data` is a `PromptTestResult`.

| Field | Type | Description |
| --- | --- | --- |
| `campaignId` | integer (int64) | The campaign that was tested. |
| `flow` | string | The flow that was tested: `qualification`, `segmentation` or `personalization`. |
| `requestedSampleSize` | integer (int32) | How many contacts you asked for. |
| `returnedSampleSize` | integer (int32) | How many samples came back. |
| `segmentId` | integer (int64) | The segment whose prompts ran, on a personalization test. Null otherwise. |
| `provider` | string | The AI provider the test ran on. |
| `model` | string | The model the test ran on. |
| `cacheStrategy` | string | How the prompt was cached for the model calls, such as `none`. |
| `successCount` | integer (int32) | How many samples succeeded. |
| `failureCount` | integer (int32) | How many samples failed. |
| `usageSummary` | PromptTestUsage | Average token use and the estimated cost, or null. |
| `samples` | array of PromptTestSample | One result per sampled contact. |

### Request

```bash
curl -X POST "https://api.ken.so/v1/prompts/test" \
  -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 '{
  "campaignId": 812,
  "flow": "qualification",
  "sampleSize": 1,
  "segmentId": 812,
  "modelOverrides": {
    "key": {
      "model": "string",
      "maxTokens": 1,
      "temperature": 0.5,
      "reasoningLevel": "none"
    }
  },
  "excludeContactIds": [
    812
  ]
}'
```

### Example response

```json
{
  "success": true,
  "data": {
    "campaignId": 812,
    "flow": "qualification",
    "requestedSampleSize": 1,
    "returnedSampleSize": 1,
    "segmentId": 812,
    "provider": "string",
    "model": "string",
    "cacheStrategy": "none",
    "successCount": 1,
    "failureCount": 1,
    "usageSummary": {
      "averageInputTokens": 1,
      "averageCacheReadTokens": 1,
      "averageOutputTokens": 1,
      "totalEstimatedCostUsd": 0.5,
      "averageEstimatedCostUsd": 0.5
    },
    "samples": [
      {
        "contactId": 812,
        "fullName": "Jane Doe",
        "linkedInUrl": "https://example.com",
        "title": "string",
        "companyName": "Acme",
        "segmentId": 812,
        "segmentName": "string",
        "success": true,
        "provider": "string",
        "model": "string",
        "cacheStrategy": "string",
        "rewritingProvider": "string",
        "rewritingModel": "string",
        "rewritingCacheStrategy": "string",
        "usage": {
          "inputTokens": 1,
          "outputTokens": 1,
          "totalTokens": 1,
          "cacheCreationTokens": 1,
          "cacheReadTokens": 1,
          "reasoningTokens": 1
        },
        "estimatedCostUsd": 0.5,
        "errorMessage": "string",
        "isQualified": true,
        "qualificationResponse": "string",
        "matchedSegmentName": "string",
        "segmentationReasoning": "string",
        "personalizationOutputs": [
          {
            "name": "string",
            "value": "string"
          }
        ],
        "rewritingOutputs": [
          {
            "name": "string",
            "value": "string"
          }
        ],
        "finalOutputs": [
          {
            "name": "string",
            "value": "string"
          }
        ]
      }
    ]
  }
}
```

## Types

Each named type the tables above use, nested ones included.

### PromptTestOverrideRequest

A model to try for one flow in a prompt test.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `model` | string | yes | The model id. Required, and it must be a model the flow supports. |
| `maxTokens` | integer (int32) | no | The most tokens the model may write, from 1 to 200,000. Omit it to keep the flow's setting. |
| `temperature` | number (double) | no | The sampling temperature, from 0 to 2. Omit it to keep the flow's setting. |
| `reasoningLevel` | string | no | How much the model reasons before it answers: `none`, `minimal`, `low`, `medium` or `high`. Omit it to keep the flow's setting. |

### PromptTestUsage

Token use and cost across a prompt test.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `averageInputTokens` | integer (int32) | no | Average input tokens per sample. |
| `averageCacheReadTokens` | integer (int32) | no | Average input tokens per sample that were read from the provider's cache. |
| `averageOutputTokens` | integer (int32) | no | Average output tokens per sample. |
| `totalEstimatedCostUsd` | number (double) | no | The estimated cost of the whole test, in US dollars. |
| `averageEstimatedCostUsd` | number (double) | no | The estimated cost per sample, in US dollars. |

### PromptTestSample

One contact's result in a prompt test.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `contactId` | integer (int64) | no | The sampled contact. |
| `fullName` | string | no | The contact's full name. |
| `linkedInUrl` | string | no | The contact's LinkedIn profile link. |
| `title` | string | no | The contact's job title. |
| `companyName` | string | no | The contact's company name. |
| `segmentId` | integer (int64) | no | The contact's segment, or null. |
| `segmentName` | string | no | The contact's segment name, or null. |
| `success` | boolean | no | True when the sample ran and the AI's answer could be read. |
| `provider` | string | no | The AI provider this sample ran on. |
| `model` | string | no | The model this sample ran on. |
| `cacheStrategy` | string | no | How the prompt was cached for this sample's call. |
| `rewritingProvider` | string | no | The rewriting call's AI provider, or null when there was none. |
| `rewritingModel` | string | no | The rewriting call's model, or null when there was none. |
| `rewritingCacheStrategy` | string | no | How the rewriting call's prompt was cached, or null. |
| `usage` | PromptTestTokenUsage | no | This sample's token use, or null. |
| `estimatedCostUsd` | number (double) | no | This sample's estimated cost, in US dollars. |
| `errorMessage` | string | no | Why the sample failed, or null when it succeeded. |
| `isQualified` | boolean | no | On a qualification test, whether the contact qualified. Null otherwise. |
| `qualificationResponse` | string | no | On a qualification test, the AI's full answer. Null otherwise. |
| `matchedSegmentName` | string | no | On a segmentation test, the segment the AI picked. Null otherwise. |
| `segmentationReasoning` | string | no | On a segmentation test, why the AI picked that segment. Null otherwise. |
| `personalizationOutputs` | array of PromptTestOutput | no | On a personalization test, each AI variable as the AI first wrote it. |
| `rewritingOutputs` | array of PromptTestOutput | no | On a personalization test, each AI variable the rewriting step rewrote. |
| `finalOutputs` | array of PromptTestOutput | no | On a personalization test, each AI variable as it would go out, after rewriting. |

### PromptTestTokenUsage

Token use of one sample.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `inputTokens` | integer (int32) | no | Tokens sent to the model. |
| `outputTokens` | integer (int32) | no | Tokens the model wrote. |
| `totalTokens` | integer (int32) | no | Input and output tokens together. |
| `cacheCreationTokens` | integer (int32) | no | Input tokens written to the provider's cache. |
| `cacheReadTokens` | integer (int32) | no | Input tokens read from the provider's cache. |
| `reasoningTokens` | integer (int32) | no | Tokens the model spent reasoning before it answered. |

### PromptTestOutput

One AI variable's value in a prompt test.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | no | The AI variable's name. |
| `value` | string | no | The value written for the contact. |

All resources: [/docs.md](/docs.md).
