Create Context Variable Definition
Create a new context variable definition that can be used in contacts or your business profile.Endpoint
Authentication
This endpoint requires an API key with thecan_write_contacts
permission.
Request Body
Parameter | Type | Required | Description |
---|---|---|---|
name | string | Yes | Variable name (API identifier, e.g., last_payment_date ) |
display_name | string | Yes | User-friendly display name (e.g., “Last Payment Date”) |
description | string | No | Optional description of the variable |
variable_type | string | Yes | Data type (text, number, date, boolean, select) |
context_type | string | Yes | Context type (contact, business) |
select_options | array | No | Available options for select type variables |
Example Request Body
Response
Error Codes
Status Code | Error Code | Description |
---|---|---|
400 | missing_parameter | A required parameter is missing |
400 | duplicate_variable | A variable with this name already exists |
400 | invalid_json | Invalid JSON payload |
401 | authentication_required | No API key was provided |
401 | invalid_key | The API key is invalid or inactive |
403 | permission_denied | The API key doesn’t have the required permission |
500 | server_error | An unexpected server error occurred |
Example Request
Example Response
Valid Variable Types
Type | Description | Sample Values |
---|---|---|
text | Text strings | ”Premium Support”, “East Region” |
number | Numeric values | 42, 99.95, -10 |
date | Date values (stored in ISO format) | “2023-12-01”, “2023-01-15T14:30:00Z” |
boolean | True/false values | true, false |
select | Value from predefined options | ”Gold” (from provided options) |
Notes
- Variable names should be lowercase, contain only letters, numbers, and underscores
- Variable names must be unique within their context type for your account
- For
select
type variables, you must provide an array of options in theselect_options
field - The variable definition will be created for the account associated with the API key