> 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: Get a campaign's AI run eligibility

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

## Get a campaign's AI run eligibility

`GET /v1/campaigns/{campaignId}/ai-runs/eligibility` - operationId `ai-runs.get-eligibility`

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

Returns, for each flow, how many contacts a run would process now and, when none would, the check that stops them.
Send `flow` and `preview` together to also count what a reset or a new prompt would clear.

Errors:

- `400 validation_failed`: a parameter is not valid, or only one of `flow` and `preview` is set.
- `404 not_found`: the campaign is not in this workspace, or `segmentId` is not one of its segments.

Requires Campaigns view.

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `campaignId` | path | integer (int64) | yes | The campaign to read. |
| `segmentId` | query | integer (int64) | no | A segment of the campaign, to count only its contacts. Omit it for every segment. `0` is `400 validation_failed`, not "no segment". The preview always covers the whole campaign. |
| `flow` | query | string | no | The flow to preview: `qualification`, `personalization`, `rewriting` or `segmentation`. Send it with `preview`, or leave both out. |
| `preview` | query | string | no | What to preview: `reset` (what a reset of `flow` deletes) or `freshness` (what saving a new prompt for `flow` clears). Send it with `flow`, or leave both out. |
| `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 `AiRunEligibility`.

| Field | Type | Description |
| --- | --- | --- |
| `campaignId` | integer (int64) | The campaign read. |
| `flows` | array of AiRunFlowEligibility | One entry for each flow: `qualification`, `personalization`, `rewriting` and `segmentation`. |
| `preview` | AiRunInvalidationPreview | What the previewed change would clear. Omitted unless the request sent `flow` and `preview`. |

### Request

```bash
curl -X GET "https://api.ken.so/v1/campaigns/812/ai-runs/eligibility" \
  -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": {
    "campaignId": 812,
    "flows": [
      {
        "flow": "qualification",
        "eligibleCount": 1,
        "blockingGate": "campaign_processing_state",
        "blockingReason": "string"
      }
    ],
    "preview": {
      "flow": "string",
      "preview": "reset",
      "hasImpact": true,
      "cascadeFlows": [
        "string"
      ],
      "campaignStatus": "draft",
      "sendingStatus": "not_started",
      "emailsSent": 1,
      "message": "string",
      "impact": {
        "qualificationResponses": 1,
        "qualifiedFlags": 1,
        "segmentationReasoning": 1,
        "segmentationAssignmentsKept": 1,
        "segmentationAssignmentsReset": 1,
        "personalizationLines": 1,
        "personalizationLeads": 1,
        "rewritingLines": 1,
        "rewritingLeads": 1
      }
    }
  }
}
```

## Types

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

### AiRunFlowEligibility

How many contacts one flow would process now.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `flow` | string | no | The flow: `qualification`, `personalization`, `rewriting` or `segmentation`. |
| `eligibleCount` | integer (int32) | no | Contacts the flow would process if a run started now, only those in `segmentId` when it is set. |
| `blockingGate` | string | no | The check that left no contact eligible, a snake_case code such as `campaign_processing_state`. New codes can appear. Omitted when contacts are eligible. |
| `blockingReason` | string | no | Why no contact is eligible and what to change, for a person to read. Omitted with `blockingGate`. |

### AiRunInvalidationPreview

What a reset of a flow, or a new prompt for it, would clear across the campaign.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `flow` | string | no | The flow the preview starts from. |
| `preview` | string | no | The preview you asked for: `reset` or `freshness`. |
| `hasImpact` | boolean | no | True when the change would clear any stored output. `segmentationAssignmentsKept` does not count. |
| `cascadeFlows` | array of string | no | The flows the change clears, from `rewriting` back to the requested flow. |
| `campaignStatus` | string | no | The campaign's status now: `draft`, `building`, `ready`, `sending`, `paused`, `completed`, `error` or `archived`. |
| `sendingStatus` | string | no | The campaign's sending status now: `not_started`, `scheduled`, `sending`, `paused`, `completed`, `error`, `launching` or `archived`. |
| `emailsSent` | integer (int32) | no | Emails the campaign has sent so far. |
| `message` | string | no | A summary for a person: the flows the change clears and, for a campaign that sent, the emails already sent. |
| `impact` | AiRunInvalidationImpact | no | The counts the change would clear. |

### AiRunInvalidationImpact

What a previewed reset or prompt change would clear, by kind of output.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `qualificationResponses` | integer (int32) | no | Stored qualification answers that would be deleted. |
| `qualifiedFlags` | integer (int32) | no | Contacts marked qualified that would lose the mark. |
| `segmentationReasoning` | integer (int32) | no | Stored segmentation reasons that would be deleted. Only the `reset` preview counts them. |
| `segmentationAssignmentsKept` | integer (int32) | no | Contacts on a segment that keep it. Only the `freshness` preview counts them. |
| `segmentationAssignmentsReset` | integer (int32) | no | Contacts that would move back to the default segment. Only the `reset` preview counts them. |
| `personalizationLines` | integer (int32) | no | Personalized lines that would be deleted. |
| `personalizationLeads` | integer (int32) | no | Contacts whose personalized lines would be deleted. |
| `rewritingLines` | integer (int32) | no | Rewritten lines that would be deleted. |
| `rewritingLeads` | integer (int32) | no | Contacts whose rewritten lines would be deleted. |
