Official beta
We are in official beta.

Format Conversion

Convert between PDF, HTML, image, and text formats

24 endpoints in this category. All require X-API-Key header.


Convert HTML to PDF

POST /api/ConvertHtmlToPdf 1 token

Converts an HTML string to a PDF document using a headless Chromium browser.

Parameters
NameTypeRequiredDescription
html string required HTML content to convert
returnBase64 boolean optional Return base64 JSON or raw binary (default: true)
options.pageSize string optional Named paper size — see the paper-size table on the API reference overview. Case- and punctuation-insensitive; aliases such as "US Letter" are accepted. Via raw JSON a custom size object is also accepted: {"width": n, "height": n, "units": "pt|px|in|mm|cm"} (units default pt; 1-14400pt / 200in per side). An unknown size, unit, or orientation returns 400 — nothing silently falls back. Legacy key options.format is still accepted (default: Letter)
options.orientation string optional Page orientation. "landscape" puts the long edge horizontal. Omit to keep the size's own orientation (portrait for every named size except Ledger)
options.printBackground boolean optional Include CSS backgrounds
options.margin object optional { top, right, bottom, left } in CSS units
Request Example
JSON
{"html": "<h1>Hello World</h1>\n<p>Generated by DocFlow.</p>", "options": {"pageSize": "Letter"}, "returnBase64": true}
Response Example
PDF
{"pdf": "JVBERi0xLjcK...", "pageCount": 1}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertHtmlToPdf" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"html": "<h1>Hello World</h1>\n<p>Generated by DocFlow.</p>", "options": {"pageSize": "Letter"}, "returnBase64": true}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""html"": ""<h1>Hello World</h1>\n<p>Generated by DocFlow.</p>"", ""options"": {""pageSize"": ""Letter""}, ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ConvertHtmlToPdf", content);
response.EnsureSuccessStatusCode();

// The response contains a base64-encoded file in the JSON body
var result = await response.Content.ReadAsStringAsync();
using var doc = System.Text.Json.JsonDocument.Parse(result);
var base64 = doc.RootElement.GetProperty("pdf").GetString();
var bytes = Convert.FromBase64String(base64!);
await File.WriteAllBytesAsync("output.pdf", bytes);
import requests
import json
import base64

url = "https://docbutterfly.com/api/ConvertHtmlToPdf"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"html": "<h1>Hello World</h1>\n<p>Generated by DocFlow.</p>", "options": {"pageSize": "Letter"}, "returnBase64": true}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

# Decode the base64 PDF and save to file
data = response.json()
pdf_bytes = base64.b64decode(data["pdf"])
with open("output.pdf", "wb") as f:
    f.write(pdf_bytes)
print("Saved to output.pdf")
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ConvertHtmlToPdf
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "html": "\u003Ch1\u003EHello World\u003C/h1\u003E\n\u003Cp\u003EGenerated by DocFlow.\u003C/p\u003E",
│      "options": {
│        "pageSize": "Letter"
│      },
│      "returnBase64": true
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ConvertHtmlToPdf"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed

To save the output file:
7. Add a "Parse JSON" action on the HTTP response body
8. Use base64ToBinary(body('Parse_JSON')?['pdf']) to convert
9. Pass the result to a "Create file" action (SharePoint, OneDrive, etc.)
Try in Testbed

Convert PDF to Image

POST /api/ConvertPdfToImage 3 tokens

Convert PDF pages to PNG or JPEG images.

Parameters
NameTypeRequiredDescription
pdf string required Base64-encoded PDF
options.format string optional png or jpeg (default: png)
options.pages array optional Pages to convert (default all)
options.dpi number optional Resolution 72-600 (default: 150)
Request Example
JSON
{"pdf": "<base64-pdf>", "options": {"format": "png", "pages": [1], "dpi": 150}}
Response Example
JSON
{"images": [{"page": 1, "image": "iVBORw0...", "width": 1240, "height": 1754}]}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertPdfToImage" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"pdf": "<base64-pdf>", "options": {"format": "png", "pages": [1], "dpi": 150}}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""pdf"": ""<base64-pdf>"", ""options"": {""format"": ""png"", ""pages"": [1], ""dpi"": 150}}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ConvertPdfToImage", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/ConvertPdfToImage"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "options": {"format": "png", "pages": [1], "dpi": 150}}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ConvertPdfToImage
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "pdf": "\u003Cbase64-pdf\u003E",
│      "options": {
│        "format": "png",
│        "pages": [
│          1
│        ],
│        "dpi": 150
│      }
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ConvertPdfToImage"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Convert PDF to Text

POST /api/ConvertPdfToText 1 token

Extract text content from a PDF document.

Parameters
NameTypeRequiredDescription
pdf string required Base64-encoded PDF
Request Example
JSON
{"pdf": "<base64-pdf>"}
Response Example
JSON
{"text": "Full document text...", "pageCount": 5}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertPdfToText" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"pdf": "<base64-pdf>"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""pdf"": ""<base64-pdf>""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ConvertPdfToText", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/ConvertPdfToText"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>"}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ConvertPdfToText
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "pdf": "\u003Cbase64-pdf\u003E"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ConvertPdfToText"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Convert HTML to Image

POST /api/ConvertHtmlToImage 1 token

Render HTML as a PNG or JPEG screenshot.

Parameters
NameTypeRequiredDescription
html string required HTML content
options.format string optional png or jpeg (default: png)
options.width number optional Viewport width (default: 800)
options.height number optional Viewport height (default: 600)
returnBase64 boolean optional Return base64 (default: true)
Request Example
JSON
{"html": "<h1>Hello World</h1>", "options": {"format": "png", "width": 800, "height": 600}, "returnBase64": true}
Response Example
JSON
{"image": "iVBORw0...", "width": 800, "height": 600}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertHtmlToImage" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"html": "<h1>Hello World</h1>", "options": {"format": "png", "width": 800, "height": 600}, "returnBase64": true}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""html"": ""<h1>Hello World</h1>"", ""options"": {""format"": ""png"", ""width"": 800, ""height"": 600}, ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ConvertHtmlToImage", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/ConvertHtmlToImage"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"html": "<h1>Hello World</h1>", "options": {"format": "png", "width": 800, "height": 600}, "returnBase64": true}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ConvertHtmlToImage
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "html": "\u003Ch1\u003EHello World\u003C/h1\u003E",
│      "options": {
│        "format": "png",
│        "width": 800,
│        "height": 600
│      },
│      "returnBase64": true
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ConvertHtmlToImage"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Convert Text to PDF

POST /api/ConvertTextToPdf 1 token

