Save a version
curl --request POST \
--url https://inference.studio.lyzr.ai/api/workflows/{id}/publish \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"message": "Add approval step"
}
'import requests
url = "https://inference.studio.lyzr.ai/api/workflows/{id}/publish"
payload = { "message": "Add approval step" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({message: 'Add approval step'})
};
fetch('https://inference.studio.lyzr.ai/api/workflows/{id}/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://inference.studio.lyzr.ai/api/workflows/{id}/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([
'message' => 'Add approval step'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://inference.studio.lyzr.ai/api/workflows/{id}/publish"
payload := strings.NewReader("{\n \"message\": \"Add approval step\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://inference.studio.lyzr.ai/api/workflows/{id}/publish")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"Add approval step\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://inference.studio.lyzr.ai/api/workflows/{id}/publish")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"Add approval step\"\n}"
response = http.request(request)
puts response.read_body{
"version_id": "<string>",
"number": 3,
"message": "Add approval step",
"created_by": "<string>",
"created_at": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Versions
Save Version
Saves the stored draft as the next numbered version, an immutable snapshot. Saving a version never changes what production runs; deploy it with PUT /workflows//live. Needs edit access.
POST
/
workflows
/
{id}
/
publish
Save a version
curl --request POST \
--url https://inference.studio.lyzr.ai/api/workflows/{id}/publish \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"message": "Add approval step"
}
'import requests
url = "https://inference.studio.lyzr.ai/api/workflows/{id}/publish"
payload = { "message": "Add approval step" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({message: 'Add approval step'})
};
fetch('https://inference.studio.lyzr.ai/api/workflows/{id}/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://inference.studio.lyzr.ai/api/workflows/{id}/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([
'message' => 'Add approval step'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://inference.studio.lyzr.ai/api/workflows/{id}/publish"
payload := strings.NewReader("{\n \"message\": \"Add approval step\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://inference.studio.lyzr.ai/api/workflows/{id}/publish")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"Add approval step\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://inference.studio.lyzr.ai/api/workflows/{id}/publish")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"Add approval step\"\n}"
response = http.request(request)
puts response.read_body{
"version_id": "<string>",
"number": 3,
"message": "Add approval step",
"created_by": "<string>",
"created_at": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}A workflow has two graphs. The draft (the test graph) is what you save with Update Workflow and what the Studio canvas runs. A version is an immutable snapshot of the draft, and the live version is the one production runs. This endpoint saves the current draft as the next version. To make it the live version, call Deploy Version.
Authorizations
Lyzr API key. Studio session keys (agk_, ags_) and durable sk- keys are accepted. Required on every endpoint except GET /node-types and a webhook-triggered execute that carries X-Webhook-Secret.
Path Parameters
Workflow ID
Body
application/json
Optional note describing the version.
Example:
"Add approval step"