Skip to main content
POST
Create Custom Variable

Authorizations

apikey
string
header
required

API Key (i.e. Rest API Key from the Dashboard).

Body

application/json
name
string
required

Unique variable name. Must start with a letter and contain only alphanumeric characters, underscores, and dots.

Maximum string length: 50
Pattern: ^[a-zA-Z][a-zA-Z0-9_.]*$
Example:

"user.preferred_language"

sourceType
enum<string>
required

Source from which the variable value is resolved

Available options:
message_metadata,
user_metadata,
constant
Example:

"user_metadata"

description
string

Human-readable description of the variable

Maximum string length: 200
Example:

"The preferred language of the user"

sourcePath
string

Dot-notation path to extract the value from the source metadata

Maximum string length: 100
Example:

"language"

constantValue
string

Fixed value used when sourceType is constant

Maximum string length: 500
Example:

"en"

defaultValue
string

Fallback value used when the source path does not resolve

Maximum string length: 200
Example:

"en"

Response

200 - application/json

Custom variable created successfully

_id
string
Example:

"507f1f77bcf86cd799439011"

appId
string
Example:

"my-app-id"

name
string
Example:

"user.plan"

description
string
Example:

"The user subscription plan"

sourceType
string
Example:

"user_metadata"

sourcePath
string
Example:

"metadata.plan"

constantValue
string
Example:

""

defaultValue
string
Example:

"free"

category
string
Example:

"custom"

createdAt
number
Example:

1700000000000

updatedAt
number
Example:

1700000000000