Convert plain text to a formatted PDF.

Parameters
NameTypeRequiredDescription
text string required Plain text content
options.fontSize number optional Font size (default: 12)
options.pageSize string optional Named paper size — see the paper-size table on the API reference overview. Case- and punctuation-insensitive; aliases such as "US Letter" are accepted. Via raw JSON a custom size object is also accepted: {"width": n, "height": n, "units": "pt|px|in|mm|cm"} (units default pt; 1-14400pt / 200in per side). An unknown size, unit, or orientation returns 400 — nothing silently falls back (default: Letter)
options.orientation string optional Page orientation. "landscape" puts the long edge horizontal. Omit to keep the size's own orientation (portrait for every named size except Ledger)
returnBase64 boolean optional Return base64 (default: true)
Request Example
JSON
{"text": "This is plain text content.", "options": {"fontSize": 12, "pageSize": "Letter"}, "returnBase64": true}
Response Example
PDF
{"pdf": "JVBERi0xLjcK...", "pageCount": 1}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertTextToPdf" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"text": "This is plain text content.", "options": {"fontSize": 12, "pageSize": "Letter"}, "returnBase64": true}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""text"": ""This is plain text content."", ""options"": {""fontSize"": 12, ""pageSize"": ""Letter""}, ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ConvertTextToPdf", content);
response.EnsureSuccessStatusCode();

// The response contains a base64-encoded file in the JSON body
var result = await response.Content.ReadAsStringAsync();
using var doc = System.Text.Json.JsonDocument.Parse(result);
var base64 = doc.RootElement.GetProperty("pdf").GetString();
var bytes = Convert.FromBase64String(base64!);
await File.WriteAllBytesAsync("output.pdf", bytes);
import requests
import json
import base64

url = "https://docbutterfly.com/api/ConvertTextToPdf"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"text": "This is plain text content.", "options": {"fontSize": 12, "pageSize": "Letter"}, "returnBase64": true}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

# Decode the base64 PDF and save to file
data = response.json()
pdf_bytes = base64.b64decode(data["pdf"])
with open("output.pdf", "wb") as f:
    f.write(pdf_bytes)
print("Saved to output.pdf")
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ConvertTextToPdf
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "text": "This is plain text content.",
│      "options": {
│        "fontSize": 12,
│        "pageSize": "Letter"
│      },
│      "returnBase64": true
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ConvertTextToPdf"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed

To save the output file:
7. Add a "Parse JSON" action on the HTTP response body
8. Use base64ToBinary(body('Parse_JSON')?['pdf']) to convert
9. Pass the result to a "Create file" action (SharePoint, OneDrive, etc.)
Try in Testbed

Convert Markdown to HTML

POST /api/ConvertMarkdownToHtml 1 token

Convert Markdown text to HTML using GitHub-Flavored Markdown.

Parameters
NameTypeRequiredDescription
markdown string required Markdown text to convert
options.wrapInDocument boolean optional Wrap in full HTML document (default: true)
options.gfm boolean optional Use GitHub-Flavored Markdown (default: true)
options.breaks boolean optional Convert line breaks to <br> (default: false)
options.css string optional Additional CSS to include
Request Example
JSON
{"markdown": "# Hello World\n\nThis is **bold** and *italic* text."}
Response Example
JSON
{"html": "<!DOCTYPE html><html>...", "characterCount": 1234}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertMarkdownToHtml" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"markdown": "# Hello World\n\nThis is **bold** and *italic* text."}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""markdown"": ""# Hello World\n\nThis is **bold** and *italic* text.""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ConvertMarkdownToHtml", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/ConvertMarkdownToHtml"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"markdown": "# Hello World\n\nThis is **bold** and *italic* text."}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ConvertMarkdownToHtml
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "markdown": "# Hello World\n\nThis is **bold** and *italic* text."
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ConvertMarkdownToHtml"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Convert Markdown to PDF

POST /api/ConvertMarkdownToPdf 1 token

Convert Markdown text to a styled PDF document via Chromium rendering.

Uses Chromium for rendering — may take 3-10s on cold start.
Parameters
NameTypeRequiredDescription
markdown string required Markdown text to convert
options.pageSize string optional Named paper size — see the paper-size table on the API reference overview. Case- and punctuation-insensitive; aliases such as "US Letter" are accepted. Via raw JSON a custom size object is also accepted: {"width": n, "height": n, "units": "pt|px|in|mm|cm"} (units default pt; 1-14400pt / 200in per side). An unknown size, unit, or orientation returns 400 — nothing silently falls back. Legacy key options.format is still accepted (default: Letter)
options.orientation string optional Page orientation. "landscape" puts the long edge horizontal. Omit to keep the size's own orientation (portrait for every named size except Ledger)
options.gfm boolean optional Use GitHub-Flavored Markdown (default: true)
options.css string optional Additional CSS to include
options.margin object optional Page margins {top, right, bottom, left}
Request Example
JSON
{"markdown": "# Report\n\n## Summary\n\nKey findings:\n- Item 1\n- Item 2"}
Response Example
PDF
{"pdf": "JVBERi0xLjcK...", "size": 12345}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertMarkdownToPdf" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"markdown": "# Report\n\n## Summary\n\nKey findings:\n- Item 1\n- Item 2"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""markdown"": ""# Report\n\n## Summary\n\nKey findings:\n- Item 1\n- Item 2""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ConvertMarkdownToPdf", content);
response.EnsureSuccessStatusCode();

// The response contains a base64-encoded file in the JSON body
var result = await response.Content.ReadAsStringAsync();
using var doc = System.Text.Json.JsonDocument.Parse(result);
var base64 = doc.RootElement.GetProperty("pdf").GetString();
var bytes = Convert.FromBase64String(base64!);
await File.WriteAllBytesAsync("output.pdf", bytes);
import requests
import json
import base64

url = "https://docbutterfly.com/api/ConvertMarkdownToPdf"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"markdown": "# Report\n\n## Summary\n\nKey findings:\n- Item 1\n- Item 2"}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

# Decode the base64 PDF and save to file
data = response.json()
pdf_bytes = base64.b64decode(data["pdf"])
with open("output.pdf", "wb") as f:
    f.write(pdf_bytes)
print("Saved to output.pdf")
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ConvertMarkdownToPdf
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "markdown": "# Report\n\n## Summary\n\nKey findings:\n- Item 1\n- Item 2"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ConvertMarkdownToPdf"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed

To save the output file:
7. Add a "Parse JSON" action on the HTTP response body
8. Use base64ToBinary(body('Parse_JSON')?['pdf']) to convert
9. Pass the result to a "Create file" action (SharePoint, OneDrive, etc.)
Try in Testbed

