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

# Image variables: Regenerate a contact's image

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

## Regenerate a contact's image

`POST /v1/campaigns/{campaignId}/image-variables/{variableKey}/contacts/{contactId}/regenerate` - operationId `image-variables.regenerate-contact`

| Permission | Credits | Rate limit |
| --- | --- | --- |
| Campaigns edit | Varies with the request (`campaign_image`) | 100 requests a day per workspace (Free plan: 10 a day) |

Generates a new image for one contact of a `per_prospect` variable. The call waits for the image and returns
it, ready or failed. The contact keeps its previous image until a new one is ready. Kenso charges credits for a
ready image, and the call counts toward the workspace's daily limit of image generations.

Errors:

- `404 not_found`: the campaign, the variable or the contact does not exist in this workspace, or the
contact is not one Kenso makes images for in this campaign.
- `409 wrong_kind`: the variable is `shared`.
- `409 image_in_use`: the contact already has a sent or queued step that uses the variable, so it keeps that
image.
- `409 blocked`: Kenso blocked the contact's current image. After a prompt change, Kenso can still generate
a new image for the contact, but this call does not replace it.
- `409` with a failure reason such as `provider_refused`: the generation saved no image.
- `429 quota_exceeded`: the workspace reached its daily limit of image generations.

Requires Campaigns edit.

Needs the `campaign_images` feature on your workspace. Until it is on, calls answer 404.

[Try it on developer.ken.so](https://developer.ken.so/reference/#kenso-api/tag/image-variables/POST/v1/campaigns/%7BcampaignId%7D/image-variables/%7BvariableKey%7D/contacts/%7BcontactId%7D/regenerate)

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `campaignId` | path | integer (int64) | yes | Id of the campaign. |
| `variableKey` | path | string | yes | Key of the image variable, such as `hero_image`. |
| `contactId` | path | integer (int64) | yes | Id of the contact. |
| `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 `CampaignImage`.

| Field | Type | Description |
| --- | --- | --- |
| `imageKey` | string | The image's unique 26-character key. Read the image again with `GET /v1/campaign-images/{imageKey}`. |
| `contactId` | integer (int64) | Id of the contact the image belongs to. Omitted for an image that every contact shares. |
| `variableKey` | string | Key of the image variable the image fills, or `custom_image` for the contact's own image. Omitted when the image belongs to no current image variable. |
| `status` | string | State of the image: `pending` while Kenso makes or fetches it, `ready` once it is stored, or `failed`. |
| `errorCode` | string | Why the image failed, such as `timeout`, `not_an_image`, `too_large` or `provider_error`. Set when `status` is `failed`. |
| `errorDetail` | string | A readable explanation of the failure. Set when `status` is `failed`. |
| `width` | integer (int32) | Width of the image in pixels. Omitted while unknown. |
| `height` | integer (int32) | Height of the image in pixels. Omitted while unknown. |
| `previewUrl` | string | A link to view the ready image, valid until `previewExpiresAt`. Use it for viewing only, not inside an email. Omitted unless `status` is `ready`. |
| `previewExpiresAt` | string (date-time) | When `previewUrl` stops working, in UTC: 1 hour after the call. Omitted with `previewUrl`. |
| `updatedAt` | string (date-time) | When the image last changed, in UTC. |

### Request

```bash
curl -X POST "https://api.ken.so/v1/campaigns/812/image-variables/hero_image/contacts/812/regenerate" \
  -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": {
    "imageKey": "string",
    "contactId": 812,
    "variableKey": "string",
    "status": "string",
    "errorCode": "timeout",
    "errorDetail": "string",
    "width": 1,
    "height": 1,
    "previewUrl": "https://example.com",
    "previewExpiresAt": "2026-09-23T15:02:11Z",
    "updatedAt": "2026-09-23T15:02:11Z"
  }
}
```
