API v2: Agentic Workflows

Launch and manage Agentic Workflow runs on your documents

The v2 API lets you launch Agentic Workflow runs against your documents. A workflow is a long-running batch operation that processes one or many documents (summarizing, extracting data, humanizing text, and more).

Runs execute asynchronously: you submit a run, receive an ID, and poll for results.

Base Endpoint

https://api.docanalyzer.ai/api/v2

Authentication

Same as v1: include your API key in every request:

Authorization: Bearer DOCANALYZER_API_KEY

See API Documentation for prerequisites and key management.


List Workflows (GET /api/v2/agents)

Returns all Agentic Workflows available to your account, including their accepted parameters, context keys, and configurable blocks.

Example

curl https://api.docanalyzer.ai/api/v2/agents \
    -H "Authorization: Bearer $DOCANALYZER_API_KEY"

Response

{
  "data": [
    {
      "id": "summarizer",
      "label": "Summarizer",
      "description": "Summarize one or batches of many documents...",
      "context": {
        "sources": { "accept": ["docid"], "maxTokensPerDoc": "..." }
      },
      "model": {
        "accept": ["anthropic/claude-sonnet-4-6", "..."],
        "default": "anthropic/claude-sonnet-4-6"
      },
      "params": ["cbudget", "density", "lang", "reference", "ocap"],
      "blocks": {
        "length": {
          "type": "enum",
          "values": ["brief", "concise", "detailed", "comprehensive"],
          "default": "concise",
          "label": "Length"
        },
        "mode": {
          "type": "enum",
          "values": ["paragraph", "bullet", "hybrid"],
          "default": "paragraph",
          "label": "Mode"
        },
        "style": {
          "type": "enum",
          "values": [
            "neutral",
            "academic",
            "business",
            "casual",
            "humorous",
            "journalistic",
            "persuasive",
            "technical"
          ],
          "default": "neutral",
          "label": "Style"
        }
      }
    }
  ]
}

Submit a Run (POST /api/v2/run)

Launch a workflow run. The run is queued and processed asynchronously.

Request Body

{
  "agent": "summarizer",
  "context": {
    "sources": ["da6pvxq9avzwhnb3", "dt7xxnv398z26yv3"]
  },
  "params": {
    "model": "anthropic/claude-sonnet-4-6",
    "thinking": "medium"
  },
  "blocks": {
    "prompt": "Summarize the key findings",
    "length": "detailed",
    "style": "business"
  },
  "webhook": "https://example.com/hooks/coppersmith"
}
Field Required Description
agent yes Workflow ID from GET /agents
context yes Keyed collections of document IDs; keys must match the workflow's context definition
params no Inference parameters (see below)
blocks depends Workflow-specific configuration; some workflows require a prompt block
webhook no URL to POST on terminal status (completed, failed, cancelled)

Params

Parameters control model selection and inference behavior. Which params a workflow accepts is listed in the GET /agents response.