Convert DOCX to HTML

POST /api/ConvertDocxToHtml 1 token

Convert a Word DOCX document to HTML using mammoth.

Parameters
NameTypeRequiredDescription
file string required Base64-encoded DOCX file
options.wrapInDocument boolean optional Wrap in full HTML document (default: false)
options.styleMap array optional Custom mammoth style map rules
options.css string optional CSS for document wrapper
Request Example
JSON
{"file": "<base64-docx>"}
Response Example
JSON
{"html": "<p>Document content...</p>", "characterCount": 567, "messages": []}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertDocxToHtml" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"file": "<base64-docx>"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""file"": ""<base64-docx>""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ConvertDocxToHtml", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/ConvertDocxToHtml"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"file": "<base64-docx>"}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ConvertDocxToHtml
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "file": "\u003Cbase64-docx\u003E"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ConvertDocxToHtml"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Convert DOCX to Markdown

POST /api/ConvertDocxToMarkdown 1 token

Convert a Word DOCX document to Markdown text.

Parameters
NameTypeRequiredDescription
file string required Base64-encoded DOCX file
options.styleMap array optional Custom mammoth style map rules
Request Example
JSON
{"file": "<base64-docx>"}
Response Example
JSON
{"markdown": "# Document Title\n\nParagraph text...", "characterCount": 234, "messages": []}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertDocxToMarkdown" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"file": "<base64-docx>"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""file"": ""<base64-docx>""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ConvertDocxToMarkdown", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/ConvertDocxToMarkdown"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"file": "<base64-docx>"}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ConvertDocxToMarkdown
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "file": "\u003Cbase64-docx\u003E"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ConvertDocxToMarkdown"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Convert DOCX to PDF

POST /api/ConvertDocxToPdf 2 tokens

Convert a Word DOCX document to PDF via mammoth HTML conversion and Chromium rendering.

Uses Chromium for rendering — may take 3-10s on cold start.
Parameters
NameTypeRequiredDescription
file string required Base64-encoded DOCX file
options.pageSize string optional Named paper size — see the paper-size table on the API reference overview. Case- and punctuation-insensitive; aliases such as "US Letter" are accepted. Via raw JSON a custom size object is also accepted: {"width": n, "height": n, "units": "pt|px|in|mm|cm"} (units default pt; 1-14400pt / 200in per side). An unknown size, unit, or orientation returns 400 — nothing silently falls back. Legacy key options.format is still accepted (default: Letter)
options.orientation string optional Page orientation. "landscape" puts the long edge horizontal. Omit to keep the size's own orientation (portrait for every named size except Ledger)
options.css string optional Additional CSS for styling
options.margin object optional Page margins {top, right, bottom, left}
Request Example
JSON
{"file": "<base64-docx>"}
Response Example
PDF
{"pdf": "JVBERi0xLjcK...", "size": 23456}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertDocxToPdf" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"file": "<base64-docx>"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""file"": ""<base64-docx>""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ConvertDocxToPdf", content);
response.EnsureSuccessStatusCode();

// The response contains a base64-encoded file in the JSON body
var result = await response.Content.ReadAsStringAsync();
using var doc = System.Text.Json.JsonDocument.Parse(result);
var base64 = doc.RootElement.GetProperty("pdf").GetString();
var bytes = Convert.FromBase64String(base64!);
await File.WriteAllBytesAsync("output.pdf", bytes);
import requests
import json
import base64

url = "https://docbutterfly.com/api/ConvertDocxToPdf"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"file": "<base64-docx>"}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

# Decode the base64 PDF and save to file
data = response.json()
pdf_bytes = base64.b64decode(data["pdf"])
with open("output.pdf", "wb") as f:
    f.write(pdf_bytes)
print("Saved to output.pdf")
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ConvertDocxToPdf
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "file": "\u003Cbase64-docx\u003E"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ConvertDocxToPdf"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed

To save the output file:
7. Add a "Parse JSON" action on the HTTP response body
8. Use base64ToBinary(body('Parse_JSON')?['pdf']) to convert
9. Pass the result to a "Create file" action (SharePoint, OneDrive, etc.)
Try in Testbed

Convert HTML to DOCX

POST /api/ConvertHtmlToDocx 1 token

Convert HTML content to a Word DOCX document.

Parameters
NameTypeRequiredDescription
html string required HTML content to convert
options.title string optional Document title metadata
options.orientation string optional Page orientation. "landscape" puts the long edge horizontal. Omit to keep the size's own orientation (portrait for every named size except Ledger)
options.pageSize string optional Named paper size — see the paper-size table on the API reference overview. Case- and punctuation-insensitive; aliases such as "US Letter" are accepted. Via raw JSON a custom size object is also accepted: {"width": n, "height": n, "units": "pt|px|in|mm|cm"} (units default pt; 1-14400pt / 200in per side). An unknown size, unit, or orientation returns 400 — nothing silently falls back. A0, A1, and A2 exceed Word's 22-inch page cap and are rejected for DOCX (default: Letter)
Request Example
JSON
{"html": "<h1>Hello World</h1><p>Test document from <strong>HTML</strong>.</p>"}
Response Example
JSON
{"file": "UEsDBBQ...", "size": 8765}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertHtmlToDocx" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"html": "<h1>Hello World</h1><p>Test document from <strong>HTML</strong>.</p>"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""html"": ""<h1>Hello World</h1><p>Test document from <strong>HTML</strong>.</p>""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ConvertHtmlToDocx", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/ConvertHtmlToDocx"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"html": "<h1>Hello World</h1><p>Test document from <strong>HTML</strong>.</p>"}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ConvertHtmlToDocx
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "html": "\u003Ch1\u003EHello World\u003C/h1\u003E\u003Cp\u003ETest document from \u003Cstrong\u003EHTML\u003C/strong\u003E.\u003C/p\u003E"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ConvertHtmlToDocx"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Convert CSV to Excel

POST /api/ConvertCsvToExcel 1 token

Convert CSV text to an Excel XLSX workbook.

