Replace sequence steps
curl --request PUT \
--url https://app.leonar.app/api/v1/sequences/{id}/steps \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"steps": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"client_key": "<string>",
"step_order": 2,
"name": "<string>",
"subject": "<string>",
"body": "<string>",
"content_template": {
"name": "<string>",
"subject": "<string>",
"body": "<string>",
"attachments": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filename": "<string>",
"url": "<string>",
"contentType": "<string>",
"size": 123,
"kind": "file"
}
]
},
"delay_days": 0,
"delay_hours": 0,
"execution_mode": "automatic",
"sender_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"sender_config": {},
"parent_step_id": "<string>",
"branch_condition": {},
"entry_conditions": {},
"ab_variant_of": "<string>"
}
]
}
'import requests
url = "https://app.leonar.app/api/v1/sequences/{id}/steps"
payload = { "steps": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"client_key": "<string>",
"step_order": 2,
"name": "<string>",
"subject": "<string>",
"body": "<string>",
"content_template": {
"name": "<string>",
"subject": "<string>",
"body": "<string>",
"attachments": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filename": "<string>",
"url": "<string>",
"contentType": "<string>",
"size": 123,
"kind": "file"
}
]
},
"delay_days": 0,
"delay_hours": 0,
"execution_mode": "automatic",
"sender_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"sender_config": {},
"parent_step_id": "<string>",
"branch_condition": {},
"entry_conditions": {},
"ab_variant_of": "<string>"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
steps: [
{
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
client_key: '<string>',
step_order: 2,
name: '<string>',
subject: '<string>',
body: JSON.stringify('<string>'),
content_template: {
name: '<string>',
subject: '<string>',
body: JSON.stringify('<string>'),
attachments: [
{
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
filename: '<string>',
url: '<string>',
contentType: '<string>',
size: 123,
kind: 'file'
}
]
},
delay_days: 0,
delay_hours: 0,
execution_mode: 'automatic',
sender_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
sender_config: {},
parent_step_id: '<string>',
branch_condition: {},
entry_conditions: {},
ab_variant_of: '<string>'
}
]
})
};
fetch('https://app.leonar.app/api/v1/sequences/{id}/steps', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.leonar.app/api/v1/sequences/{id}/steps",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'steps' => [
[
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'client_key' => '<string>',
'step_order' => 2,
'name' => '<string>',
'subject' => '<string>',
'body' => '<string>',
'content_template' => [
'name' => '<string>',
'subject' => '<string>',
'body' => '<string>',
'attachments' => [
[
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'filename' => '<string>',
'url' => '<string>',
'contentType' => '<string>',
'size' => 123,
'kind' => 'file'
]
]
],
'delay_days' => 0,
'delay_hours' => 0,
'execution_mode' => 'automatic',
'sender_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'sender_config' => [
],
'parent_step_id' => '<string>',
'branch_condition' => [
],
'entry_conditions' => [
],
'ab_variant_of' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.leonar.app/api/v1/sequences/{id}/steps"
payload := strings.NewReader("{\n \"steps\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"client_key\": \"<string>\",\n \"step_order\": 2,\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"content_template\": {\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"attachments\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"filename\": \"<string>\",\n \"url\": \"<string>\",\n \"contentType\": \"<string>\",\n \"size\": 123,\n \"kind\": \"file\"\n }\n ]\n },\n \"delay_days\": 0,\n \"delay_hours\": 0,\n \"execution_mode\": \"automatic\",\n \"sender_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"sender_config\": {},\n \"parent_step_id\": \"<string>\",\n \"branch_condition\": {},\n \"entry_conditions\": {},\n \"ab_variant_of\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://app.leonar.app/api/v1/sequences/{id}/steps")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"steps\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"client_key\": \"<string>\",\n \"step_order\": 2,\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"content_template\": {\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"attachments\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"filename\": \"<string>\",\n \"url\": \"<string>\",\n \"contentType\": \"<string>\",\n \"size\": 123,\n \"kind\": \"file\"\n }\n ]\n },\n \"delay_days\": 0,\n \"delay_hours\": 0,\n \"execution_mode\": \"automatic\",\n \"sender_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"sender_config\": {},\n \"parent_step_id\": \"<string>\",\n \"branch_condition\": {},\n \"entry_conditions\": {},\n \"ab_variant_of\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.leonar.app/api/v1/sequences/{id}/steps")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"steps\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"client_key\": \"<string>\",\n \"step_order\": 2,\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"content_template\": {\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"attachments\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"filename\": \"<string>\",\n \"url\": \"<string>\",\n \"contentType\": \"<string>\",\n \"size\": 123,\n \"kind\": \"file\"\n }\n ]\n },\n \"delay_days\": 0,\n \"delay_hours\": 0,\n \"execution_mode\": \"automatic\",\n \"sender_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"sender_config\": {},\n \"parent_step_id\": \"<string>\",\n \"branch_condition\": {},\n \"entry_conditions\": {},\n \"ab_variant_of\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sequence_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"step_order": 123,
"type": "<string>",
"delay_days": 123,
"delay_hours": 123,
"name": "<string>",
"subject": "<string>",
"body": "<string>",
"content_template": {},
"sender_config": {},
"parent_step_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"branch_condition": {},
"entry_conditions": {},
"ab_variant_of": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z"
}
]
}{
"error": {
"code": "validation_error",
"message": "Invalid input"
}
}{
"error": {
"code": "invalid_api_key",
"message": "Invalid API key"
}
}{
"error": {
"code": "not_found",
"message": "Resource not found"
}
}Sequences
Replace sequence steps
Replaces the editable step list for a draft or paused sequence. Omitted existing steps are deleted; steps without id are created. Use client_key to reference newly-created branch steps from parent_step_id. Pending paused tasks are synchronized before resume.
PUT
/
sequences
/
{id}
/
steps
Replace sequence steps
curl --request PUT \
--url https://app.leonar.app/api/v1/sequences/{id}/steps \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"steps": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"client_key": "<string>",
"step_order": 2,
"name": "<string>",
"subject": "<string>",
"body": "<string>",
"content_template": {
"name": "<string>",
"subject": "<string>",
"body": "<string>",
"attachments": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filename": "<string>",
"url": "<string>",
"contentType": "<string>",
"size": 123,
"kind": "file"
}
]
},
"delay_days": 0,
"delay_hours": 0,
"execution_mode": "automatic",
"sender_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"sender_config": {},
"parent_step_id": "<string>",
"branch_condition": {},
"entry_conditions": {},
"ab_variant_of": "<string>"
}
]
}
'import requests
url = "https://app.leonar.app/api/v1/sequences/{id}/steps"
payload = { "steps": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"client_key": "<string>",
"step_order": 2,
"name": "<string>",
"subject": "<string>",
"body": "<string>",
"content_template": {
"name": "<string>",
"subject": "<string>",
"body": "<string>",
"attachments": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filename": "<string>",
"url": "<string>",
"contentType": "<string>",
"size": 123,
"kind": "file"
}
]
},
"delay_days": 0,
"delay_hours": 0,
"execution_mode": "automatic",
"sender_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"sender_config": {},
"parent_step_id": "<string>",
"branch_condition": {},
"entry_conditions": {},
"ab_variant_of": "<string>"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
steps: [
{
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
client_key: '<string>',
step_order: 2,
name: '<string>',
subject: '<string>',
body: JSON.stringify('<string>'),
content_template: {
name: '<string>',
subject: '<string>',
body: JSON.stringify('<string>'),
attachments: [
{
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
filename: '<string>',
url: '<string>',
contentType: '<string>',
size: 123,
kind: 'file'
}
]
},
delay_days: 0,
delay_hours: 0,
execution_mode: 'automatic',
sender_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
sender_config: {},
parent_step_id: '<string>',
branch_condition: {},
entry_conditions: {},
ab_variant_of: '<string>'
}
]
})
};
fetch('https://app.leonar.app/api/v1/sequences/{id}/steps', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.leonar.app/api/v1/sequences/{id}/steps",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'steps' => [
[
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'client_key' => '<string>',
'step_order' => 2,
'name' => '<string>',
'subject' => '<string>',
'body' => '<string>',
'content_template' => [
'name' => '<string>',
'subject' => '<string>',
'body' => '<string>',
'attachments' => [
[
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'filename' => '<string>',
'url' => '<string>',
'contentType' => '<string>',
'size' => 123,
'kind' => 'file'
]
]
],
'delay_days' => 0,
'delay_hours' => 0,
'execution_mode' => 'automatic',
'sender_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'sender_config' => [
],
'parent_step_id' => '<string>',
'branch_condition' => [
],
'entry_conditions' => [
],
'ab_variant_of' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.leonar.app/api/v1/sequences/{id}/steps"
payload := strings.NewReader("{\n \"steps\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"client_key\": \"<string>\",\n \"step_order\": 2,\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"content_template\": {\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"attachments\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"filename\": \"<string>\",\n \"url\": \"<string>\",\n \"contentType\": \"<string>\",\n \"size\": 123,\n \"kind\": \"file\"\n }\n ]\n },\n \"delay_days\": 0,\n \"delay_hours\": 0,\n \"execution_mode\": \"automatic\",\n \"sender_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"sender_config\": {},\n \"parent_step_id\": \"<string>\",\n \"branch_condition\": {},\n \"entry_conditions\": {},\n \"ab_variant_of\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://app.leonar.app/api/v1/sequences/{id}/steps")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"steps\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"client_key\": \"<string>\",\n \"step_order\": 2,\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"content_template\": {\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"attachments\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"filename\": \"<string>\",\n \"url\": \"<string>\",\n \"contentType\": \"<string>\",\n \"size\": 123,\n \"kind\": \"file\"\n }\n ]\n },\n \"delay_days\": 0,\n \"delay_hours\": 0,\n \"execution_mode\": \"automatic\",\n \"sender_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"sender_config\": {},\n \"parent_step_id\": \"<string>\",\n \"branch_condition\": {},\n \"entry_conditions\": {},\n \"ab_variant_of\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.leonar.app/api/v1/sequences/{id}/steps")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"steps\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"client_key\": \"<string>\",\n \"step_order\": 2,\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"content_template\": {\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"attachments\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"filename\": \"<string>\",\n \"url\": \"<string>\",\n \"contentType\": \"<string>\",\n \"size\": 123,\n \"kind\": \"file\"\n }\n ]\n },\n \"delay_days\": 0,\n \"delay_hours\": 0,\n \"execution_mode\": \"automatic\",\n \"sender_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"sender_config\": {},\n \"parent_step_id\": \"<string>\",\n \"branch_condition\": {},\n \"entry_conditions\": {},\n \"ab_variant_of\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sequence_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"step_order": 123,
"type": "<string>",
"delay_days": 123,
"delay_hours": 123,
"name": "<string>",
"subject": "<string>",
"body": "<string>",
"content_template": {},
"sender_config": {},
"parent_step_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"branch_condition": {},
"entry_conditions": {},
"ab_variant_of": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z"
}
]
}{
"error": {
"code": "validation_error",
"message": "Invalid input"
}
}{
"error": {
"code": "invalid_api_key",
"message": "Invalid API key"
}
}{
"error": {
"code": "not_found",
"message": "Resource not found"
}
}⌘I