Format Conversion
Convert between PDF, HTML, image, and text formats
14 endpoints in this category. All require X-API-Key header.
Convert HTML to PDF
/api/ConvertHtmlToPdf
1 token
Converts an HTML string to a PDF document using a headless Chromium browser.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
html |
string | required | HTML content to convert |
returnBase64 |
boolean | optional |
Return base64 JSON or raw binary
(default: true)
|
options.format |
string | optional | Page size: A4, Letter, Legal |
options.printBackground |
boolean | optional | Include CSS backgrounds |
options.margin |
object | optional | { top, right, bottom, left } in CSS units |
Request Example
{"html": "<h1>Hello World</h1>\n<p>Generated by DocFlow.</p>", "returnBase64": true}
Response Example
{"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>", "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>"", ""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>", "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",
│ "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.)Convert PDF to Image
/api/ConvertPdfToImage
2 tokens
Convert PDF pages to PNG or JPEG images.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
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
{"pdf": "<base64-pdf>", "options": {"format": "png", "pages": [1], "dpi": 150}}
Response Example
{"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 neededConvert PDF to Text
/api/ConvertPdfToText
1 token
Extract text content from a PDF document.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
Request Example
{"pdf": "<base64-pdf>"}
Response Example
{"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 neededConvert HTML to Image
/api/ConvertHtmlToImage
1 token
Render HTML as a PNG or JPEG screenshot.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
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
{"html": "<h1>Hello World</h1>", "options": {"format": "png", "width": 800, "height": 600}, "returnBase64": true}
Response Example
{"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 neededConvert Text to PDF
/api/ConvertTextToPdf
1 token
Convert plain text to a formatted PDF.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
text |
string | required | Plain text content |
options.fontSize |
number | optional |
Font size
(default: 12)
|
options.pageSize |
string | optional |
A4 or Letter
(default: A4)
|
returnBase64 |
boolean | optional |
Return base64
(default: true)
|
Request Example
{"text": "This is plain text content.", "options": {"fontSize": 12, "pageSize": "A4"}, "returnBase64": true}
Response Example
{"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": "A4"}, "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"": ""A4""}, ""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": "A4"}, "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": "A4"
│ },
│ "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.)Convert Markdown to HTML
/api/ConvertMarkdownToHtml
1 token
Convert Markdown text to HTML using GitHub-Flavored Markdown.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
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
{"markdown": "# Hello World\n\nThis is **bold** and *italic* text."}
Response Example
{"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 neededConvert Markdown to PDF
/api/ConvertMarkdownToPdf
1 token
Convert Markdown text to a styled PDF document via Chromium rendering.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
markdown |
string | required | Markdown text to convert |
options.format |
string | optional |
Page size: A4 or Letter
(default: A4)
|
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
{"markdown": "# Report\n\n## Summary\n\nKey findings:\n- Item 1\n- Item 2"}
Response Example
{"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.)Convert DOCX to HTML
/api/ConvertDocxToHtml
1 token
Convert a Word DOCX document to HTML using mammoth.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
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
{"file": "<base64-docx>"}
Response Example
{"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 neededConvert DOCX to Markdown
/api/ConvertDocxToMarkdown
1 token
Convert a Word DOCX document to Markdown text.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
file |
string | required | Base64-encoded DOCX file |
options.styleMap |
array | optional | Custom mammoth style map rules |
Request Example
{"file": "<base64-docx>"}
Response Example
{"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 neededConvert DOCX to PDF
/api/ConvertDocxToPdf
2 tokens
Convert a Word DOCX document to PDF via mammoth HTML conversion and Chromium rendering.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
file |
string | required | Base64-encoded DOCX file |
options.format |
string | optional |
Page size: A4 or Letter
(default: A4)
|
options.css |
string | optional | Additional CSS for styling |
options.margin |
object | optional | Page margins {top, right, bottom, left} |
Request Example
{"file": "<base64-docx>"}
Response Example
{"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.)Convert HTML to DOCX
/api/ConvertHtmlToDocx
1 token
Convert HTML content to a Word DOCX document.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
html |
string | required | HTML content to convert |
options.title |
string | optional | Document title metadata |
options.orientation |
string | optional |
portrait or landscape
(default: portrait)
|
options.pageSize |
object | optional | Page size object |
Request Example
{"html": "<h1>Hello World</h1><p>Test document from <strong>HTML</strong>.</p>"}
Response Example
{"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 neededConvert CSV to Excel
/api/ConvertCsvToExcel
1 token
Convert CSV text to an Excel XLSX workbook.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
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
{"csv": "Name,Age,City\nAlice,30,London\nBob,25,Paris", "options": {"hasHeaders": true}}
Response Example
{"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 neededConvert Excel to CSV
/api/ConvertExcelToCsv
1 token
Convert an Excel XLSX worksheet to CSV text.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
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
{"file": "<base64-xlsx>", "options": {"worksheet": "Sheet1"}}
Response Example
{"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 neededConvert Excel to JSON
/api/ConvertExcelToJson
1 token
Convert an Excel XLSX worksheet to a JSON array.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
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
{"file": "<base64-xlsx>", "options": {"worksheet": "Sheet1", "hasHeaders": true}}
Response Example
{"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