Parameters
NameTypeRequiredDescription
csv string required CSV text data
options.hasHeaders boolean optional First row is headers (default: true)
options.delimiter string optional CSV delimiter (default: ,)
options.sheetName string optional Worksheet name (default: Sheet1)
Request Example
JSON
{"csv": "Name,Age,City\nAlice,30,London\nBob,25,Paris", "options": {"hasHeaders": true}}
Response Example
JSON
{"file": "UEsDBBQ...", "rowCount": 2, "columnCount": 3, "headers": ["Name", "Age", "City"]}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertCsvToExcel" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"csv": "Name,Age,City\nAlice,30,London\nBob,25,Paris", "options": {"hasHeaders": true}}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""csv"": ""Name,Age,City\nAlice,30,London\nBob,25,Paris"", ""options"": {""hasHeaders"": true}}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ConvertCsvToExcel", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/ConvertCsvToExcel"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"csv": "Name,Age,City\nAlice,30,London\nBob,25,Paris", "options": {"hasHeaders": true}}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ConvertCsvToExcel
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "csv": "Name,Age,City\nAlice,30,London\nBob,25,Paris",
│      "options": {
│        "hasHeaders": true
│      }
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ConvertCsvToExcel"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Convert Excel to CSV

POST /api/ConvertExcelToCsv 1 token

Convert an Excel XLSX worksheet to CSV text.

Parameters
NameTypeRequiredDescription
file string required Base64-encoded XLSX file
options.worksheet string optional Sheet name or index (default first)
options.delimiter string optional CSV delimiter (default: ,)
Request Example
JSON
{"file": "<base64-xlsx>", "options": {"worksheet": "Sheet1"}}
Response Example
JSON
{"csv": "Name,Age,City\nAlice,30,London\nBob,25,Paris", "rowCount": 2}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertExcelToCsv" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"file": "<base64-xlsx>", "options": {"worksheet": "Sheet1"}}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""file"": ""<base64-xlsx>"", ""options"": {""worksheet"": ""Sheet1""}}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ConvertExcelToCsv", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/ConvertExcelToCsv"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"file": "<base64-xlsx>", "options": {"worksheet": "Sheet1"}}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ConvertExcelToCsv
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "file": "\u003Cbase64-xlsx\u003E",
│      "options": {
│        "worksheet": "Sheet1"
│      }
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ConvertExcelToCsv"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Convert Excel to JSON

POST /api/ConvertExcelToJson 1 token

Convert an Excel XLSX worksheet to a JSON array.

Parameters
NameTypeRequiredDescription
file string required Base64-encoded XLSX file
options.worksheet string optional Sheet name or index (default first)
options.hasHeaders boolean optional First row is headers (default: true)
Request Example
JSON
{"file": "<base64-xlsx>", "options": {"worksheet": "Sheet1", "hasHeaders": true}}
Response Example
JSON
{"data": [{"Name": "Alice", "Age": 30}, {"Name": "Bob", "Age": 25}], "rowCount": 2}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertExcelToJson" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"file": "<base64-xlsx>", "options": {"worksheet": "Sheet1", "hasHeaders": true}}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""file"": ""<base64-xlsx>"", ""options"": {""worksheet"": ""Sheet1"", ""hasHeaders"": true}}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ConvertExcelToJson", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/ConvertExcelToJson"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"file": "<base64-xlsx>", "options": {"worksheet": "Sheet1", "hasHeaders": true}}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ConvertExcelToJson
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "file": "\u003Cbase64-xlsx\u003E",
│      "options": {
│        "worksheet": "Sheet1",
│        "hasHeaders": true
│      }
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ConvertExcelToJson"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Convert Image to PDF

POST /api/ConvertImageToPdf 1 token

Turns JPEG and PNG images into a PDF — one page per image, in the order supplied. A batch of scanned pages becomes a single document.

JPEG and PNG only. HEIC/HEIF is detected and refused with a message saying so — the Linux sharp build we run bundles libheif AV1-only, so an iPhone HEIC cannot be decoded. Convert it to JPEG first.
Parameters
NameTypeRequiredDescription
images array required Array of base64-encoded JPEG or PNG images (max 200 per call, 64 MB decoded in total). Use "image" instead for a single file
image string optional A single base64-encoded JPEG or PNG — the convenience form of "images"
pageSize string optional "fit" makes each page the image's own size at "dpi" (nothing is scaled). Any named paper size instead scales the image to fit inside the page minus "margin", centered, aspect preserved (default: fit)
orientation string optional Page orientation. "landscape" puts the long edge horizontal. Omit to keep the size's own orientation (portrait for every named size except Ledger)
dpi number optional Pixels per inch used to size the page (1-2400) (default: 96)
margin number optional Margin in points around the image. Only valid with a named pageSize — with "fit" the page IS the image, so a margin is refused (default: 0)
Request Example
JSON
{"images": ["<base64-jpeg>", "<base64-png>"], "pageSize": "fit", "dpi": 96}
Response Example
JSON
{"success": true, "pdf": "JVBERi0xLjcK...", "pageCount": 2, "formats": ["jpeg", "png"]}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertImageToPdf" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"images": ["<base64-jpeg>", "<base64-png>"], "pageSize": "fit", "dpi": 96}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""images"": [""<base64-jpeg>"", ""<base64-png>""], ""pageSize"": ""fit"", ""dpi"": 96}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ConvertImageToPdf", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/ConvertImageToPdf"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"images": ["<base64-jpeg>", "<base64-png>"], "pageSize": "fit", "dpi": 96}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ConvertImageToPdf
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "images": [
│        "\u003Cbase64-jpeg\u003E",
│        "\u003Cbase64-png\u003E"
│      ],
│      "pageSize": "fit",
│      "dpi": 96
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ConvertImageToPdf"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Convert TIFF to PDF

POST /api/ConvertTiffToPdf 1 token

Turns a multi-page TIFF — including the CCITT G3/G4 that inbound faxes arrive as — into a PDF with every page present. A multi-page TIFF previews as page 1 only in Outlook and most mail clients, which reads as a dropped attachment when every page was there all along.

Pages are losslessly re-encoded as PNG, not carried across as their original CCITT strips — the claim is "every page, visually identical", not "the original G4 bytes". A JPEG or PNG sent here is refused with a pointer to Convert Image to PDF.
Parameters
NameTypeRequiredDescription
tiff string required Base64-encoded TIFF (max 64 MB decoded)
pages string optional Which pages to convert: "1-3,5" or an array of 1-based page numbers (max 200 converted per call). Omit for every page (default: all)
pageSize string optional "fit" makes each page the image's own size at "dpi". Any named paper size instead scales each page to fit inside it minus "margin", centered (default: fit)
orientation string optional Page orientation. "landscape" puts the long edge horizontal. Omit to keep the size's own orientation (portrait for every named size except Ledger)
dpi number optional Pixels per inch used to size the page. Defaults to the TIFF's own resolution tag when it has one, otherwise 200 (the fax norm) (default: 200)
margin number optional Margin in points. Only valid with a named pageSize (default: 0)
Request Example
JSON
{"tiff": "<base64-tiff>", "pageSize": "fit", "dpi": 200}
Response Example
JSON
{"success": true, "pdf": "JVBERi0xLjcK...", "pageCount": 4, "sourcePages": 4, "dpi": 200}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertTiffToPdf" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"tiff": "<base64-tiff>", "pageSize": "fit", "dpi": 200}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""tiff"": ""<base64-tiff>"", ""pageSize"": ""fit"", ""dpi"": 200}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ConvertTiffToPdf", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/ConvertTiffToPdf"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"tiff": "<base64-tiff>", "pageSize": "fit", "dpi": 200}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ConvertTiffToPdf
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "tiff": "\u003Cbase64-tiff\u003E",
│      "pageSize": "fit",
│      "dpi": 200
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ConvertTiffToPdf"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Parse X12 to JSON

