Skip to main content
POST
Create workflow
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 (standard or agentic mode, prompt hints, figure enhancement)
  • 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

Parse Node

The entry-point node. Exactly one per workflow.

Extract Node

Pulls structured fields from upstream parsed content. Field shape — see Field Types. Any field may set "source": "smart_lookup" to make it a smart-lookup field (resolved from a reference file rather than read from the document), or "source": "lookup_if_missing" to extract it too and let the lookup only fill empty slots; the default is "extraction".

Classify Node

Routes the document to one of categories[] based on an LLM verdict. Outgoing edges must set branch to a category id. Each Category:

Splitter Node

Partitions a multi-document file into per-rule sub-documents. Each rule fires an outgoing edge whose branch matches the rule id; the downstream extract node runs once per resulting partition. Each Rule:

Validate Node

Runs after an extract node and emits per-rule validation results. Rules are either AI-evaluated (kind="ai" with a natural-language description) or deterministic (kind="deterministic" with a structured check evaluated in pure Python, no model call). Each Rule: Deterministic check shapes (discriminated on type). Every shape below except expression names its field operands by persistent_id; expression addresses fields by extracted name instead. Example — arithmetic check (subtotal + tax == total, ±1¢):

Edges

Examples

Linear parse → extract

Parse-only with agentic mode

A workflow with just one parse node and no edges. Produces markdown only — no extraction.
Agentic mode routes each block through a typed strategy (text / table / figure) using Gemini for routing. The mode is binary — set mode: "agentic" and you get the full agentic pipeline. See the Agentic Parse to Markdown recipe for an end-to-end walkthrough.

Classify-then-extract (branched)

Each outgoing edge from a classify (or splitter) sets branch to a category/rule .id on the source node. .name is the display label shown to the LLM and is not accepted as a branch value — using it returns 400. In the example below, cat_invoice is the id used for routing; Invoice is the label the classifier sees.

Smart lookup

Enrich extracted values by matching them against a reference file instead of reading them off the page. Flag the looked-up field with "source": "smart_lookup", attach the reference file (inline as base64 via lookup_file_uploads, or by S3 URI via lookup_files), and optionally describe the join with lookup_suggestion. See Smart Lookup for how matching works and the Studio UI equivalent of these fields. Here the model reads vendor_name from the document, then resolves the canonical vendor_id from a vendor catalog:
lookup_file_uploads[].content is the base64-encoded bytes of the reference file (CSV/text). The lookup field (vendor_id) is returned alongside the extraction fields in the results payload — there is no separate response section for it. An extract node that has a source: smart_lookup/lookup_if_missing field but no reference file is rejected with 400.

Topology Rules

The endpoint enforces graph correctness — if any rule is violated, the request returns 400 and nothing is persisted.

Response

201 Created returns the workflow resource:
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/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).

Uses PublicNode (public request models with only the fields callers may set); the domain AnyNode also carries filter (worker-only) and executor-injected / staff-only fields, so the public bodies pin a stricter node schema. Call :meth:to_domain before validating topology or forwarding to the backend.

name
string
required
Minimum string length: 1
Example:

"Invoice or receipt"

nodes
(PublicParseNode · object | ClassifyNode · object | SplitterNode · object | PublicExtractNode · object | PublicValidateNode · object | PublicIfElseNode · object | PublicSlackAlertNode · object)[]
required
Minimum array length: 1
description
string | null
default:""
edges
Edge · object[]

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.