Skip to content

Create Conditionals

POST
/api/v1/workspaces/{workspace_id}/conditionals
curl --request POST \
--url https://example.com/%7B%7Bapp_url%7D/api/v1/workspaces/1/conditionals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "label": "Over age 30", "can_be_used_in_subject_and_preheader": false, "branches": [ { "key": "gold_membership", "label": "Gold Membership" } ], "default_syntax": { "closing": "{% endif %}", "branch_values": { "gold_membership": "{% if membership == '\''gold'\'' %}", "silver_membership": "{% elsif membership == '\''silver'\'' %}" } }, "dynamic_content_profile_syntaxes": { "additionalProperty": { "closing": "{% endif %}", "branch_values": { "gold_membership": "{% if membership == '\''gold'\'' %}", "silver_membership": "{% elsif membership == '\''silver'\'' %}" } } } }'

Creates a new conditional.

workspace_id
required
integer

Workspace ID

Media typeapplication/json
object
label
required
string
Example
Over age 30
can_be_used_in_subject_and_preheader

Whether this conditional is permitted to be used in a subject or preheader.

boolean
Example
false
branches
required
Array<object>
object
key
required
string
Example
gold_membership
label
required
string
Example
Gold Membership
default_syntax
required
object
closing
required

The closing syntax tag for the conditional block.

string
Example
{% endif %}
branch_values

Key-value pairs where the key is the branch key and the value is the opening syntax for that branch.

object
key
additional properties
string
Example
{
"gold_membership": "{% if membership == 'gold' %}",
"silver_membership": "{% elsif membership == 'silver' %}"
}
dynamic_content_profile_syntaxes
object
key
additional properties

A per-DynamicContentProfile syntax entry on a Conditional.

object
closing

The closing syntax tag for the conditional block.

string
Example
{% endif %}
branch_values

Key-value pairs where the key is the branch key and the value is the opening syntax for that branch.

object
key
additional properties
string
Example
{
"gold_membership": "{% if membership == 'gold' %}",
"silver_membership": "{% elsif membership == 'silver' %}"
}

Successful

Media typeapplication/json
object
id
required
integer
label
required
string
default_syntax
required
object
closing
required

The closing syntax tag for the conditional block.

string
branch_values

Key-value pairs where the key is the branch key and the value is the opening syntax for that branch.

object
key
additional properties
string
branches
required
Array<object>
object
key
required
string
label
required
string
can_be_used_in_subject_and_preheader
required
boolean
created_at
required
string format: date-time
updated_at
required
string format: date-time
organization_id
required
integer
dynamic_content_profile_syntaxes
required
object
key
additional properties

A per-DynamicContentProfile syntax entry on a Conditional.

object
closing

The closing syntax tag for the conditional block.

string
branch_values

Key-value pairs where the key is the branch key and the value is the opening syntax for that branch.

object
key
additional properties
string
Example
{
"id": 12345,
"label": "Over age 30s",
"default_syntax": {
"closing": "{% endif %}",
"branch_values": {
"gold_membership": "{% if membership == 'gold' %}",
"silver_membership": "{% elsif membership == 'silver' %}"
}
},
"branches": [
{
"key": "gold_membership",
"label": "Gold Membership"
}
],
"can_be_used_in_subject_and_preheader": false,
"created_at": "2023-08-23T10:30:00.000Z",
"updated_at": "2023-08-23T10:30:00.000Z",
"organization_id": 12345,
"dynamic_content_profile_syntaxes": {
"additionalProperty": {
"closing": "{% endif %}",
"branch_values": {
"gold_membership": "{% if membership == 'gold' %}",
"silver_membership": "{% elsif membership == 'silver' %}"
}
}
}
}

Unauthorized

Media typeapplication/json
object
message
required
string
code
string
Example
{
"message": "Record not found",
"code": "share_link_expired"
}

Forbidden

Media typeapplication/json
object
message
required
string
code
string
Example
{
"message": "Record not found",
"code": "share_link_expired"
}

Not Found

Media typeapplication/json
object
message
required
string
code
string
Example
{
"message": "Record not found",
"code": "share_link_expired"
}

Unprocessable Entity

Media typeapplication/json
object
message
required
string
errors
required
object
key
additional properties
Array<string>
Example
{
"errors": {
"username": [
"Username is required.",
"Username must be unique."
],
"email": [
"Invalid email format."
]
}
}