POST /api/ParseX12ToJson 2 tokens

Parse an EDI X12 document into structured JSON with segments and elements.

Parameters
NameTypeRequiredDescription
ediData string required X12 EDI document as string
Request Example
JSON
{"ediData": "ISA*00*          *00*          *ZZ*SENDER         *ZZ*RECEIVER       *210101*1253*^*00501*000000001*0*P*:~GS*HP*SENDER*RECEIVER*20210101*1253*1*X*005010X221A1~ST*835*0001~BPR*I*500.00*C*ACH*CTX*01*999999999*DA*1234567890*1512345678**01*111111111*DA*9876543210*20210101~TRN*1*12345*1512345678~DTM*405*20210101~N1*PR*INSURANCE COMPANY~N1*PE*PROVIDER NAME*XX*1234567890~SE*8*0001~GE*1*1~IEA*1*000000001~"}
Code Examples
curl -X POST "https://docbutterfly.com/api/ParseX12ToJson" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"ediData": "ISA*00*          *00*          *ZZ*SENDER         *ZZ*RECEIVER       *210101*1253*^*00501*000000001*0*P*:~GS*HP*SENDER*RECEIVER*20210101*1253*1*X*005010X221A1~ST*835*0001~BPR*I*500.00*C*ACH*CTX*01*999999999*DA*1234567890*1512345678**01*111111111*DA*9876543210*20210101~TRN*1*12345*1512345678~DTM*405*20210101~N1*PR*INSURANCE COMPANY~N1*PE*PROVIDER NAME*XX*1234567890~SE*8*0001~GE*1*1~IEA*1*000000001~"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""ediData"": ""ISA*00*          *00*          *ZZ*SENDER         *ZZ*RECEIVER       *210101*1253*^*00501*000000001*0*P*:~GS*HP*SENDER*RECEIVER*20210101*1253*1*X*005010X221A1~ST*835*0001~BPR*I*500.00*C*ACH*CTX*01*999999999*DA*1234567890*1512345678**01*111111111*DA*9876543210*20210101~TRN*1*12345*1512345678~DTM*405*20210101~N1*PR*INSURANCE COMPANY~N1*PE*PROVIDER NAME*XX*1234567890~SE*8*0001~GE*1*1~IEA*1*000000001~""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ParseX12ToJson", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/ParseX12ToJson"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"ediData": "ISA*00*          *00*          *ZZ*SENDER         *ZZ*RECEIVER       *210101*1253*^*00501*000000001*0*P*:~GS*HP*SENDER*RECEIVER*20210101*1253*1*X*005010X221A1~ST*835*0001~BPR*I*500.00*C*ACH*CTX*01*999999999*DA*1234567890*1512345678**01*111111111*DA*9876543210*20210101~TRN*1*12345*1512345678~DTM*405*20210101~N1*PR*INSURANCE COMPANY~N1*PE*PROVIDER NAME*XX*1234567890~SE*8*0001~GE*1*1~IEA*1*000000001~"}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ParseX12ToJson
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "ediData": "ISA*00*          *00*          *ZZ*SENDER         *ZZ*RECEIVER       *210101*1253*^*00501*000000001*0*P*:~GS*HP*SENDER*RECEIVER*20210101*1253*1*X*005010X221A1~ST*835*0001~BPR*I*500.00*C*ACH*CTX*01*999999999*DA*1234567890*1512345678**01*111111111*DA*9876543210*20210101~TRN*1*12345*1512345678~DTM*405*20210101~N1*PR*INSURANCE COMPANY~N1*PE*PROVIDER NAME*XX*1234567890~SE*8*0001~GE*1*1~IEA*1*000000001~"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ParseX12ToJson"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Generate X12 from JSON

POST /api/GenerateX12FromJson 2 tokens

Build an X12 EDI document from structured JSON. Accepts header, functional groups, transactions, and segments.

Parameters
NameTypeRequiredDescription
ediJson object required Structured EDI: {header, functionalGroups: [{header, transactions: [{header, segments: [{tag, elements}]}]}]}
options object optional Serialization options: {elementDelimiter, segmentTerminator, endOfLine}
Request Example
JSON
{"ediJson": {"header": ["00", "          ", "00", "          ", "ZZ", "SENDER         ", "ZZ", "RECEIVER       ", "210101", "1253", "^", "00501", "000000001", "0", "P", ":"], "functionalGroups": [{"header": ["HP", "SENDER", "RECEIVER", "20210101", "1253", "1", "X", "005010X221A1"], "transactions": [{"header": ["835", "0001"], "segments": [{"tag": "BPR", "elements": ["I", "500.00", "C", "ACH"]}]}]}]}}
Code Examples
curl -X POST "https://docbutterfly.com/api/GenerateX12FromJson" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"ediJson": {"header": ["00", "          ", "00", "          ", "ZZ", "SENDER         ", "ZZ", "RECEIVER       ", "210101", "1253", "^", "00501", "000000001", "0", "P", ":"], "functionalGroups": [{"header": ["HP", "SENDER", "RECEIVER", "20210101", "1253", "1", "X", "005010X221A1"], "transactions": [{"header": ["835", "0001"], "segments": [{"tag": "BPR", "elements": ["I", "500.00", "C", "ACH"]}]}]}]}}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""ediJson"": {""header"": [""00"", ""          "", ""00"", ""          "", ""ZZ"", ""SENDER         "", ""ZZ"", ""RECEIVER       "", ""210101"", ""1253"", ""^"", ""00501"", ""000000001"", ""0"", ""P"", "":""], ""functionalGroups"": [{""header"": [""HP"", ""SENDER"", ""RECEIVER"", ""20210101"", ""1253"", ""1"", ""X"", ""005010X221A1""], ""transactions"": [{""header"": [""835"", ""0001""], ""segments"": [{""tag"": ""BPR"", ""elements"": [""I"", ""500.00"", ""C"", ""ACH""]}]}]}]}}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/GenerateX12FromJson", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/GenerateX12FromJson"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"ediJson": {"header": ["00", "          ", "00", "          ", "ZZ", "SENDER         ", "ZZ", "RECEIVER       ", "210101", "1253", "^", "00501", "000000001", "0", "P", ":"], "functionalGroups": [{"header": ["HP", "SENDER", "RECEIVER", "20210101", "1253", "1", "X", "005010X221A1"], "transactions": [{"header": ["835", "0001"], "segments": [{"tag": "BPR", "elements": ["I", "500.00", "C", "ACH"]}]}]}]}}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/GenerateX12FromJson
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "ediJson": {
│        "header": [
│          "00",
│          "          ",
│          "00",
│          "          ",
│          "ZZ",
│          "SENDER         ",
│          "ZZ",
│          "RECEIVER       ",
│          "210101",
│          "1253",
│          "^",
│          "00501",
│          "000000001",
│          "0",
│          "P",
│          ":"
│        ],
│        "functionalGroups": [
│          {
│            "header": [
│              "HP",
│              "SENDER",
│              "RECEIVER",
│              "20210101",
│              "1253",
│              "1",
│              "X",
│              "005010X221A1"
│            ],
│            "transactions": [
│              {
│                "header": [
│                  "835",
│                  "0001"
│                ],
│                "segments": [
│                  {
│                    "tag": "BPR",
│                    "elements": [
│                      "I",
│                      "500.00",
│                      "C",
│                      "ACH"
│                    ]
│                  }
│                ]
│              }
│            ]
│          }
│        ]
│      }
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/GenerateX12FromJson"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Convert X12 to CSV

