> ## Documentation Index
> Fetch the complete documentation index at: https://uiform-codex-generated-frontend-snippets.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Validate Block Config

> Validate an assembled block config without mutating the workflow draft.

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 Python theme={null}
import os
import requests

response = requests.post(
    "https://api.retab.com/v1/workflows/blocks/extract-1/validate-config",
    headers={"Authorization": f"Bearer {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 TypeScript theme={null}
const response = await fetch(
  "https://api.retab.com/v1/workflows/blocks/extract-1/validate-config",
  {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${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 Go theme={null}
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("Authorization", "Bearer "+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 Java theme={null}
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("Authorization", "Bearer " + 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());
```

```bash cURL theme={null}
curl --request POST \
  'https://api.retab.com/v1/workflows/blocks/extract-1/validate-config' \
  --header "Authorization: Bearer $RETAB_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "config": {
      "model": "retab-small",
      "json_schema": {"type": "object", "properties": {}}
    },
    "config_mode": "replace"
  }'
```


## OpenAPI

````yaml POST /v1/workflows/blocks/{block_id}/validate-config
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.retab.com
security: []
paths:
  /v1/workflows/blocks/{block_id}/validate-config:
    post:
      tags:
        - Workflows
        - Workflow Blocks
      summary: Validate Block Config
      description: Validate an assembled block config without mutating the workflow draft.
      operationId: validate_block_config
      parameters:
        - in: path
          name: block_id
          required: true
          schema:
            type: string
            title: Block Id
        - in: query
          name: workflow_id
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Workflow ID to disambiguate legacy duplicate block IDs. Omit for
              normal server-generated block IDs.
            title: Workflow Id
          required: false
          description: >-
            Workflow ID to disambiguate legacy duplicate block IDs. Omit for
            normal server-generated block IDs.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ValidateWorkflowBlockConfigRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidateWorkflowBlockConfigResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ValidateWorkflowBlockConfigRequest:
      properties:
        config:
          additionalProperties: true
          type: object
          title: Config
          description: Assembled block config to validate.
        config_mode:
          anyOf:
            - type: string
              enum:
                - merge
                - replace
            - type: 'null'
          title: Config Mode
          description: >-
            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.
          default: replace
      type: object
      required:
        - config
      title: ValidateWorkflowBlockConfigRequest
      description: Dry-run validation for an assembled workflow block config.
    ValidateWorkflowBlockConfigResponse:
      properties:
        ok:
          type: boolean
          title: Ok
          default: true
        workflow_id:
          type: string
          title: Workflow Id
        block_id:
          type: string
          title: Block Id
        block_type:
          type: string
          title: Block Type
        config_hash:
          type: string
          title: Config Hash
      type: object
      required:
        - block_id
        - block_type
        - config_hash
        - workflow_id
      title: ValidateWorkflowBlockConfigResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
          default: []
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
          default: null
        ctx:
          type: object
          title: Context
          default: {}
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````