Change a flow with small edits
curl --request PATCH \
--url https://api.statisfy.com/v1/automations/flows/{flow_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"edits": [
{
"add": "<string>",
"after": "<string>",
"between": {
"[0]": "<string>",
"[1]": "<string>"
},
"branch": "<string>",
"id": "<string>",
"settings": {}
}
],
"version": 123,
"graph_hash": "<string>"
}
'import requests
url = "https://api.statisfy.com/v1/automations/flows/{flow_id}"
payload = {
"edits": [
{
"add": "<string>",
"after": "<string>",
"between": {
"[0]": "<string>",
"[1]": "<string>"
},
"branch": "<string>",
"id": "<string>",
"settings": {}
}
],
"version": 123,
"graph_hash": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
edits: [
{
add: '<string>',
after: '<string>',
between: {'[0]': '<string>', '[1]': '<string>'},
branch: '<string>',
id: '<string>',
settings: {}
}
],
version: 123,
graph_hash: '<string>'
})
};
fetch('https://api.statisfy.com/v1/automations/flows/{flow_id}', 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://api.statisfy.com/v1/automations/flows/{flow_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'edits' => [
[
'add' => '<string>',
'after' => '<string>',
'between' => [
'[0]' => '<string>',
'[1]' => '<string>'
],
'branch' => '<string>',
'id' => '<string>',
'settings' => [
]
]
],
'version' => 123,
'graph_hash' => '<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://api.statisfy.com/v1/automations/flows/{flow_id}"
payload := strings.NewReader("{\n \"edits\": [\n {\n \"add\": \"<string>\",\n \"after\": \"<string>\",\n \"between\": {\n \"[0]\": \"<string>\",\n \"[1]\": \"<string>\"\n },\n \"branch\": \"<string>\",\n \"id\": \"<string>\",\n \"settings\": {}\n }\n ],\n \"version\": 123,\n \"graph_hash\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.statisfy.com/v1/automations/flows/{flow_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"edits\": [\n {\n \"add\": \"<string>\",\n \"after\": \"<string>\",\n \"between\": {\n \"[0]\": \"<string>\",\n \"[1]\": \"<string>\"\n },\n \"branch\": \"<string>\",\n \"id\": \"<string>\",\n \"settings\": {}\n }\n ],\n \"version\": 123,\n \"graph_hash\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.statisfy.com/v1/automations/flows/{flow_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"edits\": [\n {\n \"add\": \"<string>\",\n \"after\": \"<string>\",\n \"between\": {\n \"[0]\": \"<string>\",\n \"[1]\": \"<string>\"\n },\n \"branch\": \"<string>\",\n \"id\": \"<string>\",\n \"settings\": {}\n }\n ],\n \"version\": 123,\n \"graph_hash\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"editor_url": "<string>",
"enabled": true,
"flow_id": "<string>",
"name": "<string>",
"trigger": "<string>",
"version": 123,
"nodes": {}
}automations
Change a flow with small edits
Add, remove or change steps, or replace the trigger, without sending the whole spec. The edits apply in order to the saved spec, which is then checked and saved as PUT does: all or nothing. Send the version (and graph_hash) you read. Refused while the flow is on.
PATCH
/
v1
/
automations
/
flows
/
{flow_id}
Change a flow with small edits
curl --request PATCH \
--url https://api.statisfy.com/v1/automations/flows/{flow_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"edits": [
{
"add": "<string>",
"after": "<string>",
"between": {
"[0]": "<string>",
"[1]": "<string>"
},
"branch": "<string>",
"id": "<string>",
"settings": {}
}
],
"version": 123,
"graph_hash": "<string>"
}
'import requests
url = "https://api.statisfy.com/v1/automations/flows/{flow_id}"
payload = {
"edits": [
{
"add": "<string>",
"after": "<string>",
"between": {
"[0]": "<string>",
"[1]": "<string>"
},
"branch": "<string>",
"id": "<string>",
"settings": {}
}
],
"version": 123,
"graph_hash": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
edits: [
{
add: '<string>',
after: '<string>',
between: {'[0]': '<string>', '[1]': '<string>'},
branch: '<string>',
id: '<string>',
settings: {}
}
],
version: 123,
graph_hash: '<string>'
})
};
fetch('https://api.statisfy.com/v1/automations/flows/{flow_id}', 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://api.statisfy.com/v1/automations/flows/{flow_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'edits' => [
[
'add' => '<string>',
'after' => '<string>',
'between' => [
'[0]' => '<string>',
'[1]' => '<string>'
],
'branch' => '<string>',
'id' => '<string>',
'settings' => [
]
]
],
'version' => 123,
'graph_hash' => '<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://api.statisfy.com/v1/automations/flows/{flow_id}"
payload := strings.NewReader("{\n \"edits\": [\n {\n \"add\": \"<string>\",\n \"after\": \"<string>\",\n \"between\": {\n \"[0]\": \"<string>\",\n \"[1]\": \"<string>\"\n },\n \"branch\": \"<string>\",\n \"id\": \"<string>\",\n \"settings\": {}\n }\n ],\n \"version\": 123,\n \"graph_hash\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.statisfy.com/v1/automations/flows/{flow_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"edits\": [\n {\n \"add\": \"<string>\",\n \"after\": \"<string>\",\n \"between\": {\n \"[0]\": \"<string>\",\n \"[1]\": \"<string>\"\n },\n \"branch\": \"<string>\",\n \"id\": \"<string>\",\n \"settings\": {}\n }\n ],\n \"version\": 123,\n \"graph_hash\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.statisfy.com/v1/automations/flows/{flow_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"edits\": [\n {\n \"add\": \"<string>\",\n \"after\": \"<string>\",\n \"between\": {\n \"[0]\": \"<string>\",\n \"[1]\": \"<string>\"\n },\n \"branch\": \"<string>\",\n \"id\": \"<string>\",\n \"settings\": {}\n }\n ],\n \"version\": 123,\n \"graph_hash\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"editor_url": "<string>",
"enabled": true,
"flow_id": "<string>",
"name": "<string>",
"trigger": "<string>",
"version": 123,
"nodes": {}
}Authorizations
An API key, sent as Authorization: Bearer stfy_live_…. See Authentication for how to get one and which scopes it needs.
Body
application/json
Was this page helpful?