Skip to main content
POST
/
v2
/
workflows
Create workflow
curl --request POST \
  --url https://api.anyformat.ai/v2/workflows/ \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "fields": [
    {
      "name": "<string>",
      "description": "<string>",
      "data_type": "<string>"
    }
  ],
  "description": "Extracts invoice number, vendor, total, and line items."
}
'
{
  "id": "<string>",
  "name": "<string>",
  "description": "A workflow for processing invoices and retrieving invoice details.",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "fields": [
    {}
  ]
}

Documentation Index

Fetch the complete documentation index at: https://docs.anyformat.ai/llms.txt

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

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 workflows programmatically.
POST /v2/workflows/ creates a workflow from a strongly-typed graph. Use it to:
  • Configure parse-node settings (engine, agentic mode, effort, prompt hints)
  • Build parse-only workflows (no extract node — markdown only)
  • Route documents through classifiers or splitters to multiple extract nodes
  • Run simple linear parse → extract workflows

Request Body

FieldTypeRequiredDescription
namestringYesWorkflow name
descriptionstringNoOptional description
nodesNode[]YesAt least one node; exactly one must be type="parse"
edgesEdge[]NoDirected edges; empty for parse-only workflows

Parse Node

The entry-point node. Exactly one per workflow.
FieldTypeDefaultDescription
idstringStable identifier (e.g. "parse_1")
type"parse"Discriminator
engine"Fast" | "Performant""Fast"Parser engine
mode"standard" | "agentic""standard"Use "agentic" for per-block LLM routing through typed strategies (text/table/figure)
effort"low" | "mid" | "accurate""mid" when mode="agentic"; must be omitted otherwiseEffort preset for agentic mode
prompt_hintstringnullDomain hint shown to the parser (e.g. “medical lab report, preserve numerics exactly”)
figure_enhancement_enabledbooleanfalseExtract structured descriptions of charts and images (extra LLM cost)
visual_grounding_enabledbooleantruePer-block visual parsing with bounding boxes

Extract Node

Pulls structured fields from upstream parsed content.
FieldTypeRequiredDescription
idstringYesStable identifier
type"extract"YesDiscriminator
extraction_schemaobjectYes{ "fields": [...] } — at least one field
use_imagesbooleanNo (default false)Pass rendered page images to the extraction model
Field shape — see Field Types.

Classify / Splitter Nodes

Branch routing nodes — see Field Types and the splitter cookbook recipes.

Edges

FieldTypeRequiredDescription
sourcestringYesSource node id
targetstringYesTarget node id
branchstringConditionalRequired when leaving a classify (category id) or splitter (rule id) node; forbidden otherwise

Examples

Linear parse → extract

curl -X POST 'https://api.anyformat.ai/v2/workflows/' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -d '{
    "name": "Invoice extractor",
    "nodes": [
      {"id": "parse_1", "type": "parse"},
      {
        "id": "extract_1",
        "type": "extract",
        "extraction_schema": {
          "fields": [
            {"name": "invoice_number", "description": "Invoice ID", "data_type": "string"},
            {"name": "total", "description": "Grand total", "data_type": "float"}
          ]
        }
      }
    ],
    "edges": [{"source": "parse_1", "target": "extract_1"}]
  }'

Parse-only with agentic mode

A workflow with just one parse node and no edges. Produces markdown only — no extraction.
curl -X POST 'https://api.anyformat.ai/v2/workflows/' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -d '{
    "name": "Agentic parse-only",
    "nodes": [
      {
        "id": "parse_1",
        "type": "parse",
        "mode": "agentic",
        "effort": "mid"
      }
    ],
    "edges": []
  }'
Agentic mode routes each block through a typed strategy (text / table / figure) using Gemini for routing. effort picks a model mix — "low" (fast/cheap), "mid" (balanced, default), "accurate" (best quality, slowest). Use the Agentic Parse to Markdown cookbook for an end-to-end recipe.

Classify-then-extract (branched)

curl -X POST 'https://api.anyformat.ai/v2/workflows/' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -d '{
    "name": "Multi-doc",
    "nodes": [
      {"id": "parse_1", "type": "parse"},
      {
        "id": "classify_1",
        "type": "classify",
        "categories": [
          {"id": "INVOICE", "name": "Invoice", "description": "Vendor invoice."},
          {"id": "RECEIPT", "name": "Receipt", "description": "POS receipt."}
        ]
      },
      {
        "id": "extract_invoice",
        "type": "extract",
        "extraction_schema": {"fields": [{"name": "vendor", "description": "Vendor name.", "data_type": "string"}]}
      },
      {
        "id": "extract_receipt",
        "type": "extract",
        "extraction_schema": {"fields": [{"name": "merchant", "description": "Merchant name.", "data_type": "string"}]}
      }
    ],
    "edges": [
      {"source": "parse_1", "target": "classify_1"},
      {"source": "classify_1", "target": "extract_invoice", "branch": "INVOICE"},
      {"source": "classify_1", "target": "extract_receipt", "branch": "RECEIPT"}
    ]
  }'

Topology Rules

The endpoint enforces graph correctness — if any rule is violated, the request returns 400 and nothing is persisted.
RuleMessage
Exactly one parse nodeworkflow must contain exactly one \parse` node`
Unique node idsduplicate node ids: [...]
Edges reference existing nodesedge source X not in nodes / edge target Y not in nodes
Edge predecessor compatibilityextract does not accept extract as predecessor
Branch routingedge from classify X requires \branch` to be set`
No fan-out from non-routersnode Y (extract) has 3 outgoing edges; only classify and splitter may fan out

Response

201 Created returns the workflow resource:
{
  "id": "0686bb97-8c30-70f0-8000-97669e000eb8",
  "name": "Invoice extractor",
  "description": "",
  "created_at": "2026-05-11T10:00:00Z",
  "updated_at": "2026-05-11T10:00:00Z"
}
Save the id — you’ll reuse it when uploading documents and fetching results.

Next Steps

Agentic Parse to Markdown

End-to-end recipe: create → upload → results, with the new agentic parse mode

Parse-Only Workflow

Convert documents to markdown without extraction

Field Types

All supported data_type values for extraction fields

Response Formats

The shape of parse, extractions, splits, and classifications on the results endpoint

Authorizations

Authorization
string
header
required

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

Body

application/json

Request schema for creating a workflow.

name
string
required

Workflow name

Minimum string length: 1
Example:

"Invoice Processing"

fields
(StringFieldDef · object | IntegerFieldDef · object | FloatFieldDef · object | BooleanFieldDef · object | DateFieldDef · object | DatetimeFieldDef · object | EnumFieldDef · object | MultiSelectFieldDef · object | ObjectFieldDef · object)[]
required

Field definitions. Each entry's shape is determined by its data_type.

Minimum array length: 1
Example:
[
{
"data_type": "string",
"name": "invoice_number"
}
]
description
string | null
default:""

Workflow description

Example:

"Extracts invoice number, vendor, total, and line items."

Response

Successful Response

A workflow defines the extraction template — what fields to extract from documents, their types, and validation rules.

id
string
required

Unique identifier of the workflow (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).

fields
Fields · object[] | null

List of extraction field definitions configured for this workflow. null if not yet configured.