from retab import Retab
client = Retab()
run = client.workflows.experiments.runs.create(
workflow_id="wf_abc123",
experiment_id="exp_abc",
)
print(run.id, run.lifecycle.status)
# Wait for the run to complete, then read metrics.
metrics = client.workflows.experiments.metrics.get(
run.id,
view="summary",
)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const run = await client.workflows.experiments.runs.create("exp_abc", "wf_abc123");
console.log(run.id, run.lifecycle.status);
// Wait for the run to complete, then read metrics.
const metrics = await client.workflows.experiments.metrics.get({
runId: run.id,
view: "summary",
});
package main
import (
"context"
"fmt"
"log"
retab "github.com/retab-dev/retab/clients/go"
)
func ptr[T any](v T) *T { return &v }
func main() {
ctx := context.Background()
client, err := retab.NewClient("")
if err != nil {
log.Fatal(err)
}
run, err := client.Workflows.Experiments.Runs.Create(ctx, &retab.ExperimentRunsCreateParams{
WorkflowID: ptr("wf_abc123"),
ExperimentID: "exp_abc",
})
if err != nil {
log.Fatal(err)
}
fmt.Println(run.ID, run.Lifecycle.Status())
// Wait for the run to complete, then read metrics.
metrics, err := client.Workflows.Experiments.Metrics.Get(ctx,
&retab.ExperimentRunMetricsGetParams{RunID: run.ID, View: ptr(retab.ExperimentRunMetricsViewSummary)})
if err != nil {
log.Fatal(err)
}
_ = metrics
}
use retab::enums::ExperimentRunMetricsView;
use retab::models::CreateExperimentRunRequest;
use retab::resources::experiment_run_metrics::GetParams as MetricsGetParams;
use retab::resources::experiment_runs::CreateParams;
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 mut body = CreateExperimentRunRequest::new("exp_abc");
body.workflow_id = Some("wf_abc123".into());
let run = client
.workflows().experiments().runs()
.create(CreateParams::new(body))
.await?;
println!("{} {:?}", run.id, run.lifecycle);
// Wait for the run to complete, then read metrics.
let mut params = MetricsGetParams::new(&run.id);
params.view = Some(ExperimentRunMetricsView::Summary);
let _metrics = client.workflows().experiments().metrics().get(params).await?;
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->workflows()->experiments()->runs()->create(
experimentId: 'exp_abc123',
);
print_r($result);
using Retab;
using RetabClient = Retab.Retab;
var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
var client = new RetabClient(apiKey);
var result = await client.Workflows.Experiments.Runs.CreateAsync(new ExperimentRunsCreateOptions());
Console.WriteLine(result);
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
result = client.workflows.experiments.runs.create
puts 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().experiments().runs().create("exp_abc123", "wf_abc123", null);
System.out.println(result);
}
}
# Default — use the experiment's stored n_consensus and document set.
curl -X 'POST' \
'https://api.retab.com/v1/workflows/experiments/runs' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <your-api-key>' \
-d '{
"experiment_id": "exp_abc",
"workflow_id": "wf_abc123"
}'
{
"id": "exprun_2",
"workflow": {
"workflow_id": "wf_abc123",
"version_id": "draft_2026_05_18"
},
"trigger": { "type": "api" },
"lifecycle": { "status": "pending" },
"timing": {
"created_at": "2026-05-18T10:00:00Z",
"started_at": null,
"completed_at": null
},
"experiment_id": "exp_abc",
"block_id": "extract-invoice",
"block_kind": "extract",
"block_execution_fingerprint": "0ff93ddc7cefcb42",
"documents_fingerprint": "ddd95baadce6045f",
"total_document_count": 12,
"completed_document_count": 0,
"error_count": 0,
"n_consensus": 5
}
Create Experiment Run
Create an experiment run.
The experiment_id and an optional workflow_id are supplied in the body.
When workflow_id is omitted, the experiment’s workflow is used; when
supplied, it must match that workflow or the request is rejected with 404.
from retab import Retab
client = Retab()
run = client.workflows.experiments.runs.create(
workflow_id="wf_abc123",
experiment_id="exp_abc",
)
print(run.id, run.lifecycle.status)
# Wait for the run to complete, then read metrics.
metrics = client.workflows.experiments.metrics.get(
run.id,
view="summary",
)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const run = await client.workflows.experiments.runs.create("exp_abc", "wf_abc123");
console.log(run.id, run.lifecycle.status);
// Wait for the run to complete, then read metrics.
const metrics = await client.workflows.experiments.metrics.get({
runId: run.id,
view: "summary",
});
package main
import (
"context"
"fmt"
"log"
retab "github.com/retab-dev/retab/clients/go"
)
func ptr[T any](v T) *T { return &v }
func main() {
ctx := context.Background()
client, err := retab.NewClient("")
if err != nil {
log.Fatal(err)
}
run, err := client.Workflows.Experiments.Runs.Create(ctx, &retab.ExperimentRunsCreateParams{
WorkflowID: ptr("wf_abc123"),
ExperimentID: "exp_abc",
})
if err != nil {
log.Fatal(err)
}
fmt.Println(run.ID, run.Lifecycle.Status())
// Wait for the run to complete, then read metrics.
metrics, err := client.Workflows.Experiments.Metrics.Get(ctx,
&retab.ExperimentRunMetricsGetParams{RunID: run.ID, View: ptr(retab.ExperimentRunMetricsViewSummary)})
if err != nil {
log.Fatal(err)
}
_ = metrics
}
use retab::enums::ExperimentRunMetricsView;
use retab::models::CreateExperimentRunRequest;
use retab::resources::experiment_run_metrics::GetParams as MetricsGetParams;
use retab::resources::experiment_runs::CreateParams;
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 mut body = CreateExperimentRunRequest::new("exp_abc");
body.workflow_id = Some("wf_abc123".into());
let run = client
.workflows().experiments().runs()
.create(CreateParams::new(body))
.await?;
println!("{} {:?}", run.id, run.lifecycle);
// Wait for the run to complete, then read metrics.
let mut params = MetricsGetParams::new(&run.id);
params.view = Some(ExperimentRunMetricsView::Summary);
let _metrics = client.workflows().experiments().metrics().get(params).await?;
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->workflows()->experiments()->runs()->create(
experimentId: 'exp_abc123',
);
print_r($result);
using Retab;
using RetabClient = Retab.Retab;
var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
var client = new RetabClient(apiKey);
var result = await client.Workflows.Experiments.Runs.CreateAsync(new ExperimentRunsCreateOptions());
Console.WriteLine(result);
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
result = client.workflows.experiments.runs.create
puts 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().experiments().runs().create("exp_abc123", "wf_abc123", null);
System.out.println(result);
}
}
# Default — use the experiment's stored n_consensus and document set.
curl -X 'POST' \
'https://api.retab.com/v1/workflows/experiments/runs' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <your-api-key>' \
-d '{
"experiment_id": "exp_abc",
"workflow_id": "wf_abc123"
}'
{
"id": "exprun_2",
"workflow": {
"workflow_id": "wf_abc123",
"version_id": "draft_2026_05_18"
},
"trigger": { "type": "api" },
"lifecycle": { "status": "pending" },
"timing": {
"created_at": "2026-05-18T10:00:00Z",
"started_at": null,
"completed_at": null
},
"experiment_id": "exp_abc",
"block_id": "extract-invoice",
"block_kind": "extract",
"block_execution_fingerprint": "0ff93ddc7cefcb42",
"documents_fingerprint": "ddd95baadce6045f",
"total_document_count": 12,
"completed_document_count": 0,
"error_count": 0,
"n_consensus": 5
}
experiment_id in the request body.
workflow_id is optional in the body and scopes the lookup when provided.
This is the call that produces metrics: it re-processes every experiment
document through the block with n_consensus parallel passes per document.
Use it after creating an experiment, after editing the block, or after
changing the document set.
The endpoint is async - it returns a run resource immediately. Poll the
experiment run with Get Experiment Run
until it reaches a terminal status, then read metrics with Get Experiment Run
Metrics.
Runs use the experiment’s stored n_consensus and document set.
from retab import Retab
client = Retab()
run = client.workflows.experiments.runs.create(
workflow_id="wf_abc123",
experiment_id="exp_abc",
)
print(run.id, run.lifecycle.status)
# Wait for the run to complete, then read metrics.
metrics = client.workflows.experiments.metrics.get(
run.id,
view="summary",
)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const run = await client.workflows.experiments.runs.create("exp_abc", "wf_abc123");
console.log(run.id, run.lifecycle.status);
// Wait for the run to complete, then read metrics.
const metrics = await client.workflows.experiments.metrics.get({
runId: run.id,
view: "summary",
});
package main
import (
"context"
"fmt"
"log"
retab "github.com/retab-dev/retab/clients/go"
)
func ptr[T any](v T) *T { return &v }
func main() {
ctx := context.Background()
client, err := retab.NewClient("")
if err != nil {
log.Fatal(err)
}
run, err := client.Workflows.Experiments.Runs.Create(ctx, &retab.ExperimentRunsCreateParams{
WorkflowID: ptr("wf_abc123"),
ExperimentID: "exp_abc",
})
if err != nil {
log.Fatal(err)
}
fmt.Println(run.ID, run.Lifecycle.Status())
// Wait for the run to complete, then read metrics.
metrics, err := client.Workflows.Experiments.Metrics.Get(ctx,
&retab.ExperimentRunMetricsGetParams{RunID: run.ID, View: ptr(retab.ExperimentRunMetricsViewSummary)})
if err != nil {
log.Fatal(err)
}
_ = metrics
}
use retab::enums::ExperimentRunMetricsView;
use retab::models::CreateExperimentRunRequest;
use retab::resources::experiment_run_metrics::GetParams as MetricsGetParams;
use retab::resources::experiment_runs::CreateParams;
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 mut body = CreateExperimentRunRequest::new("exp_abc");
body.workflow_id = Some("wf_abc123".into());
let run = client
.workflows().experiments().runs()
.create(CreateParams::new(body))
.await?;
println!("{} {:?}", run.id, run.lifecycle);
// Wait for the run to complete, then read metrics.
let mut params = MetricsGetParams::new(&run.id);
params.view = Some(ExperimentRunMetricsView::Summary);
let _metrics = client.workflows().experiments().metrics().get(params).await?;
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->workflows()->experiments()->runs()->create(
experimentId: 'exp_abc123',
);
print_r($result);
using Retab;
using RetabClient = Retab.Retab;
var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
var client = new RetabClient(apiKey);
var result = await client.Workflows.Experiments.Runs.CreateAsync(new ExperimentRunsCreateOptions());
Console.WriteLine(result);
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
result = client.workflows.experiments.runs.create
puts 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().experiments().runs().create("exp_abc123", "wf_abc123", null);
System.out.println(result);
}
}
# Default — use the experiment's stored n_consensus and document set.
curl -X 'POST' \
'https://api.retab.com/v1/workflows/experiments/runs' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <your-api-key>' \
-d '{
"experiment_id": "exp_abc",
"workflow_id": "wf_abc123"
}'
{
"id": "exprun_2",
"workflow": {
"workflow_id": "wf_abc123",
"version_id": "draft_2026_05_18"
},
"trigger": { "type": "api" },
"lifecycle": { "status": "pending" },
"timing": {
"created_at": "2026-05-18T10:00:00Z",
"started_at": null,
"completed_at": null
},
"experiment_id": "exp_abc",
"block_id": "extract-invoice",
"block_kind": "extract",
"block_execution_fingerprint": "0ff93ddc7cefcb42",
"documents_fingerprint": "ddd95baadce6045f",
"total_document_count": 12,
"completed_document_count": 0,
"error_count": 0,
"n_consensus": 5
}
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Request body to create an experiment run.
workflow_id is optional; when omitted it is taken from the experiment,
and when supplied it must match the experiment's workflow.
The experiment to create a run for.
Optional. When omitted, the workflow is derived from the experiment record. When supplied, must match the experiment's workflow_id (404 otherwise).
Optional short-lived token returned by the run-plan preview. When supplied, run creation rejects if the current plan no longer matches the preview.
Response
Successful Response
A single execution of an experiment, identified by id.
Show child attributes
Show child attributes
extract, classifier, split, for_each 3, 5, 7 The experiment run has been created but execution has not started.
- PendingWorkflowExperimentRun
- QueuedWorkflowExperimentRun
- RunningWorkflowExperimentRun
- CompletedWorkflowExperimentRun
- ErrorWorkflowExperimentRun
- CancelledWorkflowExperimentRun
Show child attributes
Show child attributes
Show child attributes
Show child attributes