Param Type Description
model string Model ID (defaults to the workflow's default model)
cbudget number Credit budget; defaults to baseline for the model and context size
thinking string Thinking effort: low, medium, high (model-dependent)
density integer Context density multiplier (default: 1)
lang string Response language
reference boolean Include document references in output
ocap number Output token limit
pcap number Prompt cap fraction (0.05–0.6)

Response

{
  "id": "run_a1b2c3d4e5f6",
  "status": "queued",
  "created_at": "2026-03-09T14:30:00Z"
}

Errors

  • 400: Invalid workflow, model, params, blocks, or context keys
  • 403: Insufficient credits (estimated cost exceeds balance)
  • 429: Rate limited

Get Run Status (GET /api/v2/run/:runid)

Poll for run status and results.

Example

curl https://api.docanalyzer.ai/api/v2/run/run_a1b2c3d4e5f6 \
    -H "Authorization: Bearer $DOCANALYZER_API_KEY"

Response

{
  "id": "run_a1b2c3d4e5f6",
  "status": "completed",
  "created_at": "2026-03-09T14:30:00Z",
  "output": {
    "data": [
      {
        "docid": "da6pvxq9avzwhnb3",
        "output": "Summary of the first document..."
      },
      {
        "docid": "dt7xxnv398z26yv3",
        "output": "Summary of the second document..."
      }
    ]
  }
}

Status Lifecycle

queued → running → completed
                 → failed
                 → cancelled
  • output is included only on terminal status (completed or failed).
  • On failure, output.error.detail contains the error message.

Cancel a Run (POST /api/v2/run/:runid/cancel)

Cancel a queued run. Only runs in queued status can be cancelled. Returns 409 if the run is already running or completed.

Example

curl -X POST https://api.docanalyzer.ai/api/v2/run/run_a1b2c3d4e5f6/cancel \
    -H "Authorization: Bearer $DOCANALYZER_API_KEY"

Response

{
  "id": "run_a1b2c3d4e5f6",
  "status": "cancelled",
  "created_at": "2026-03-09T14:30:00Z"
}

Available Agentic Workflows

Summarizer (summarizer)

Summarize one or many documents. Each document is processed individually.

Context: sources (one or more document IDs)

Blocks:

Block Type Values Default
length enum brief, concise, detailed, comprehensive concise
mode enum paragraph, bullet, hybrid paragraph
style enum neutral, academic, business, casual, humorous, journalistic, persuasive, technical neutral

Example:

curl -X POST https://api.docanalyzer.ai/api/v2/run \
    -H "Authorization: Bearer $DOCANALYZER_API_KEY" \
    -H "Content-Type: application/json" \
    --data '{
      "agent": "summarizer",
      "context": { "sources": ["da6pvxq9avzwhnb3"] },
      "blocks": { "length": "brief", "style": "business" }
    }'

Blueprint (blueprint)

Use reference documents as a blueprint to guide AI analysis of other documents: checking consistency, applying rules and standards.

Context:

  • sources: documents to analyze
  • blueprint: reference documents (the blueprint)

Blocks:

Block Type Required
prompt string yes

Example:

curl -X POST https://api.docanalyzer.ai/api/v2/run \
    -H "Authorization: Bearer $DOCANALYZER_API_KEY" \
    -H "Content-Type: application/json" \
    --data '{
      "agent": "blueprint",
      "context": {
        "sources": ["da6pvxq9avzwhnb3"],
        "blueprint": ["dref123abc456def"]
      },
      "blocks": { "prompt": "Check these documents against the style guide" }
    }'

Data Extractor (extractor)

Extract structured data from documents. Each document is processed individually and returns JSON output.

Context: sources (one or more document IDs)

Blocks:

Block Type Required Description
points array yes Data points to extract; each with name, type (string, number, boolean), and description

Example:

curl -X POST https://api.docanalyzer.ai/api/v2/run \
    -H "Authorization: Bearer $DOCANALYZER_API_KEY" \
    -H "Content-Type: application/json" \
    --data '{
      "agent": "extractor",
      "context": { "sources": ["da6pvxq9avzwhnb3"] },
      "blocks": {
        "points": [
          { "name": "company_name", "type": "string", "description": "The company name" },
          { "name": "total_revenue", "type": "number", "description": "Total revenue in USD" },
          { "name": "profitable", "type": "boolean", "description": "Whether the company is profitable" }
        ]
      }
    }'

Individual (individual)

Run the same prompt against each document individually, producing one answer per document.

Context: sources (one or more document IDs)

Blocks:

Block Type Required
prompt string yes

Individual JSON (individual-json)

Same as Individual but returns structured JSON output per document. Your prompt must define the desired JSON format.

Context: sources (one or more document IDs)

Blocks:

Block Type Required
prompt string yes

Webhook

When a webhook URL is provided, docAnalyzer POSTs the final run object (same shape as the GET /run/:runid response) to that URL on any terminal status.


Rate Limits

The same rate limits apply as v1. See API Documentation: Rate Limits.


Credit Usage

Each run consumes credits based on the workflow, model, number of documents, and credit budget. Credits are checked before the run starts; if your balance is insufficient, the run is rejected with a 403 error.

Use GET /api/v1/credits to check your balance.

Was this helpful?