Official beta
We are in official beta.

DocFlow API Reference

201 endpoints across 19 categories. Every operation available via a single POST request.

Authentication

All API requests require an API key. Include it in the X-API-Key header with every request.

HTTP Header
X-API-Key: df_your_api_key_here

You can also pass the key as a Bearer token or ?apiKey= query parameter, but the header method is recommended.

Token System

Each operation costs tokens. Tokens are deducted on successful completion only. Response headers include:

  • X-Tokens-Used — tokens consumed by this request
  • X-Tokens-Remaining — your remaining balance

Base URL

https://docbutterfly.com

All endpoint paths below are relative to this base URL.

Error Codes

StatusMeaningResolution
400Bad RequestCheck your request body and parameters
401UnauthorizedInvalid or missing API key
402Payment RequiredInsufficient tokens — top up your balance
403ForbiddenAccount deactivated
500Server ErrorInternal error — contact support
503Service UnavailableRequired service not configured (e.g. Graph API, DocuSign)

Paper Sizes

Every PDF-producing endpoint resolves paper against one shared table. The parameter is pageSize (inside options where the endpoint has an options bag; the legacy keys format, paperSize, and size are still read). The default is Letter when no size is given. An unknown size, unit, or orientation returns 400 with the valid values listed — nothing ever falls back silently to another size.

NameInchesMillimetersPointsNotes
Letter8.5 × 11216 × 279612 × 792Default. Aliases: US Letter, ANSI A
Legal8.5 × 14216 × 356612 × 1008Alias: US Legal
Tabloid11 × 17279 × 432792 × 1224Alias: ANSI B
Ledger17 × 11432 × 2791224 × 792Landscape by definition
Executive7.25 × 10.5184 × 267522 × 756
Statement5.5 × 8.5140 × 216396 × 612Aliases: Half Letter, Invoice
Folio8.5 × 13216 × 330612 × 936Alias: Foolscap
A033.11 × 46.81841 × 11892383.94 × 3370.39Too large for DOCX output
A123.39 × 33.11594 × 8411683.78 × 2383.94Too large for DOCX output
A216.54 × 23.39420 × 5941190.55 × 1683.78Too large for DOCX output
A311.69 × 16.54297 × 420841.89 × 1190.55
A48.27 × 11.69210 × 297595.28 × 841.89
A55.83 × 8.27148 × 210419.53 × 595.28
A64.13 × 5.83105 × 148297.64 × 419.53
B49.84 × 13.9250 × 353708.66 × 1000.63ISO B4
B56.93 × 9.84176 × 250498.9 × 708.66ISO B5

Names are case- and punctuation-insensitive (us-letter, US Letter, and LETTER all work). The A-series also accepts ISO A4-style spellings.

Orientation

Pass orientation alongside the size: "portrait" or "landscape". Landscape means the long edge is horizontal — it normalizes rather than blindly swapping, so asking for landscape Ledger (already landscape) leaves it alone. Omit it to keep the size's own orientation.

Custom dimensions

Instead of a name, pageSize accepts an object:

JSON
{ "options": { "pageSize": { "width": 4, "height": 6, "units": "in" } } }

units is one of pt (default), px (CSS pixels, 1/96 in), in, mm, cm. Each side must be between 1 pt and 14400 pt (200 in) — the PDF format's own limit.

Where it applies

ConvertHtmlToPdf, ConvertMarkdownToPdf, ConvertDocxToPdf, ConvertTextToPdf, CaptureWebPage (PDF output), and ComposeFill (PDF output) accept the full vocabulary above. ConvertHtmlToDocx accepts it too, except A0-A2 (a Word page edge may not exceed 22 in). GenerateTemplateFromData accepts the named sizes only (they set the template's @page rule). ResizePdfPages takes explicit numeric width/height — use the points column above.

Rate Limits

Currently there are no hard rate limits. The Azure Functions Consumption plan handles auto-scaling. Heavy operations (browser-based) may take 3-10 seconds on cold start.


Endpoint Categories