Skip to main content
PATCH
/
v1
/
workflows
/
{workflow_id}
/
block-tests
/
{test_id}
from retab import Retab

client = Retab()

# Rename only.
test = client.workflows.tests.update(
    workflow_id="wf_abc123xyz",
    test_id="wfnodetest_hsLEQiM61ez9Piv147MWk",
    name="Q1 invoice — vendor name check",
)

# Replace the assertion.
test = client.workflows.tests.update(
    workflow_id="wf_abc123xyz",
    test_id="wfnodetest_hsLEQiM61ez9Piv147MWk",
    assertion={
        "target": {"output_handle_id": "output-json-0", "path": "vendor.name"},
        "condition": {"kind": "matches_regex", "expected": r"^Acme.*"},
    },
)

# Re-capture inputs from a different run.
test = client.workflows.tests.update(
    workflow_id="wf_abc123xyz",
    test_id="wfnodetest_hsLEQiM61ez9Piv147MWk",
    source={
        "type": "run_step",
        "run_id": "wfrun_new789",
        "step_id": "block_extract_invoice",
    },
)
{
  "id": "wfnodetest_hsLEQiM61ez9Piv147MWk",
  "workflow_id": "wf_abc123xyz",
  "organization_id": "org_123",
  "target": { "type": "block", "block_id": "block_extract_invoice" },
  "source": { "type": "manual", "handle_inputs": { "...": "..." } },
  "name": "Q1 invoice — vendor name check",
  "assertion": { "...": "the new assertion" },
  "schema_drift": "fresh",
  "validation_status": "valid",
  "latest_run_summary": null,
  "created_at": "2026-04-08T14:22:26Z",
  "updated_at": "2026-05-01T14:35:00Z"
}

Documentation Index

Fetch the complete documentation index at: https://docs.retab.com/llms.txt

Use this file to discover all available pages before exploring further.

Patch the name, assertion, and/or source of a block test. Every field is optional in the request body — fields you omit are left untouched. Setting assertion: null is rejected explicitly (use Delete Block Test if you want to remove the test entirely). Updating source rebinds where the inputs come from:
  • { type: "manual", handle_inputs: ... } — switch to hand-written inputs.
  • { type: "run_step", run_id: ..., step_id: ... } — re-capture inputs from a different workflow run / step.
The response is the full updated WorkflowTest.
from retab import Retab

client = Retab()

# Rename only.
test = client.workflows.tests.update(
    workflow_id="wf_abc123xyz",
    test_id="wfnodetest_hsLEQiM61ez9Piv147MWk",
    name="Q1 invoice — vendor name check",
)

# Replace the assertion.
test = client.workflows.tests.update(
    workflow_id="wf_abc123xyz",
    test_id="wfnodetest_hsLEQiM61ez9Piv147MWk",
    assertion={
        "target": {"output_handle_id": "output-json-0", "path": "vendor.name"},
        "condition": {"kind": "matches_regex", "expected": r"^Acme.*"},
    },
)

# Re-capture inputs from a different run.
test = client.workflows.tests.update(
    workflow_id="wf_abc123xyz",
    test_id="wfnodetest_hsLEQiM61ez9Piv147MWk",
    source={
        "type": "run_step",
        "run_id": "wfrun_new789",
        "step_id": "block_extract_invoice",
    },
)
{
  "id": "wfnodetest_hsLEQiM61ez9Piv147MWk",
  "workflow_id": "wf_abc123xyz",
  "organization_id": "org_123",
  "target": { "type": "block", "block_id": "block_extract_invoice" },
  "source": { "type": "manual", "handle_inputs": { "...": "..." } },
  "name": "Q1 invoice — vendor name check",
  "assertion": { "...": "the new assertion" },
  "schema_drift": "fresh",
  "validation_status": "valid",
  "latest_run_summary": null,
  "created_at": "2026-04-08T14:22:26Z",
  "updated_at": "2026-05-01T14:35:00Z"
}

Authorizations

Api-Key
string
header
required

Path Parameters

workflow_id
string
required
test_id
string
required

Query Parameters

access_token
string | null
operation_name
string
default:get_ready_gcp_settings

Body

application/json
name
string | null
assertion
AssertionSpec · object

Block-test assertion against one declared output handle.

target is the only supported shape: an output handle id and an optional relative path inside that handle's payload.

handle_inputs
Handle Inputs · object
run_id
string | null
step_id
string | null

Response

Successful Response

workflow_id
string
required
organization_id
string
required
block_id
string
required
block_type
string
required
id
string
captured_from
CapturedFrom · object
captured_at
string<date-time> | null
name
string | null
handle_inputs
Handle Inputs · object
handle_inputs_fingerprint
string
default:""
schema_fingerprint
string
default:""
validation_status
enum<string>
default:valid
Available options:
valid,
warning,
invalid
validation_issues
ValidationIssue · object[]
created_at
string<date-time>
updated_at
string<date-time>
assertion
AssertionSpec · object

Block-test assertion against one declared output handle.

target is the only supported shape: an output handle id and an optional relative path inside that handle's payload.

assertion_schema_dep
AssertionSchemaDep · object

Single-rule schema dependency for Level 2 drift detection.

assertion_drift_status
enum<string> | null
Available options:
valid,
drifted,
broken
schema_drift
enum<string>
default:unknown
Available options:
none,
partial,
drifted,
unknown
schema_drift_detail
string | null
latest_run_summary
LatestBlockTestRunSummary · object
latest_passing_run_summary
LatestBlockTestRunSummary · object
latest_failing_run_summary
LatestBlockTestRunSummary · object