Skip to main content
PUT
/
v2
/
workflows
/
{workflow_id}
/
curl -X PUT 'https://api.anyformat.ai/v2/workflows/550e8400-e29b-41d4-a716-446655440000/' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Invoice Processing",
    "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"}]
  }'
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Invoice Processing",
  "description": null,
  "created_at": "2024-03-24T12:00:00.000Z",
  "updated_at": "2025-06-17T09:42:11.000Z",
  "fields": [
    {"name": "invoice_number", "description": "The unique invoice identifier", "data_type": "string"},
    {"name": "total_amount", "description": "Total invoice amount including tax", "data_type": "float"}
  ]
}
PUT /v2/workflows/{workflow_id}/ accepts the same typed graph shape as POST /v2/workflows/ and replaces the workflow’s definition atomically. Each call mints a new workflow version; earlier versions remain attached to past runs.
Today’s update is a full replacement — send the complete nodes and edges you want the new version to have, not a delta. To change one field on a 60-field workflow, re-send the full graph with that one field swapped. A round-trippable GET-then-PUT helper is on the SDK roadmap.

Recipe — change one field’s data type or options

The Python SDK builds the typed graph for you. The example below recreates a one-extract-node workflow and updates the category_taxonomy field to be an enum.
Python (anyformat SDK)
from anyformat import Client, Schema

client = Client(api_key="YOUR_API_KEY")

new_options = [
    Schema.option("invoice", "Vendor bill or invoice"),
    Schema.option("receipt", "Point-of-sale receipt"),
    Schema.option("statement", "Account statement"),
]

(
    client.workflow("Invoice Processing")
    .parse()
    .extract([
        Schema.string("invoice_number", "The unique invoice identifier"),
        Schema.float("total_amount", "Total invoice amount including tax"),
        Schema.enum(
            "category_taxonomy",
            "Document category",
            options=new_options,
        ),
        # …the remaining fields, unchanged
    ])
    .update("550e8400-e29b-41d4-a716-446655440000")
)

Request body

Same shape as POST /v2/workflows/ — a typed graph of nodes (parse / classify / splitter / extract) and edges.
FieldTypeRequiredDescription
namestringYesWorkflow name
descriptionstringNoOptional description
nodesNode[]YesAt least one node; exactly one must be type="parse"
edgesEdge[]NoDirected edges between nodes
curl -X PUT 'https://api.anyformat.ai/v2/workflows/550e8400-e29b-41d4-a716-446655440000/' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Invoice Processing",
    "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"}]
  }'
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Invoice Processing",
  "description": null,
  "created_at": "2024-03-24T12:00:00.000Z",
  "updated_at": "2025-06-17T09:42:11.000Z",
  "fields": [
    {"name": "invoice_number", "description": "The unique invoice identifier", "data_type": "string"},
    {"name": "total_amount", "description": "Total invoice amount including tax", "data_type": "float"}
  ]
}

Authorizations

Authorization
string
header
required

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

Path Parameters

workflow_id
string
required

Body

application/json

Public-surface workflow update body — full replacement of the typed graph.

Thin subclass for OpenAPI naming (WorkflowUpdateRequest). 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

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.