Skip to main content
POST
/
v1
/
workflows
/
blocks
/
{block_id}
/
validate-config
Validate Block Config
curl --request POST \
  --url https://api.retab.com/v1/workflows/blocks/{block_id}/validate-config \
  --header 'Api-Key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "config": {},
  "config_mode": "replace"
}
'
{
  "workflow_id": "<string>",
  "block_id": "<string>",
  "block_type": "<string>",
  "config_hash": "<string>",
  "ok": true
}
Dry-run an assembled block config against the target block without mutating the workflow draft. Use this before pushing a locally edited block config bundle when you want the backend to apply the same validation policy used by block updates.
Python
import os
import requests

response = requests.post(
    "https://api.retab.com/v1/workflows/blocks/extract-1/validate-config",
    headers={"Api-Key": os.environ["RETAB_API_KEY"]},
    json={
        "config": {
            "model": "retab-small",
            "json_schema": {"type": "object", "properties": {}},
        },
        "config_mode": "replace",
    },
)
response.raise_for_status()
print(response.json()["config_hash"])
TypeScript
const response = await fetch(
  "https://api.retab.com/v1/workflows/blocks/extract-1/validate-config",
  {
    method: "POST",
    headers: {
      "Api-Key": process.env.RETAB_API_KEY!,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      config: {
        model: "retab-small",
        json_schema: { type: "object", properties: {} },
      },
      config_mode: "replace",
    }),
  },
);

if (!response.ok) throw new Error(await response.text());
console.log((await response.json()).config_hash);
Go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"log"
	"net/http"
	"os"
)

func main() {
	body, _ := json.Marshal(map[string]any{
		"config": map[string]any{
			"model":       "retab-small",
			"json_schema": map[string]any{"type": "object", "properties": map[string]any{}},
		},
		"config_mode": "replace",
	})

	req, _ := http.NewRequest(
		"POST",
		"https://api.retab.com/v1/workflows/blocks/extract-1/validate-config",
		bytes.NewReader(body),
	)
	req.Header.Set("Api-Key", os.Getenv("RETAB_API_KEY"))
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	defer res.Body.Close()

	var payload map[string]any
	if err := json.NewDecoder(res.Body).Decode(&payload); err != nil {
		log.Fatal(err)
	}
	fmt.Println(payload["config_hash"])
}
Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

var body = """
  {
    "config": {
      "model": "retab-small",
      "json_schema": {"type": "object", "properties": {}}
    },
    "config_mode": "replace"
  }
  """;

var request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.retab.com/v1/workflows/blocks/extract-1/validate-config"))
    .header("Api-Key", System.getenv("RETAB_API_KEY"))
    .header("Content-Type", "application/json")
    .POST(HttpRequest.BodyPublishers.ofString(body))
    .build();

var response = HttpClient.newHttpClient()
    .send(request, HttpResponse.BodyHandlers.ofString());

System.out.println(response.body());
cURL
curl --request POST \
  'https://api.retab.com/v1/workflows/blocks/extract-1/validate-config' \
  --header "Api-Key: $RETAB_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "config": {
      "model": "retab-small",
      "json_schema": {"type": "object", "properties": {}}
    },
    "config_mode": "replace"
  }'

Authorizations

Api-Key
string
header
required

Path Parameters

block_id
string
required

Query Parameters

workflow_id
string | null

Workflow ID to disambiguate legacy duplicate block IDs. Omit for normal server-generated block IDs.

Body

application/json

Dry-run validation for an assembled workflow block config.

config
Config · object
required

Assembled block config to validate.

config_mode
enum<string> | null
default:replace

How to apply the config before validation. 'replace' validates the config as the full block config; 'merge' validates the result of merging it into the existing block config.

Available options:
merge,
replace

Response

Successful Response

workflow_id
string
required
block_id
string
required
block_type
string
required
config_hash
string
required
ok
boolean
default:true