POST /api/ConvertX12ToCsv 2 tokens

Parse X12 and flatten all segments into CSV rows with transaction code, segment tag, and elements.

Parameters
NameTypeRequiredDescription
ediData string required X12 EDI document as string
includeHeaders boolean optional Include CSV header row (default: true)
Request Example
JSON
{"ediData": "ISA*00*          *00*          *ZZ*SENDER         *ZZ*RECEIVER       *210101*1253*^*00501*000000001*0*P*:~GS*HP*SENDER*RECEIVER*20210101*1253*1*X*005010X221A1~ST*835*0001~BPR*I*500.00*C*ACH*CTX*01*999999999*DA*1234567890~SE*3*0001~GE*1*1~IEA*1*000000001~", "includeHeaders": true}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertX12ToCsv" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"ediData": "ISA*00*          *00*          *ZZ*SENDER         *ZZ*RECEIVER       *210101*1253*^*00501*000000001*0*P*:~GS*HP*SENDER*RECEIVER*20210101*1253*1*X*005010X221A1~ST*835*0001~BPR*I*500.00*C*ACH*CTX*01*999999999*DA*1234567890~SE*3*0001~GE*1*1~IEA*1*000000001~", "includeHeaders": true}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""ediData"": ""ISA*00*          *00*          *ZZ*SENDER         *ZZ*RECEIVER       *210101*1253*^*00501*000000001*0*P*:~GS*HP*SENDER*RECEIVER*20210101*1253*1*X*005010X221A1~ST*835*0001~BPR*I*500.00*C*ACH*CTX*01*999999999*DA*1234567890~SE*3*0001~GE*1*1~IEA*1*000000001~"", ""includeHeaders"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ConvertX12ToCsv", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/ConvertX12ToCsv"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"ediData": "ISA*00*          *00*          *ZZ*SENDER         *ZZ*RECEIVER       *210101*1253*^*00501*000000001*0*P*:~GS*HP*SENDER*RECEIVER*20210101*1253*1*X*005010X221A1~ST*835*0001~BPR*I*500.00*C*ACH*CTX*01*999999999*DA*1234567890~SE*3*0001~GE*1*1~IEA*1*000000001~", "includeHeaders": true}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ConvertX12ToCsv
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "ediData": "ISA*00*          *00*          *ZZ*SENDER         *ZZ*RECEIVER       *210101*1253*^*00501*000000001*0*P*:~GS*HP*SENDER*RECEIVER*20210101*1253*1*X*005010X221A1~ST*835*0001~BPR*I*500.00*C*ACH*CTX*01*999999999*DA*1234567890~SE*3*0001~GE*1*1~IEA*1*000000001~",
│      "includeHeaders": true
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ConvertX12ToCsv"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

Convert X12 to HTML

POST /api/ConvertX12ToHtml 2 tokens

Parse X12 and render as a styled, human-readable HTML report with segment details.

For a printable remittance or claim report, chain the HTML into ConvertHtmlToPdf.
Parameters
NameTypeRequiredDescription
ediData string required X12 EDI document as string
title string optional Report title
Request Example
JSON
{"ediData": "ISA*00*          *00*          *ZZ*SENDER         *ZZ*RECEIVER       *210101*1253*^*00501*000000001*0*P*:~GS*HP*SENDER*RECEIVER*20210101*1253*1*X*005010X221A1~ST*835*0001~BPR*I*500.00*C*ACH*CTX*01*999999999*DA*1234567890~SE*3*0001~GE*1*1~IEA*1*000000001~", "title": "835 Remittance Report"}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertX12ToHtml" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"ediData": "ISA*00*          *00*          *ZZ*SENDER         *ZZ*RECEIVER       *210101*1253*^*00501*000000001*0*P*:~GS*HP*SENDER*RECEIVER*20210101*1253*1*X*005010X221A1~ST*835*0001~BPR*I*500.00*C*ACH*CTX*01*999999999*DA*1234567890~SE*3*0001~GE*1*1~IEA*1*000000001~", "title": "835 Remittance Report"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""ediData"": ""ISA*00*          *00*          *ZZ*SENDER         *ZZ*RECEIVER       *210101*1253*^*00501*000000001*0*P*:~GS*HP*SENDER*RECEIVER*20210101*1253*1*X*005010X221A1~ST*835*0001~BPR*I*500.00*C*ACH*CTX*01*999999999*DA*1234567890~SE*3*0001~GE*1*1~IEA*1*000000001~"", ""title"": ""835 Remittance Report""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/ConvertX12ToHtml", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/ConvertX12ToHtml"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"ediData": "ISA*00*          *00*          *ZZ*SENDER         *ZZ*RECEIVER       *210101*1253*^*00501*000000001*0*P*:~GS*HP*SENDER*RECEIVER*20210101*1253*1*X*005010X221A1~ST*835*0001~BPR*I*500.00*C*ACH*CTX*01*999999999*DA*1234567890~SE*3*0001~GE*1*1~IEA*1*000000001~", "title": "835 Remittance Report"}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/ConvertX12ToHtml
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "ediData": "ISA*00*          *00*          *ZZ*SENDER         *ZZ*RECEIVER       *210101*1253*^*00501*000000001*0*P*:~GS*HP*SENDER*RECEIVER*20210101*1253*1*X*005010X221A1~ST*835*0001~BPR*I*500.00*C*ACH*CTX*01*999999999*DA*1234567890~SE*3*0001~GE*1*1~IEA*1*000000001~",
│      "title": "835 Remittance Report"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ConvertX12ToHtml"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

