from retab import Retab
client = Retab()
updated = client.workflows.apply(yaml_definition, workflow_id="wf_abc123")
print(updated.workflow_id)
print(updated.summary.has_changes)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const updated = await client.workflows.apply(yamlDefinition, undefined, "wf_abc123");
console.log(updated.workflowId);
console.log(updated.summary.hasChanges);
package main
import (
"context"
"fmt"
"log"
retab "github.com/retab-dev/retab/clients/go"
)
func main() {
ctx := context.Background()
client, err := retab.NewClient("")
if err != nil {
log.Fatal(err)
}
yamlDefinition := `apiVersion: workflows.retab.com/v1alpha2
kind: Workflow
metadata:
id: source_workflow
name: Invoice Workflow
spec:
blocks:
start:
type: start_json
label: Input JSON
config:
json_schema:
type: object
edges: []
`
result, err := client.Workflows.Apply(ctx, &retab.WorkflowsApplyParams{YamlDefinition: yamlDefinition, WorkflowID: retab.Ptr("wf_abc123")})
if err != nil {
log.Fatal(err)
}
fmt.Println(result.WorkflowID)
fmt.Println(result.Summary)
}
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
updated = client.workflows.apply(yaml_definition: yaml_definition, workflow_id: 'wf_abc123')
puts updated.workflow_id
puts updated.summary.has_changes
use retab::models::DeclarativeWorkflowRequest;
use retab::resources::workflows::ApplyParams;
use retab::Retab;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Retab::new(std::env::var("RETAB_API_KEY")?);
let yaml_definition = r#"apiVersion: workflows.retab.com/v1alpha2
kind: Workflow
metadata:
id: source_workflow
name: Invoice Workflow
spec:
blocks:
start:
type: start_json
label: Input JSON
config:
json_schema:
type: object
edges: []
"#;
let result = client
.workflows()
.apply(ApplyParams {
body: DeclarativeWorkflowRequest::new(yaml_definition),
workflow_id: Some("wf_abc123".to_string()),
})
.await?;
println!("{}", result.workflow_id);
if let Some(summary) = &result.summary {
println!("{:?}", summary.has_changes);
}
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$yamlDefinition = <<<'YAML'
apiVersion: workflows.retab.com/v1alpha2
kind: Workflow
metadata:
id: source_workflow
name: Invoice Workflow
spec:
blocks:
start:
type: start_json
label: Input JSON
config:
json_schema:
type: object
edges: []
YAML;
$result = $client->workflows()->apply(yamlDefinition: $yamlDefinition, workflowId: 'wf_abc123');
print_r($result);
using Retab;
using RetabClient = Retab.Retab;
var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
var client = new RetabClient(apiKey);
var yamlDefinition = """
apiVersion: workflows.retab.com/v1alpha2
kind: Workflow
metadata:
id: source_workflow
name: Invoice Workflow
spec:
blocks:
start:
type: start_json
label: Input JSON
config:
json_schema:
type: object
edges: []
""";
var options = new WorkflowsApplyOptions { YamlDefinition = yamlDefinition };
options.WorkflowId = "wf_abc123";
var result = await client.Workflows.ApplyAsync(options);
Console.WriteLine(result);
import com.retab.RetabClient;
public final class Example {
public static void main(String[] args) throws Exception {
RetabClient client = new RetabClient(System.getenv("RETAB_API_KEY"));
var result = client.workflows().apply(
"metadata:\n id: source_workflow\n",
null,
"wf_abc123"
);
System.out.println(result);
}
}
curl -X 'POST' \
'https://api.retab.com/v1/workflows/wf_abc123/spec/apply' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <your-api-key>' \
-d '{
"yaml_definition": "apiVersion: workflows.retab.com/v1alpha2\nkind: Workflow\nmetadata:\n id: source_workflow\n name: Invoice Workflow\nspec:\n blocks:\n start:\n type: start_json\n label: Input JSON\n config:\n json_schema:\n type: object\n edges: []\n"
}'
{
"workflow_id": "wf_abc123",
"created": false,
"block_count": 1,
"edge_count": 0,
"diagnostics": {
"issues": []
},
"format_version": "workflows-plan/v1",
"summary": {
"add": 0,
"change": 1,
"destroy": 0,
"replace": 0,
"noop": 0,
"total": 1,
"has_changes": true
},
"resource_changes": [],
"rendered_plan": "Updated workflow draft."
}
Workflows
Apply Workflow Spec to Existing Workflow
Apply a declarative YAML spec to an existing workflow draft.
The URL workflow id is the update target. Any workflow id in the YAML is treated as source context.
POST
/
v1
/
workflows
/
{workflow_id}
/
spec
/
apply
from retab import Retab
client = Retab()
updated = client.workflows.apply(yaml_definition, workflow_id="wf_abc123")
print(updated.workflow_id)
print(updated.summary.has_changes)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const updated = await client.workflows.apply(yamlDefinition, undefined, "wf_abc123");
console.log(updated.workflowId);
console.log(updated.summary.hasChanges);
package main
import (
"context"
"fmt"
"log"
retab "github.com/retab-dev/retab/clients/go"
)
func main() {
ctx := context.Background()
client, err := retab.NewClient("")
if err != nil {
log.Fatal(err)
}
yamlDefinition := `apiVersion: workflows.retab.com/v1alpha2
kind: Workflow
metadata:
id: source_workflow
name: Invoice Workflow
spec:
blocks:
start:
type: start_json
label: Input JSON
config:
json_schema:
type: object
edges: []
`
result, err := client.Workflows.Apply(ctx, &retab.WorkflowsApplyParams{YamlDefinition: yamlDefinition, WorkflowID: retab.Ptr("wf_abc123")})
if err != nil {
log.Fatal(err)
}
fmt.Println(result.WorkflowID)
fmt.Println(result.Summary)
}
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
updated = client.workflows.apply(yaml_definition: yaml_definition, workflow_id: 'wf_abc123')
puts updated.workflow_id
puts updated.summary.has_changes
use retab::models::DeclarativeWorkflowRequest;
use retab::resources::workflows::ApplyParams;
use retab::Retab;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Retab::new(std::env::var("RETAB_API_KEY")?);
let yaml_definition = r#"apiVersion: workflows.retab.com/v1alpha2
kind: Workflow
metadata:
id: source_workflow
name: Invoice Workflow
spec:
blocks:
start:
type: start_json
label: Input JSON
config:
json_schema:
type: object
edges: []
"#;
let result = client
.workflows()
.apply(ApplyParams {
body: DeclarativeWorkflowRequest::new(yaml_definition),
workflow_id: Some("wf_abc123".to_string()),
})
.await?;
println!("{}", result.workflow_id);
if let Some(summary) = &result.summary {
println!("{:?}", summary.has_changes);
}
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$yamlDefinition = <<<'YAML'
apiVersion: workflows.retab.com/v1alpha2
kind: Workflow
metadata:
id: source_workflow
name: Invoice Workflow
spec:
blocks:
start:
type: start_json
label: Input JSON
config:
json_schema:
type: object
edges: []
YAML;
$result = $client->workflows()->apply(yamlDefinition: $yamlDefinition, workflowId: 'wf_abc123');
print_r($result);
using Retab;
using RetabClient = Retab.Retab;
var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
var client = new RetabClient(apiKey);
var yamlDefinition = """
apiVersion: workflows.retab.com/v1alpha2
kind: Workflow
metadata:
id: source_workflow
name: Invoice Workflow
spec:
blocks:
start:
type: start_json
label: Input JSON
config:
json_schema:
type: object
edges: []
""";
var options = new WorkflowsApplyOptions { YamlDefinition = yamlDefinition };
options.WorkflowId = "wf_abc123";
var result = await client.Workflows.ApplyAsync(options);
Console.WriteLine(result);
import com.retab.RetabClient;
public final class Example {
public static void main(String[] args) throws Exception {
RetabClient client = new RetabClient(System.getenv("RETAB_API_KEY"));
var result = client.workflows().apply(
"metadata:\n id: source_workflow\n",
null,
"wf_abc123"
);
System.out.println(result);
}
}
curl -X 'POST' \
'https://api.retab.com/v1/workflows/wf_abc123/spec/apply' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <your-api-key>' \
-d '{
"yaml_definition": "apiVersion: workflows.retab.com/v1alpha2\nkind: Workflow\nmetadata:\n id: source_workflow\n name: Invoice Workflow\nspec:\n blocks:\n start:\n type: start_json\n label: Input JSON\n config:\n json_schema:\n type: object\n edges: []\n"
}'
{
"workflow_id": "wf_abc123",
"created": false,
"block_count": 1,
"edge_count": 0,
"diagnostics": {
"issues": []
},
"format_version": "workflows-plan/v1",
"summary": {
"add": 0,
"change": 1,
"destroy": 0,
"replace": 0,
"noop": 0,
"total": 1,
"has_changes": true
},
"resource_changes": [],
"rendered_plan": "Updated workflow draft."
}
Apply a declarative workflow YAML spec to an existing workflow draft.
The
workflow_id in the URL is the update target. If the YAML includes metadata.id, Retab treats it as source context and does not use it to choose a different workflow.
from retab import Retab
client = Retab()
updated = client.workflows.apply(yaml_definition, workflow_id="wf_abc123")
print(updated.workflow_id)
print(updated.summary.has_changes)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const updated = await client.workflows.apply(yamlDefinition, undefined, "wf_abc123");
console.log(updated.workflowId);
console.log(updated.summary.hasChanges);
package main
import (
"context"
"fmt"
"log"
retab "github.com/retab-dev/retab/clients/go"
)
func main() {
ctx := context.Background()
client, err := retab.NewClient("")
if err != nil {
log.Fatal(err)
}
yamlDefinition := `apiVersion: workflows.retab.com/v1alpha2
kind: Workflow
metadata:
id: source_workflow
name: Invoice Workflow
spec:
blocks:
start:
type: start_json
label: Input JSON
config:
json_schema:
type: object
edges: []
`
result, err := client.Workflows.Apply(ctx, &retab.WorkflowsApplyParams{YamlDefinition: yamlDefinition, WorkflowID: retab.Ptr("wf_abc123")})
if err != nil {
log.Fatal(err)
}
fmt.Println(result.WorkflowID)
fmt.Println(result.Summary)
}
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
updated = client.workflows.apply(yaml_definition: yaml_definition, workflow_id: 'wf_abc123')
puts updated.workflow_id
puts updated.summary.has_changes
use retab::models::DeclarativeWorkflowRequest;
use retab::resources::workflows::ApplyParams;
use retab::Retab;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Retab::new(std::env::var("RETAB_API_KEY")?);
let yaml_definition = r#"apiVersion: workflows.retab.com/v1alpha2
kind: Workflow
metadata:
id: source_workflow
name: Invoice Workflow
spec:
blocks:
start:
type: start_json
label: Input JSON
config:
json_schema:
type: object
edges: []
"#;
let result = client
.workflows()
.apply(ApplyParams {
body: DeclarativeWorkflowRequest::new(yaml_definition),
workflow_id: Some("wf_abc123".to_string()),
})
.await?;
println!("{}", result.workflow_id);
if let Some(summary) = &result.summary {
println!("{:?}", summary.has_changes);
}
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$yamlDefinition = <<<'YAML'
apiVersion: workflows.retab.com/v1alpha2
kind: Workflow
metadata:
id: source_workflow
name: Invoice Workflow
spec:
blocks:
start:
type: start_json
label: Input JSON
config:
json_schema:
type: object
edges: []
YAML;
$result = $client->workflows()->apply(yamlDefinition: $yamlDefinition, workflowId: 'wf_abc123');
print_r($result);
using Retab;
using RetabClient = Retab.Retab;
var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
var client = new RetabClient(apiKey);
var yamlDefinition = """
apiVersion: workflows.retab.com/v1alpha2
kind: Workflow
metadata:
id: source_workflow
name: Invoice Workflow
spec:
blocks:
start:
type: start_json
label: Input JSON
config:
json_schema:
type: object
edges: []
""";
var options = new WorkflowsApplyOptions { YamlDefinition = yamlDefinition };
options.WorkflowId = "wf_abc123";
var result = await client.Workflows.ApplyAsync(options);
Console.WriteLine(result);
import com.retab.RetabClient;
public final class Example {
public static void main(String[] args) throws Exception {
RetabClient client = new RetabClient(System.getenv("RETAB_API_KEY"));
var result = client.workflows().apply(
"metadata:\n id: source_workflow\n",
null,
"wf_abc123"
);
System.out.println(result);
}
}
curl -X 'POST' \
'https://api.retab.com/v1/workflows/wf_abc123/spec/apply' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <your-api-key>' \
-d '{
"yaml_definition": "apiVersion: workflows.retab.com/v1alpha2\nkind: Workflow\nmetadata:\n id: source_workflow\n name: Invoice Workflow\nspec:\n blocks:\n start:\n type: start_json\n label: Input JSON\n config:\n json_schema:\n type: object\n edges: []\n"
}'
{
"workflow_id": "wf_abc123",
"created": false,
"block_count": 1,
"edge_count": 0,
"diagnostics": {
"issues": []
},
"format_version": "workflows-plan/v1",
"summary": {
"add": 0,
"change": 1,
"destroy": 0,
"replace": 0,
"noop": 0,
"total": 1,
"has_changes": true
},
"resource_changes": [],
"rendered_plan": "Updated workflow draft."
}
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
application/json
Response
Successful Response
The outcome of applying a workflow YAML definition: whether the workflow was created, the changes made, and a rendered_plan.
Available options:
create, update, noop Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I