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

# Segments: Restore a segment version

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

## Restore a segment version

`POST /v1/segments/{segmentId}/versions/{versionId}/restore` - operationId `segments.restore-version`

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

Brings the segment back to a saved version and saves a new version that records the restore. Kenso also
brings back the segment's AI prompts, email sequence and LinkedIn sequence, each to the latest version it had
when the target version was saved. `children` reports what happened to each of them.

Set `dryRun` to true to see what a restore would do without changing anything. The response then carries the
target `version`, its `snapshot`, and each child with the snapshot it would restore.

When the restore would clear AI output already generated for the campaign, Kenso answers `409 conflict` with
`error.impact`. Send the call again with `confirm` set to true to go ahead.

Errors:

- `400 validation_failed`: a restored step breaks today's sequence rules.
- `400 validation_failed`: on an A/B test campaign that is scheduled, launching, sending or paused, the active segments' percentages would not add up to 100.
- `404 not_found`: the segment does not exist in this workspace, or the version is not one of its versions.
- `409 conflict` with `error.impact`: the restore would clear AI output and `confirm` is not true.
- `409 conflict`: another version save for this segment is running. Retry shortly.

Requires Campaigns edit.

[Try it on developer.ken.so](https://developer.ken.so/reference/#kenso-api/tag/segments/POST/v1/segments/%7BsegmentId%7D/versions/%7BversionId%7D/restore)

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `segmentId` | path | integer (int64) | yes | The segment's id. |
| `versionId` | path | integer (int64) | yes | The id of the version to restore. |
| `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 |
| --- | --- | --- | --- |
| `confirm` | boolean | no | Set to true to restore even when the restore would clear AI output already generated for the campaign. Without it, such a restore answers `409 conflict` with `error.impact`. Defaults to false. |
| `dryRun` | boolean | no | Set to true to see what the restore would do without changing anything. Defaults to false. |

### Response 200

`data` is a `SegmentRestore`.

| Field | Type | Description |
| --- | --- | --- |
| `dryRun` | boolean | True when this was a dry run and nothing changed. |
| `newVersionNumber` | integer (int32) | The number of the new segment version that records the restore. Null on a dry run, or when Kenso could not record the version. |
| `versionWarning` | string | Set when the restore was applied but Kenso could not record the segment's new version, or when a part in `children` has a `versionWarning`. Null otherwise. |
| `version` | SegmentVersion | The version a dry run would restore. Null on an applied restore. |
| `snapshot` | SegmentSnapshot | The segment's settings and filters in the version a dry run would restore. Null on an applied restore. |
| `children` | array of SegmentVersionChild | What happened, or would happen, to the segment's email sequence, AI prompts and LinkedIn sequence. |

### Request

```bash
curl -X POST "https://api.ken.so/v1/segments/812/versions/812/restore" \
  -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 '{
  "confirm": false,
  "dryRun": true
}'
```

### Example response

```json
{
  "success": true,
  "data": {
    "dryRun": true,
    "version": {
      "id": 1884,
      "versionNumber": 4,
      "createdAt": "2026-10-14T09:41:27Z",
      "createdByUserId": 1093,
      "createdByEmail": "jordan.patel@northwind-outbound.example.com",
      "isRevert": false
    },
    "snapshot": {
      "schemaVersion": 1,
      "segment": {
        "name": "Engineering leaders",
        "description": "VPs and heads of engineering at B2B SaaS companies with 50 to 500 employees.",
        "isActive": true,
        "sortOrder": 1,
        "segmentationType": "manual",
        "status": "done"
      },
      "filterCriteria": {
        "titles": "[\"VP of Engineering\",\"Head of Engineering\"]",
        "seniorityLevels": "[\"VP\",\"Director\"]",
        "companyHeadcountMin": 50,
        "companyHeadcountMax": 500
      }
    },
    "children": [
      {
        "kind": "email_sequence",
        "parentId": 2210,
        "status": "reverted",
        "versionId": 3302,
        "versionNumber": 6,
        "createdAt": "2026-10-14T09:41:27Z"
      }
    ]
  }
}
```

## Types

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

### SegmentVersion

A saved version of a segment, without its content.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer (int64) | no | The version's id. |
| `versionNumber` | integer (int32) | no | The version's number. Each new version of the segment gets the next number. |
| `createdAt` | string (date-time) | no | When the version was saved, in UTC (ISO 8601). |
| `createdByUserId` | integer (int64) | no | The id of the member who saved the version. Null when unknown. |
| `createdByEmail` | string | no | The email address of the member who saved the version. Null when unknown. |
| `isRevert` | boolean | no | True when a restore created this version. |
| `revertedFromVersionId` | integer (int64) | no | The id of the version that was restored. Null unless `isRevert` is true. |
| `revertedFromVersionNumber` | integer (int32) | no | The number of the version that was restored. Null unless `isRevert` is true. |
| `revertedFromCreatedAt` | string (date-time) | no | When the restored version was saved, in UTC (ISO 8601). Null unless `isRevert` is true. |

### SegmentSnapshot

A copy of a segment's settings and filters as they were when a version was saved.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `schemaVersion` | integer (int32) | no | The format version of the snapshot. Kenso raises it when the snapshot's layout changes. |
| `segment` | SegmentSnapshotHeader | no | The segment's settings. |
| `filterCriteria` | CampaignSegmentFilterCriteriaSnapshot | no | The segment's filters. Null when the segment had none. |

### SegmentVersionChild

What a segment restore did, or would do, to one part of the segment: its email sequence, its AI prompts or its LinkedIn sequence.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | string | no | The part of the segment: `email_sequence`, `prompt_bundle` (the AI prompts) or `linked_in_sequence`. |
| `parentId` | integer (int64) | no | The email sequence's id for `email_sequence`, and the segment's id for the other kinds. |
| `status` | string | no | The outcome. `reverted` means the part is, or would be, restored. The other values leave the part as it is: `no_baseline_yet` (the part has no saved versions), `evicted_by_retention` (the version it had then was removed because Kenso keeps a limited number of versions), `child_newer_than_target` (every saved version of the part is newer than the target), `skipped_empty_snapshot` (that version has no steps while the live part has some), `skipped_invalid_anchor` (a LinkedIn step is timed from an email step the restored email sequence does not have), `skipped_engagement_not_enabled` and `skipped_voice_notes_not_enabled` (that version has LinkedIn engagement or voice note steps while the feature is off for the workspace). |
| `versionId` | integer (int64) | no | The id of the part's version the restore would use. Set on a dry run only. Null when there is none. |
| `versionNumber` | integer (int32) | no | The number of the part's version the restore would use. Set on a dry run only. Null when there is none. |
| `createdAt` | string (date-time) | no | When the part's version the restore would use was saved, in UTC (ISO 8601). Set on a dry run only. Null when there is none. |
| `newVersionNumber` | integer (int32) | no | The number of the new version the restore added to the part. Set on an applied restore that restored the part. Null otherwise. |
| `versionWarning` | string | no | Why the part was skipped, or a note that the part was restored but Kenso could not record its new version. Null when there is nothing to report. |
| `snapshot` | object | no | On a dry run, the content of the part's version: its email steps, AI prompts or LinkedIn steps, depending on `kind`. Absent on an applied restore. |

### SegmentSnapshotHeader

A segment's settings as they were when a version was saved.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | no | The segment's name. |
| `description` | string | no | The segment's description. Null when it had none. |
| `isActive` | boolean | no | True when the segment was on. |
| `sortOrder` | integer (int32) | no | The segment's display position among the campaign's segments. Null when it had none. |
| `segmentationType` | string | no | `manual`, `ai` or `ab_test`. Null when the segment had no type. |
| `abTestPercentage` | integer (int32) | no | The share of the campaign's contacts an `ab_test` segment took, from 1 to 100. Null on other types. |
| `status` | string | no | The segment's processing status: `draft`, `to_scrape`, `in_progress`, `scraped`, `done` or `error`. |

### CampaignSegmentFilterCriteriaSnapshot

The segment's filters as a version saved them, one flat field per filter. List filters are JSON-encoded array strings, such as `["CEO","Founder"]`, and each range filter is split into a lower and an upper bound.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `fullNameContains` | string | no | Text the contact's full name must contain, ignoring case. Null when the version has no such filter. |
| `fullNameNotContains` | string | no | Text the contact's full name must not contain, ignoring case. Null when the version has no such filter. |
| `lastJobTitleContains` | string | no | Text the contact's last job title must contain, ignoring case. Null when the version has no such filter. |
| `lastJobTitleNotContains` | string | no | Text the contact's last job title must not contain, ignoring case. Null when the version has no such filter. |
| `summaryContains` | string | no | The `summaryContains` filter. Null when the version has no such filter. |
| `profileStateContains` | string | no | The `profileState` filter: text the contact's state or region must contain. Null when the version has no such filter. |
| `profileCityContains` | string | no | The `profileCity` filter: text the contact's city must contain. Null when the version has no such filter. |
| `skillsContains` | string | no | The `skillsContains` filter. Null when the version has no such filter. |
| `certificationsContains` | string | no | The `certificationsContains` filter. Null when the version has no such filter. |
| `titles` | string | no | The `titles` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `excludeTitles` | string | no | The `excludeTitles` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `headlines` | string | no | The `headlines` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `excludeHeadlines` | string | no | The `excludeHeadlines` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `seniorityLevels` | string | no | The `seniorityLevels` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `excludeSeniorityLevels` | string | no | The `excludeSeniorityLevels` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `functions` | string | no | The `functions` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `excludeFunctions` | string | no | The `excludeFunctions` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `employmentTypes` | string | no | The `employmentTypes` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `profileCountries` | string | no | The `profileCountries` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `excludeProfileCountries` | string | no | The `excludeProfileCountries` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `languages` | string | no | The `languages` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `emailValidity` | string | no | The `emailValidity` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `emailProviders` | string | no | The `emailProviders` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `excludeEmailProviders` | string | no | The `excludeEmailProviders` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `isDecisionMaker` | boolean | no | The `isDecisionMaker` filter. Null when the version has no such filter. |
| `changedJobRecently` | boolean | no | The `changedJobRecently` filter. Null when the version has no such filter. |
| `isPersonalEmail` | boolean | no | The `isPersonalEmail` filter. Null when the version has no such filter. |
| `hasLinkedInUrl` | boolean | no | The `hasLinkedInUrl` filter. Null when the version has no such filter. |
| `hasPhone` | boolean | no | The `hasPhone` filter. Null when the version has no such filter. |
| `hasValidPhone` | boolean | no | The `hasValidPhone` filter. Null when the version has no such filter. |
| `yearsOfExperienceMin` | number (float) | no | The lower bound of the `yearsOfExperience` filter. Null when the version has no such filter. |
| `yearsOfExperienceMax` | number (float) | no | The upper bound of the `yearsOfExperience` filter. Null when the version has no such filter. |
| `yearsInCurrentRoleMin` | number (float) | no | The lower bound of the `yearsInCurrentRole` filter. Null when the version has no such filter. |
| `yearsInCurrentRoleMax` | number (float) | no | The upper bound of the `yearsInCurrentRole` filter. Null when the version has no such filter. |
| `yearsInCurrentCompanyMin` | number (float) | no | The lower bound of the `yearsInCurrentCompany` filter. Null when the version has no such filter. |
| `yearsInCurrentCompanyMax` | number (float) | no | The upper bound of the `yearsInCurrentCompany` filter. Null when the version has no such filter. |
| `companyDomainContains` | string | no | The `companyDomainContains` filter. Null when the version has no such filter. |
| `companyDescriptionContains` | string | no | The `companyDescriptionContains` filter. Null when the version has no such filter. |
| `companySpecialitiesContains` | string | no | The `companySpecialitiesContains` filter. Null when the version has no such filter. |
| `companyHqStateContains` | string | no | The `companyHqState` filter: text the company headquarters state or region must contain. Null when the version has no such filter. |
| `companyHqCityContains` | string | no | The `companyHqCity` filter: text the company headquarters city must contain. Null when the version has no such filter. |
| `companyNames` | string | no | The `companyNames` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `excludeCompanyNames` | string | no | The `excludeCompanyNames` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `industries` | string | no | The `industries` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `excludeIndustries` | string | no | The `excludeIndustries` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `companyTypes` | string | no | The `companyTypes` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `lastFundingRounds` | string | no | The `lastFundingRounds` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `technologies` | string | no | The `technologies` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `excludeTechnologies` | string | no | The `excludeTechnologies` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `companyHqCountries` | string | no | The `companyHqCountries` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `excludeCompanyHqCountries` | string | no | The `excludeCompanyHqCountries` filter, as a JSON-encoded array string. Null when the version has no such filter. |
| `companyHeadcountMin` | integer (int32) | no | The lower bound of the `companyHeadcount` filter. Null when the version has no such filter. |
| `companyHeadcountMax` | integer (int32) | no | The upper bound of the `companyHeadcount` filter. Null when the version has no such filter. |
| `companyFollowersMin` | integer (int32) | no | The lower bound of the `companyFollowers` filter. Null when the version has no such filter. |
| `companyFollowersMax` | integer (int32) | no | The upper bound of the `companyFollowers` filter. Null when the version has no such filter. |
| `companyFoundedYearMin` | integer (int32) | no | The lower bound of the `companyFoundedYear` filter. Null when the version has no such filter. |
| `companyFoundedYearMax` | integer (int32) | no | The upper bound of the `companyFoundedYear` filter. Null when the version has no such filter. |
| `totalFundingMin` | integer (int64) | no | The lower bound of the `totalFunding` filter. Null when the version has no such filter. |
| `totalFundingMax` | integer (int64) | no | The upper bound of the `totalFunding` filter. Null when the version has no such filter. |
| `doNotContact` | boolean | no | The `doNotContact` filter. Null when the version has no such filter. |
| `createdFrom` | string (date-time) | no | The start of the `createdAt` filter. Null when the version has no such filter. |
| `createdTo` | string (date-time) | no | The end of the `createdAt` filter. Null when the version has no such filter. |
| `totalClicksMin` | integer (int32) | no | The lower bound of the `totalClicks` filter. Null when the version has no such filter. |
| `totalClicksMax` | integer (int32) | no | The upper bound of the `totalClicks` filter. Null when the version has no such filter. |
| `leadQualityScoreMin` | integer (int32) | no | The lower bound of the `leadQualityScore` filter. Null when the version has no such filter. |
| `leadQualityScoreMax` | integer (int32) | no | The upper bound of the `leadQualityScore` filter. Null when the version has no such filter. |
| `behaviorTags` | array of string | no | The `behaviorTags` filter, as an array. Null when the version has no such filter. |
| `behaviorTagsExclude` | array of string | no | The `behaviorTagsExclude` filter, as an array. Null when the version has no such filter. |
| `aiVariableFiltersJson` | string | no | The `aiVariableFilters` rules, as a JSON-encoded array string of objects with `promptId`, `operator` and `value`. Null when the version has no such filter. |
| `customVariableFiltersJson` | string | no | The `customVariableFilters` rules, as a JSON-encoded array string of objects with `variableKey`, `operator` and `value`. Null when the version has no such filter. |