FHIR JSON to XML

POST /api/FhirJsonToXml 1 token

Convert a FHIR resource from JSON format to FHIR-compliant XML.

Parameters
NameTypeRequiredDescription
resource object required FHIR resource as JSON object
Request Example
JSON
{"resource": {"resourceType": "Patient", "id": "example", "name": [{"use": "official", "given": ["John"], "family": "Doe"}], "gender": "male", "birthDate": "1990-01-15"}}
Code Examples
curl -X POST "https://docbutterfly.com/api/FhirJsonToXml" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"resource": {"resourceType": "Patient", "id": "example", "name": [{"use": "official", "given": ["John"], "family": "Doe"}], "gender": "male", "birthDate": "1990-01-15"}}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""resource"": {""resourceType"": ""Patient"", ""id"": ""example"", ""name"": [{""use"": ""official"", ""given"": [""John""], ""family"": ""Doe""}], ""gender"": ""male"", ""birthDate"": ""1990-01-15""}}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/FhirJsonToXml", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/FhirJsonToXml"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"resource": {"resourceType": "Patient", "id": "example", "name": [{"use": "official", "given": ["John"], "family": "Doe"}], "gender": "male", "birthDate": "1990-01-15"}}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/FhirJsonToXml
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "resource": {
│        "resourceType": "Patient",
│        "id": "example",
│        "name": [
│          {
│            "use": "official",
│            "given": [
│              "John"
│            ],
│            "family": "Doe"
│          }
│        ],
│        "gender": "male",
│        "birthDate": "1990-01-15"
│      }
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/FhirJsonToXml"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

FHIR XML to JSON

POST /api/FhirXmlToJson 1 token

Convert a FHIR resource from XML format to JSON.

Parameters
NameTypeRequiredDescription
xml string required FHIR resource as XML string
Request Example
JSON
{"xml": "<Patient xmlns=\"http://hl7.org/fhir\"><id value=\"example\"/><name><use value=\"official\"/><given value=\"John\"/><family value=\"Doe\"/></name><gender value=\"male\"/><birthDate value=\"1990-01-15\"/></Patient>"}
Code Examples
curl -X POST "https://docbutterfly.com/api/FhirXmlToJson" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"xml": "<Patient xmlns=\"http://hl7.org/fhir\"><id value=\"example\"/><name><use value=\"official\"/><given value=\"John\"/><family value=\"Doe\"/></name><gender value=\"male\"/><birthDate value=\"1990-01-15\"/></Patient>"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""xml"": ""<Patient xmlns=\""http://hl7.org/fhir\""><id value=\""example\""/><name><use value=\""official\""/><given value=\""John\""/><family value=\""Doe\""/></name><gender value=\""male\""/><birthDate value=\""1990-01-15\""/></Patient>""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/FhirXmlToJson", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/FhirXmlToJson"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"xml": "<Patient xmlns=\"http://hl7.org/fhir\"><id value=\"example\"/><name><use value=\"official\"/><given value=\"John\"/><family value=\"Doe\"/></name><gender value=\"male\"/><birthDate value=\"1990-01-15\"/></Patient>"}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/FhirXmlToJson
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "xml": "\u003CPatient xmlns=\u0022http://hl7.org/fhir\u0022\u003E\u003Cid value=\u0022example\u0022/\u003E\u003Cname\u003E\u003Cuse value=\u0022official\u0022/\u003E\u003Cgiven value=\u0022John\u0022/\u003E\u003Cfamily value=\u0022Doe\u0022/\u003E\u003C/name\u003E\u003Cgender value=\u0022male\u0022/\u003E\u003CbirthDate value=\u00221990-01-15\u0022/\u003E\u003C/Patient\u003E"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/FhirXmlToJson"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

FHIR Bundle to HTML

POST /api/FhirBundleToHtml 2 tokens

Render a FHIR Bundle (or single resource) as a styled, human-readable HTML report. Supports Patient, Observation, Condition, Medication, Allergy, Encounter, Procedure, and more.

