curl --request POST \
--url https://api.cloudhumans.com/typebot/v1/typebots/{flowId}/publish \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expectedUpdatedAt": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.cloudhumans.com/typebot/v1/typebots/{flowId}/publish"
payload = { "expectedUpdatedAt": "2023-11-07T05:31:56Z" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expectedUpdatedAt: '2023-11-07T05:31:56Z'})
};
fetch('https://api.cloudhumans.com/typebot/v1/typebots/{flowId}/publish', 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.cloudhumans.com/typebot/v1/typebots/{flowId}/publish",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'expectedUpdatedAt' => '2023-11-07T05:31:56Z'
]),
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.cloudhumans.com/typebot/v1/typebots/{flowId}/publish"
payload := strings.NewReader("{\n \"expectedUpdatedAt\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.cloudhumans.com/typebot/v1/typebots/{flowId}/publish")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expectedUpdatedAt\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudhumans.com/typebot/v1/typebots/{flowId}/publish")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expectedUpdatedAt\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"historyCreated": true,
"updatedAt": "<string>"
}{
"message": "<string>",
"code": "<string>",
"issues": [
{}
]
}{
"message": "<string>",
"code": "<string>",
"issues": [
{}
]
}{
"message": "<string>",
"code": "<string>",
"issues": [
{}
]
}{
"message": "<string>",
"code": "<string>",
"issues": [
{}
]
}Publish a flow
Publishes the flow’s current draft. The published version is what agents and customers run, so this is the call that makes a flow, or a tool, live.
Send expectedUpdatedAt, the updatedAt you last read, so the publish is refused with 409 when someone changed the draft since, instead of publishing a version you never saw.
- Publishing a tool needs its tenant to be one your token grants (
403otherwise). - Graph consistency, the script lint,
settings.tool.outputSchemaand the declared inputs are checked; only lint problems that are new since the published version count. A failure is a400that lists what to fix. - A flow held by the fraud check is a
403with a message saying so. - Publishing an unchanged draft succeeds with
historyCreatedfalseand records nothing.
Every publish records a version that Restore a flow version can return to.
curl --request POST \
--url https://api.cloudhumans.com/typebot/v1/typebots/{flowId}/publish \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expectedUpdatedAt": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.cloudhumans.com/typebot/v1/typebots/{flowId}/publish"
payload = { "expectedUpdatedAt": "2023-11-07T05:31:56Z" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expectedUpdatedAt: '2023-11-07T05:31:56Z'})
};
fetch('https://api.cloudhumans.com/typebot/v1/typebots/{flowId}/publish', 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.cloudhumans.com/typebot/v1/typebots/{flowId}/publish",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'expectedUpdatedAt' => '2023-11-07T05:31:56Z'
]),
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.cloudhumans.com/typebot/v1/typebots/{flowId}/publish"
payload := strings.NewReader("{\n \"expectedUpdatedAt\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.cloudhumans.com/typebot/v1/typebots/{flowId}/publish")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expectedUpdatedAt\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudhumans.com/typebot/v1/typebots/{flowId}/publish")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expectedUpdatedAt\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"historyCreated": true,
"updatedAt": "<string>"
}{
"message": "<string>",
"code": "<string>",
"issues": [
{}
]
}{
"message": "<string>",
"code": "<string>",
"issues": [
{}
]
}{
"message": "<string>",
"code": "<string>",
"issues": [
{}
]
}{
"message": "<string>",
"code": "<string>",
"issues": [
{}
]
}Authorizations
Path Parameters
The flow's internal id, e.g. clx9z8y7x6w5v4u3t2s1. Get it from List flows (the id field of each flow). It is NOT the publicId slug that appears in a flow's public URL: a slug answers 404 here. A flow your token cannot write to answers 404, indistinguishable from one that does not exist.
Body
Optional guard against publishing a draft you have not seen.
Response
The draft is published.
The outcome of a publish.