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

# AI runs: Reset an AI flow

> **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 runs](/docs/api/ai-runs.md). Authentication, workspaces and errors: [/docs.md](/docs.md).

## Reset an AI flow

`POST /v1/campaigns/{campaignId}/ai-runs/reset` - operationId `ai-runs.reset`

| Permission | Rate limit |
| --- | --- |
| Campaigns edit | 10 requests a day per workspace (Free plan: 1 a day) |

Clears a flow's output, and every later flow's, for every contact of the campaign, emailed or not, and cancels those
flows' running batches. The next AI run processes the contacts again. A segmentation reset also moves every contact
to the default segment. Each reset counts against a daily quota.

Errors:

- `400 validation_failed`: `flow` is not valid, or a segmentation reset finds no default segment.
- `404 not_found`: the campaign is not in this workspace.
- `429 rate_limited`: the daily reset quota is used up. Retry after `Retry-After` seconds.

Requires Campaigns edit.

[Try it on developer.ken.so](https://developer.ken.so/reference/#kenso-api/tag/ai-runs/POST/v1/campaigns/%7BcampaignId%7D/ai-runs/reset)

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `campaignId` | path | integer (int64) | yes | The campaign to reset. |
| `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 |
| --- | --- | --- | --- |
| `flow` | string | yes | The flow to reset: `qualification`, `personalization`, `rewriting` or `segmentation`. Kenso also resets every flow after it. Required. |

### Response 200

`data` is a `AiRunReset`.

| Field | Type | Description |
| --- | --- | --- |
| `flows` | array of string | The flows Kenso reset, listed from `rewriting` back to the requested flow. |
| `batchesCancelled` | integer (int32) | The campaign's AI batches in progress that Kenso cancelled. Always 0 on a reset for chosen contacts. |
| `runsCancelled` | integer (int32) | Provider fallback chains Kenso cancelled. Always 0 on a reset for chosen contacts. |
| `aiResponseLinesDeleted` | integer (int32) | AI lines Kenso deleted. |
| `aiResponsesDeleted` | integer (int32) | AI responses Kenso deleted. A response is one AI answer and holds the lines in `aiResponseLinesDeleted`. |
| `outreachStatusesRemoved` | integer (int32) | Contact progress marks for the reset flows that Kenso removed, so those contacts are eligible again. |
| `qualificationResponsesDeleted` | integer (int32) | Stored qualification answers Kenso deleted. 0 unless the reset covers qualification. |
| `segmentationReasoningDeleted` | integer (int32) | Stored segmentation reasons Kenso deleted. 0 unless the reset covers segmentation. |
| `contactsQualificationReset` | integer (int32) | Contacts whose qualification result Kenso cleared. 0 unless the reset covers qualification. |
| `contactsSegmentReset` | integer (int32) | Contacts Kenso moved back to the campaign's default segment. 0 unless the reset covers segmentation. |
| `contactsReset` | integer (int32) | Contacts a reset for chosen contacts cleared. Omitted on a campaign-wide reset. |
| `contactsSkipped` | array of AiRunResetSkippedContact | Listed contacts that a reset for chosen contacts left untouched, with the reason. Omitted on a campaign-wide reset. |

### Request

```bash
curl -X POST "https://api.ken.so/v1/campaigns/812/ai-runs/reset" \
  -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 '{
  "flow": "qualification"
}'
```

### Example response

```json
{
  "success": true,
  "data": {
    "flows": [
      "string"
    ],
    "batchesCancelled": 1,
    "runsCancelled": 1,
    "aiResponseLinesDeleted": 1,
    "aiResponsesDeleted": 1,
    "outreachStatusesRemoved": 1,
    "qualificationResponsesDeleted": 1,
    "segmentationReasoningDeleted": 1,
    "contactsQualificationReset": 1,
    "contactsSegmentReset": 1,
    "contactsReset": 1,
    "contactsSkipped": [
      {
        "contactId": 812,
        "reason": "string"
      }
    ]
  }
}
```

## Types

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

### AiRunResetSkippedContact

A contact a reset for chosen contacts left untouched.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `contactId` | integer (int64) | no | The contact id from the request. |
| `reason` | string | no | Why Kenso skipped it: `not_in_campaign`, `sent_or_exported` (already emailed or exported), `queued_to_send` (a send is queued) or `in_flight` (it is in an AI batch that has not finished). |
