Skip to main content
POST
/
v3
/
workflows
/
curl -X POST 'https://api.anyformat.ai/v3/workflows/' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Invoice Processing",
    "description": "Extract data from invoice documents",
    "nodes": [
      { "id": "parse_1", "type": "parse" },
      {
        "id": "extract_1",
        "type": "extract",
        "extraction_schema": {
          "fields": [
            { "name": "invoice_number", "description": "The unique invoice identifier", "data_type": "string" },
            { "name": "total_amount", "description": "Total invoice amount including tax", "data_type": "float" }
          ]
        }
      }
    ],
    "edges": [ { "source": "parse_1", "target": "extract_1" } ]
  }'
import requests

url = "https://api.anyformat.ai/v3/workflows/"
headers = {"Authorization": "Bearer YOUR_API_KEY"}

body = {
    "name": "Invoice Processing",
    "description": "Extract data from invoice documents",
    "nodes": [
        {"id": "parse_1", "type": "parse"},
        {
            "id": "extract_1",
            "type": "extract",
            "extraction_schema": {
                "fields": [
                    {"name": "invoice_number", "description": "The unique invoice identifier", "data_type": "string"},
                    {"name": "total_amount", "description": "Total invoice amount including tax", "data_type": "float"},
                ]
            },
        },
    ],
    "edges": [{"source": "parse_1", "target": "extract_1"}],
}

workflow = requests.post(url, headers=headers, json=body).json()
print(workflow["id"])
{
  "id": "0686bb97-8c30-70f0-8000-97669e000eb8",
  "name": "Invoice Processing",
  "description": "Extract data from invoice documents",
  "created_at": "2026-07-01T12:00:00.000Z",
  "updated_at": "2026-07-01T12:00:00.000Z"
}
{
  "error": "Validation failed",
  "detail": {
    "message": "Workflow graph has 1 violation",
    "violations": [
      {
        "rule": "single_parse_entrypoint",
        "message": "Exactly one parse node is required",
        "node_ids": []
      }
    ]
  },
  "error_code": "TOPOLOGY_INVALID",
  "retryable": false,
  "request_id": "a1b2c3d4e5f67890abcdef1234567890"
}
Rate limit tier: general (600 req/min) — see Rate limits.
We recommend creating workflows in the anyformat platform, where you can visually configure fields, test with sample documents, and iterate faster. Once your workflow is ready, copy its ID and use it with the API to run documents programmatically.
Creates a workflow from a strongly-typed graph, atomically. The body is the same {name, description, nodes, edges} shape POST /v2/workflows/ accepts — node types, field types, and validation rules are documented in depth on the v2 create page and in Field types; the graph model itself did not change in v3. A body that violates graph topology (e.g. no parse node, an orphaned extract node) is rejected with 400 TOPOLOGY_INVALID; detail.violations lists each broken rule with the offending node ids. Fetch the stored graph back — with server-assigned persistent_ids on every field — via GET /v3/workflows/{workflow_id}/.
curl -X POST 'https://api.anyformat.ai/v3/workflows/' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Invoice Processing",
    "description": "Extract data from invoice documents",
    "nodes": [
      { "id": "parse_1", "type": "parse" },
      {
        "id": "extract_1",
        "type": "extract",
        "extraction_schema": {
          "fields": [
            { "name": "invoice_number", "description": "The unique invoice identifier", "data_type": "string" },
            { "name": "total_amount", "description": "Total invoice amount including tax", "data_type": "float" }
          ]
        }
      }
    ],
    "edges": [ { "source": "parse_1", "target": "extract_1" } ]
  }'
import requests

url = "https://api.anyformat.ai/v3/workflows/"
headers = {"Authorization": "Bearer YOUR_API_KEY"}

body = {
    "name": "Invoice Processing",
    "description": "Extract data from invoice documents",
    "nodes": [
        {"id": "parse_1", "type": "parse"},
        {
            "id": "extract_1",
            "type": "extract",
            "extraction_schema": {
                "fields": [
                    {"name": "invoice_number", "description": "The unique invoice identifier", "data_type": "string"},
                    {"name": "total_amount", "description": "Total invoice amount including tax", "data_type": "float"},
                ]
            },
        },
    ],
    "edges": [{"source": "parse_1", "target": "extract_1"}],
}

workflow = requests.post(url, headers=headers, json=body).json()
print(workflow["id"])
{
  "id": "0686bb97-8c30-70f0-8000-97669e000eb8",
  "name": "Invoice Processing",
  "description": "Extract data from invoice documents",
  "created_at": "2026-07-01T12:00:00.000Z",
  "updated_at": "2026-07-01T12:00:00.000Z"
}
{
  "error": "Validation failed",
  "detail": {
    "message": "Workflow graph has 1 violation",
    "violations": [
      {
        "rule": "single_parse_entrypoint",
        "message": "Exactly one parse node is required",
        "node_ids": []
      }
    ]
  },
  "error_code": "TOPOLOGY_INVALID",
  "retryable": false,
  "request_id": "a1b2c3d4e5f67890abcdef1234567890"
}

Authorizations

Authorization
string
header
required

API key issued from app.anyformat.ai/api-key. Send as Authorization: Bearer <key>.

Body

application/json

Public-surface workflow create body — typed graph of parse / classify / splitter / extract / validate nodes.

A validate node carries rules; each rule is either AI-evaluated (kind="ai" + a natural-language description) or deterministic (kind="deterministic" + a structured check, evaluated in pure Python with no model call).

Defined as a thin subclass so the FastAPI-generated OpenAPI components entry is named WorkflowCreateRequest (FastAPI uses the model's __name__). Behaviour is fully inherited from WorkflowDefinition in anyformat.workflow.

name
string
required
Minimum string length: 1
Example:

"Invoice or receipt"

nodes
(ParseNode · object | ClassifyNode · object | SplitterNode · object | ExtractNode · object | ValidateNode · object)[]
required
Minimum array length: 1
description
string | null
default:""
edges
Edge · object[]

Response

Successful Response

Slim workflow projection returned by create and list.

id
string
required

Unique identifier of the workflow (hyphenated UUID).

Example:

"0686bb97-8c30-70f0-8000-97669e000eb8"

name
string
required

Human-readable name of the workflow.

Example:

"Invoice Processing"

description
string | null

Optional description of what this workflow extracts.

Example:

"A workflow for processing invoices and retrieving invoice details."

created_at
string<date-time> | null

Timestamp when the workflow was created (ISO 8601).

updated_at
string<date-time> | null

Timestamp when the workflow was last modified (ISO 8601).