For a PDF report, chain into ConvertHtmlToPdf — this HTML renders cleanly on any paper size.
Parameters
NameTypeRequiredDescription
resource object required FHIR Bundle or resource as JSON
title string optional Report title
Request Example
JSON
{"resource": {"resourceType": "Bundle", "type": "collection", "entry": [{"resource": {"resourceType": "Patient", "id": "pat1", "name": [{"given": ["Jane"], "family": "Smith"}], "gender": "female", "birthDate": "1985-03-22"}}, {"resource": {"resourceType": "Observation", "id": "obs1", "status": "final", "code": {"coding": [{"system": "http://loinc.org", "code": "8867-4", "display": "Heart rate"}]}, "valueQuantity": {"value": 72, "unit": "beats/min"}, "effectiveDateTime": "2024-01-15"}}]}, "title": "Patient Summary"}
Code Examples
curl -X POST "https://docbutterfly.com/api/FhirBundleToHtml" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"resource": {"resourceType": "Bundle", "type": "collection", "entry": [{"resource": {"resourceType": "Patient", "id": "pat1", "name": [{"given": ["Jane"], "family": "Smith"}], "gender": "female", "birthDate": "1985-03-22"}}, {"resource": {"resourceType": "Observation", "id": "obs1", "status": "final", "code": {"coding": [{"system": "http://loinc.org", "code": "8867-4", "display": "Heart rate"}]}, "valueQuantity": {"value": 72, "unit": "beats/min"}, "effectiveDateTime": "2024-01-15"}}]}, "title": "Patient Summary"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""resource"": {""resourceType"": ""Bundle"", ""type"": ""collection"", ""entry"": [{""resource"": {""resourceType"": ""Patient"", ""id"": ""pat1"", ""name"": [{""given"": [""Jane""], ""family"": ""Smith""}], ""gender"": ""female"", ""birthDate"": ""1985-03-22""}}, {""resource"": {""resourceType"": ""Observation"", ""id"": ""obs1"", ""status"": ""final"", ""code"": {""coding"": [{""system"": ""http://loinc.org"", ""code"": ""8867-4"", ""display"": ""Heart rate""}]}, ""valueQuantity"": {""value"": 72, ""unit"": ""beats/min""}, ""effectiveDateTime"": ""2024-01-15""}}]}, ""title"": ""Patient Summary""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/FhirBundleToHtml", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/FhirBundleToHtml"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"resource": {"resourceType": "Bundle", "type": "collection", "entry": [{"resource": {"resourceType": "Patient", "id": "pat1", "name": [{"given": ["Jane"], "family": "Smith"}], "gender": "female", "birthDate": "1985-03-22"}}, {"resource": {"resourceType": "Observation", "id": "obs1", "status": "final", "code": {"coding": [{"system": "http://loinc.org", "code": "8867-4", "display": "Heart rate"}]}, "valueQuantity": {"value": 72, "unit": "beats/min"}, "effectiveDateTime": "2024-01-15"}}]}, "title": "Patient Summary"}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/FhirBundleToHtml
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "resource": {
│        "resourceType": "Bundle",
│        "type": "collection",
│        "entry": [
│          {
│            "resource": {
│              "resourceType": "Patient",
│              "id": "pat1",
│              "name": [
│                {
│                  "given": [
│                    "Jane"
│                  ],
│                  "family": "Smith"
│                }
│              ],
│              "gender": "female",
│              "birthDate": "1985-03-22"
│            }
│          },
│          {
│            "resource": {
│              "resourceType": "Observation",
│              "id": "obs1",
│              "status": "final",
│              "code": {
│                "coding": [
│                  {
│                    "system": "http://loinc.org",
│                    "code": "8867-4",
│                    "display": "Heart rate"
│                  }
│                ]
│              },
│              "valueQuantity": {
│                "value": 72,
│                "unit": "beats/min"
│              },
│              "effectiveDateTime": "2024-01-15"
│            }
│          }
│        ]
│      },
│      "title": "Patient Summary"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/FhirBundleToHtml"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed

FHIR Bundle to CSV

POST /api/FhirBundleToCsv 2 tokens

Extract key fields from FHIR Bundle entries into CSV format. Type-aware extraction for Patient, Observation, Condition, Medication, and more.

Parameters
NameTypeRequiredDescription
resource object required FHIR Bundle or resource as JSON
resourceTypeFilter string optional Filter to specific resource type
Request Example
JSON
{"resource": {"resourceType": "Bundle", "type": "collection", "entry": [{"resource": {"resourceType": "Observation", "id": "obs1", "status": "final", "code": {"coding": [{"system": "http://loinc.org", "code": "8867-4", "display": "Heart rate"}]}, "valueQuantity": {"value": 72, "unit": "beats/min"}, "effectiveDateTime": "2024-01-15"}}, {"resource": {"resourceType": "Observation", "id": "obs2", "status": "final", "code": {"coding": [{"display": "Blood pressure"}]}, "valueString": "120/80 mmHg", "effectiveDateTime": "2024-01-15"}}]}, "resourceTypeFilter": "Observation"}
Code Examples
curl -X POST "https://docbutterfly.com/api/FhirBundleToCsv" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"resource": {"resourceType": "Bundle", "type": "collection", "entry": [{"resource": {"resourceType": "Observation", "id": "obs1", "status": "final", "code": {"coding": [{"system": "http://loinc.org", "code": "8867-4", "display": "Heart rate"}]}, "valueQuantity": {"value": 72, "unit": "beats/min"}, "effectiveDateTime": "2024-01-15"}}, {"resource": {"resourceType": "Observation", "id": "obs2", "status": "final", "code": {"coding": [{"display": "Blood pressure"}]}, "valueString": "120/80 mmHg", "effectiveDateTime": "2024-01-15"}}]}, "resourceTypeFilter": "Observation"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""resource"": {""resourceType"": ""Bundle"", ""type"": ""collection"", ""entry"": [{""resource"": {""resourceType"": ""Observation"", ""id"": ""obs1"", ""status"": ""final"", ""code"": {""coding"": [{""system"": ""http://loinc.org"", ""code"": ""8867-4"", ""display"": ""Heart rate""}]}, ""valueQuantity"": {""value"": 72, ""unit"": ""beats/min""}, ""effectiveDateTime"": ""2024-01-15""}}, {""resource"": {""resourceType"": ""Observation"", ""id"": ""obs2"", ""status"": ""final"", ""code"": {""coding"": [{""display"": ""Blood pressure""}]}, ""valueString"": ""120/80 mmHg"", ""effectiveDateTime"": ""2024-01-15""}}]}, ""resourceTypeFilter"": ""Observation""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/FhirBundleToCsv", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
import requests
import json

url = "https://docbutterfly.com/api/FhirBundleToCsv"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"resource": {"resourceType": "Bundle", "type": "collection", "entry": [{"resource": {"resourceType": "Observation", "id": "obs1", "status": "final", "code": {"coding": [{"system": "http://loinc.org", "code": "8867-4", "display": "Heart rate"}]}, "valueQuantity": {"value": 72, "unit": "beats/min"}, "effectiveDateTime": "2024-01-15"}}, {"resource": {"resourceType": "Observation", "id": "obs2", "status": "final", "code": {"coding": [{"display": "Blood pressure"}]}, "valueString": "120/80 mmHg", "effectiveDateTime": "2024-01-15"}}]}, "resourceTypeFilter": "Observation"}')

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/FhirBundleToCsv
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "resource": {
│        "resourceType": "Bundle",
│        "type": "collection",
│        "entry": [
│          {
│            "resource": {
│              "resourceType": "Observation",
│              "id": "obs1",
│              "status": "final",
│              "code": {
│                "coding": [
│                  {
│                    "system": "http://loinc.org",
│                    "code": "8867-4",
│                    "display": "Heart rate"
│                  }
│                ]
│              },
│              "valueQuantity": {
│                "value": 72,
│                "unit": "beats/min"
│              },
│              "effectiveDateTime": "2024-01-15"
│            }
│          },
│          {
│            "resource": {
│              "resourceType": "Observation",
│              "id": "obs2",
│              "status": "final",
│              "code": {
│                "coding": [
│                  {
│                    "display": "Blood pressure"
│                  }
│                ]
│              },
│              "valueString": "120/80 mmHg",
│              "effectiveDateTime": "2024-01-15"
│            }
│          }
│        ]
│      },
│      "resourceTypeFilter": "Observation"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/FhirBundleToCsv"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as needed
Try in Testbed