Skip to Content
Copy and personalization

Custom variables

A campaign's custom contact fields and whether AI may read them.

Copy and personalization4 endpointsKen-Version: 2026-11-02AuthenticationWorkspacesErrors
MarkdownOpenAPI

Path parameters

The endpoints whose path names one of these take it as described here. An endpoint's own table lists a path parameter only when it describes it differently.

NameInTypeRequiredDescription
campaignIdpathinteger (int64)requiredId of the campaign.
variableKeypathstringrequiredKey of the variable, such as renewal_date. Kenso normalizes it as on create.

Headers

The endpoints on this page take these headers. Each endpoint's curl shows the ones it sends.

NameInTypeRequiredDescription
Ken-Versionheaderstring, one of: 2026-11-02, 1.1optionalThe 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 date that is not a version answers 400 unsupported_version; any other value that is not a version is treated as legacy.
X-Ken-Workspace-Idheaderinteger (int64)optionalThe 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.

List a campaign's custom variables

GET/v1/campaigns/{campaignId}/custom-variablescustom-variables.list
Permission
Campaigns view
Rate limit
12,000 requests a minute per API key

Try it on developer.ken.so

Returns the campaign's custom variables, ordered by key. Use q to keep the variables whose key or name contains the text.

Errors:

  • 400 validation_failed: limit is outside 1 to 200, or cursor is not valid.
  • 404 not_found: the campaign does not exist in this workspace.

Requires Campaigns view.

Parameters

NameInTypeRequiredDescription
qquerystringoptionalText to find in the key or the name, ignoring case. Omitted returns every variable.
limitqueryinteger (int32)optionalPage size, from 1 to 200. Defaults to 50.
cursorquerystringoptionalThe nextCursor of the previous page. Omit it for the first page.
Request
curl -X GET "https://api.ken.so/v1/campaigns/812/custom-variables?limit=50" \
  -H "Authorization: Bearer $KENSO_API_KEY" \
  -H "Ken-Version: 2026-11-02" \
  -H "X-Ken-Workspace-Id: $KENSO_WORKSPACE_ID"

Response 200

data is a list of CustomVariable. Each item has these fields. The response also carries pagination.

Show the 5 response fields and an example

The fields and an example are also on this endpoint's Markdown page.

Create a custom variable

POST/v1/campaigns/{campaignId}/custom-variablescustom-variables.create
Permission
Campaigns edit
Rate limit
4,800 requests a minute per API key

Try it on developer.ken.so

Adds a custom variable to the campaign, so its sequence steps can use the {key} token before any contact has a value for it. Returns 201 with the variable and its Location.

variableKey is required. Kenso normalizes it to lowercase snake_case, so Renewal Date becomes renewal_date. The normalized key must start with a letter and hold only letters, digits and underscores. It cannot be a field Kenso fills itself, such as first_name, email or custom_image. name defaults to the key.

When the campaign already has the key, the call updates that variable and still returns 201. It applies useAsAiContext and isRequiredForSending if you send them, and keeps the stored name.

Errors:

  • 400 validation_failed: variableKey is missing, cannot be used as a token or is a reserved field, or the campaign already has 50 custom variables.
  • 404 not_found: the campaign does not exist in this workspace.

Requires Campaigns edit.

Request body

application/json, optional.

The variable to create.

FieldTypeRequiredDescription
variableKeystringrequiredKey of the variable. Required. Kenso normalizes it to lowercase snake_case, so Renewal Date becomes renewal_date.
namestringoptionalDisplay name. Omitted uses the normalized key.
useAsAiContextbooleanoptionalWhether Ken reads this variable as context for AI content. Omitted is true for a new variable and keeps the value of an existing one.
isRequiredForSendingbooleanoptionalWhether a contact needs a value for this variable to be ready to send. Omitted is false for a new variable and keeps the value of an existing one.
Request
curl -X POST "https://api.ken.so/v1/campaigns/812/custom-variables" \
  -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 '{
  "variableKey": "string",
  "name": "string",
  "useAsAiContext": true,
  "isRequiredForSending": true
}'

Response 201

data is a CustomVariable.

Show the 5 response fields and an example

The fields and an example are also on this endpoint's Markdown page.

Update a custom variable

PATCH/v1/campaigns/{campaignId}/custom-variables/{variableKey}custom-variables.update
Permission
Campaigns edit
Rate limit
4,800 requests a minute per API key

Try it on developer.ken.so

Changes a custom variable's name or settings. Fields you leave out keep their value, and a blank name keeps the current name. The key never changes.

Errors:

  • 400 validation_failed: variableKey in the path cannot be used as a key.
  • 404 not_found: the campaign or the variable does not exist in this workspace.

Requires Campaigns edit.

Request body

application/json, optional.

The fields to change.

FieldTypeRequiredDescription
namestringoptionalNew display name. Omitted or blank keeps the current name.
useAsAiContextbooleanoptionalWhether Ken reads this variable as context for AI content. Omitted keeps the current value.
isRequiredForSendingbooleanoptionalWhether a contact needs a value for this variable to be ready to send. Omitted keeps the current value.
Request
curl -X PATCH "https://api.ken.so/v1/campaigns/812/custom-variables/renewal_date" \
  -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 '{
  "name": "string",
  "useAsAiContext": true,
  "isRequiredForSending": true
}'

Response 200

data is a CustomVariable.

Show the 5 response fields and an example

The fields and an example are also on this endpoint's Markdown page.

Delete a custom variable

DELETE/v1/campaigns/{campaignId}/custom-variables/{variableKey}custom-variables.delete
Permission
Campaigns edit
Rate limit
4,800 requests a minute per API key

Try it on developer.ken.so

Removes the variable from the campaign. Returns 204. Values that contacts already have for the key stay on the contacts.

Errors:

  • 400 validation_failed: variableKey in the path cannot be used as a key.
  • 404 not_found: the campaign or the variable does not exist in this workspace.

Requires Campaigns edit.

Request
curl -X DELETE "https://api.ken.so/v1/campaigns/812/custom-variables/renewal_date" \
  -H "Authorization: Bearer $KENSO_API_KEY" \
  -H "Ken-Version: 2026-11-02" \
  -H "X-Ken-Workspace-Id: $KENSO_WORKSPACE_ID"

Response 204

Response 204
HTTP/1.1 204 No Content

On this page