> 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: Estimate an image variable's cost

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

## Estimate an image variable's cost

`POST /v1/campaigns/{campaignId}/image-variables/{variableKey}/estimate` - operationId `image-variables.estimate`

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

Returns how many images the variable would generate now and what they would cost. Nothing is saved. To price a
change before you make it, send the fields you plan to change, with the same names as on `PATCH`. Fields you
leave out use the saved values, and an empty body prices the variable as it is saved.

For a `per_prospect` variable, `leadsNow` counts the contacts that would get an image now. It already
includes the `replaceCount` contacts whose current image the change would replace. `creditsNow` is
`leadsNow` times `creditsPerImage`. A `shared` variable is one image: `creditsNow` is the price
of that image and `creditsPerNewLead` is 0. All prices are in credits.

Errors:

- `400 validation_failed`: a field is not valid. `error.details` names the field.
- `404 not_found`: the campaign or the variable does not exist in this workspace.

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/estimate)

### 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`. |
| `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.

The fields to price. Optional.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `prompt` | string | no | The prompt to price. Null or blank prices the variable with no prompt. |
| `references` | array of string | no | The reference pictures to price. |
| `model` | string | no | The image model to price. |
| `size` | string | no | The image size to price. |
| `quality` | string | no | The image quality to price. |
| `format` | string | no | The format to price: `still` or `gif`. An animated GIF costs more than a still. |
| `frameCount` | integer (int32) | no | The GIF frame count to price, 2 to 16. More frames cost more. |
| `frameDurationMs` | integer (int32) | no | The GIF frame duration to price, 20 to 2000 milliseconds. |
| `spellingCheck` | boolean | no | The spelling check setting to price. |

### Response 200

`data` is a `ImageVariableEstimate`.

| Field | Type | Description |
| --- | --- | --- |
| `leadsNow` | integer (int32) | Contacts that would get an image now, including the contacts whose image the change would replace. 0 for a `shared` variable. |
| `replaceCount` | integer (int32) | Of those contacts, how many have a ready image that the change would replace. |
| `creditsPerImage` | number (double) | Estimated credits for one image. |
| `creditsNow` | number (double) | Estimated credits for the images Kenso would generate now. For a `shared` variable, the price of its one image. |
| `creditsPerNewLead` | number (double) | Estimated credits for each contact that becomes eligible later. 0 for a `shared` variable. |

### Request

```bash
curl -X POST "https://api.ken.so/v1/campaigns/812/image-variables/hero_image/estimate" \
  -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 '{
  "prompt": "string",
  "references": [
    "string"
  ],
  "model": "string",
  "size": "string",
  "quality": "string",
  "format": "still",
  "frameCount": 1,
  "frameDurationMs": 1,
  "spellingCheck": true
}'
```

### Example response

```json
{
  "success": true,
  "data": {
    "leadsNow": 1,
    "replaceCount": 1,
    "creditsPerImage": 0.5,
    "creditsNow": 0.5,
    "creditsPerNewLead": 0.5
  }
}
```
