PDF Operations
Create, merge, split, watermark, and manipulate PDF documents
35 endpoints in this category. All require X-API-Key header.
Merge PDFs
/api/MergePdfs
1 token
Combines multiple PDF documents into a single PDF.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdfs |
array | required | Array of base64-encoded PDF strings |
returnBase64 |
boolean | optional |
Return base64 JSON
(default: true)
|
Request Example
{"pdfs": ["<base64-pdf-1>", "<base64-pdf-2>"], "returnBase64": true}
Response Example
{"pdf": "JVBERi0xLjcK...", "pageCount": 4}
Code Examples
curl -X POST "https://docbutterfly.com/api/MergePdfs" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdfs": ["<base64-pdf-1>", "<base64-pdf-2>"], "returnBase64": true}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdfs"": [""<base64-pdf-1>"", ""<base64-pdf-2>""], ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/MergePdfs", 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/MergePdfs"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdfs": ["<base64-pdf-1>", "<base64-pdf-2>"], "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/MergePdfs
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdfs": [
│ "\u003Cbase64-pdf-1\u003E",
│ "\u003Cbase64-pdf-2\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/MergePdfs"
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.)Split PDF
/api/SplitPdf
1 token
Extracts specific pages from a PDF. Pages are 1-indexed.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
pages |
string | required | Page spec: "1-3,5,7-9" |
returnBase64 |
boolean | optional |
Return base64 JSON
(default: true)
|
Request Example
{"pdf": "<base64-pdf>", "pages": "1-3,5", "returnBase64": true}
Response Example
{"pdf": "JVBERi0xLjcK...", "pageCount": 4}
Code Examples
curl -X POST "https://docbutterfly.com/api/SplitPdf" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "pages": "1-3,5", "returnBase64": true}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""pages"": ""1-3,5"", ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/SplitPdf", 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/SplitPdf"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "pages": "1-3,5", "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/SplitPdf
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "pages": "1-3,5",
│ "returnBase64": true
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/SplitPdf"
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.)Watermark PDF
/api/WatermarkPdf
1 token
Adds a text or image watermark to PDF pages.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
watermark.text |
string | optional | Watermark text |
watermark.fontSize |
number | optional |
Font size
(default: 60)
|
watermark.opacity |
number | optional |
Opacity 0-1
(default: 0.3)
|
watermark.rotation |
number | optional |
Degrees
(default: -45)
|
watermark.position |
string | optional | center, top-left, top-right, etc |
pages |
string | optional |
"all" or "1-3,5"
(default: all)
|
Request Example
{"pdf": "<base64-pdf>", "watermark": {"text": "CONFIDENTIAL", "fontSize": 60, "opacity": 0.3}, "returnBase64": true}
Response Example
{"pdf": "JVBERi0xLjcK..."}
Code Examples
curl -X POST "https://docbutterfly.com/api/WatermarkPdf" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "watermark": {"text": "CONFIDENTIAL", "fontSize": 60, "opacity": 0.3}, "returnBase64": true}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""watermark"": {""text"": ""CONFIDENTIAL"", ""fontSize"": 60, ""opacity"": 0.3}, ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/WatermarkPdf", 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/WatermarkPdf"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "watermark": {"text": "CONFIDENTIAL", "fontSize": 60, "opacity": 0.3}, "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/WatermarkPdf
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "watermark": {
│ "text": "CONFIDENTIAL",
│ "fontSize": 60,
│ "opacity": 0.3
│ },
│ "returnBase64": true
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/WatermarkPdf"
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.)Stamp PDF
/api/StampPdf
1 token
Draws text and/or images at arbitrary (x,y) regions onto a PDF that has no form fields. Coordinates use a top-left origin (y measured down from the top of the page), in PDF points.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
stamps |
array | required | Array of stamp objects. Each: type ("text"|"image"), page (1-based), x, y (top-left origin, points). Text: text, size, color {r,g,b} 0-1, font (Helvetica/HelveticaBold/TimesRoman/Courier), rotation, opacity. Image: image (base64 png/jpg), width, height, opacity |
returnBase64 |
boolean | optional |
Return base64 JSON
(default: true)
|
Request Example
{"pdf": "<base64-pdf>", "stamps": [{"type": "text", "page": 1, "x": 100, "y": 200, "text": "Jamie Miley", "size": 12}, {"type": "image", "page": 1, "x": 50, "y": 400, "image": "<base64-png>", "width": 120, "height": 60}], "returnBase64": true}
Response Example
{"success": true, "pdf": "JVBERi0xLjcK...", "pageCount": 1, "stampsApplied": 2, "errors": []}
Code Examples
curl -X POST "https://docbutterfly.com/api/StampPdf" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "stamps": [{"type": "text", "page": 1, "x": 100, "y": 200, "text": "Jamie Miley", "size": 12}, {"type": "image", "page": 1, "x": 50, "y": 400, "image": "<base64-png>", "width": 120, "height": 60}], "returnBase64": true}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""stamps"": [{""type"": ""text"", ""page"": 1, ""x"": 100, ""y"": 200, ""text"": ""Jamie Miley"", ""size"": 12}, {""type"": ""image"", ""page"": 1, ""x"": 50, ""y"": 400, ""image"": ""<base64-png>"", ""width"": 120, ""height"": 60}], ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/StampPdf", 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/StampPdf"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "stamps": [{"type": "text", "page": 1, "x": 100, "y": 200, "text": "Jamie Miley", "size": 12}, {"type": "image", "page": 1, "x": 50, "y": 400, "image": "<base64-png>", "width": 120, "height": 60}], "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/StampPdf
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "stamps": [
│ {
│ "type": "text",
│ "page": 1,
│ "x": 100,
│ "y": 200,
│ "text": "Jamie Miley",
│ "size": 12
│ },
│ {
│ "type": "image",
│ "page": 1,
│ "x": 50,
│ "y": 400,
│ "image": "\u003Cbase64-png\u003E",
│ "width": 120,
│ "height": 60
│ }
│ ],
│ "returnBase64": true
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/StampPdf"
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.)Add PDF Page Numbers
/api/AddPdfPageNumbers
1 token
Add page numbers to every page of a PDF.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
format |
string | optional | Format: "Page {n} of {total}" |
position |
string | optional |
Position on page
(default: bottom-center)
|
fontSize |
number | optional |
Font size
(default: 12)
|
returnBase64 |
boolean | optional |
Return base64
(default: true)
|
Request Example
{"pdf": "<base64-pdf>", "format": "Page {n} of {total}", "position": "bottom-center", "returnBase64": true}
Code Examples
curl -X POST "https://docbutterfly.com/api/AddPdfPageNumbers" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "format": "Page {n} of {total}", "position": "bottom-center", "returnBase64": true}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""format"": ""Page {n} of {total}"", ""position"": ""bottom-center"", ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/AddPdfPageNumbers", 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/AddPdfPageNumbers"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "format": "Page {n} of {total}", "position": "bottom-center", "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/AddPdfPageNumbers
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "format": "Page {n} of {total}",
│ "position": "bottom-center",
│ "returnBase64": true
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/AddPdfPageNumbers"
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.)Rotate PDF Pages
/api/RotatePdfPages
1 token
Rotate specific pages by 90, 180, or 270 degrees.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
rotation |
number | required | 90, 180, or 270 |
pages |
string | optional |
Pages to rotate
(default: all)
|
returnBase64 |
boolean | optional |
Return base64
(default: true)
|
Request Example
{"pdf": "<base64-pdf>", "rotation": 90, "pages": "all", "returnBase64": true}
Code Examples
curl -X POST "https://docbutterfly.com/api/RotatePdfPages" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "rotation": 90, "pages": "all", "returnBase64": true}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""rotation"": 90, ""pages"": ""all"", ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/RotatePdfPages", 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/RotatePdfPages"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "rotation": 90, "pages": "all", "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/RotatePdfPages
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "rotation": 90,
│ "pages": "all",
│ "returnBase64": true
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/RotatePdfPages"
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.)Delete PDF Pages
/api/DeletePdfPages
1 token
Remove specific pages from a PDF.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
pages |
array | required | Array of page numbers to delete (1-indexed) |
returnBase64 |
boolean | optional |
Return base64
(default: true)
|
Request Example
{"pdf": "<base64-pdf>", "pages": [2, 4], "returnBase64": true}
Code Examples
curl -X POST "https://docbutterfly.com/api/DeletePdfPages" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "pages": [2, 4], "returnBase64": true}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""pages"": [2, 4], ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/DeletePdfPages", 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/DeletePdfPages"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "pages": [2, 4], "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/DeletePdfPages
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "pages": [
│ 2,
│ 4
│ ],
│ "returnBase64": true
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/DeletePdfPages"
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.)Delete Blank PDF Pages
/api/DeleteBlankPdfPages
1 token
Detect and remove blank pages from a PDF.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
threshold |
number | optional |
Blank detection threshold 0-1
(default: 0.02)
|
returnBase64 |
boolean | optional |
Return base64
(default: true)
|
Request Example
{"pdf": "<base64-pdf>", "threshold": 0.02, "returnBase64": true}
Code Examples
curl -X POST "https://docbutterfly.com/api/DeleteBlankPdfPages" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "threshold": 0.02, "returnBase64": true}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""threshold"": 0.02, ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/DeleteBlankPdfPages", 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/DeleteBlankPdfPages"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "threshold": 0.02, "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/DeleteBlankPdfPages
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "threshold": 0.02,
│ "returnBase64": true
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/DeleteBlankPdfPages"
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.)Resize PDF Pages
/api/ResizePdfPages
1 token
Resize PDF pages to explicit dimensions (e.g. Letter = 612 x 792 pt — see the paper-size table on the API reference overview).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
width |
number | required | Target page width |
height |
number | required | Target page height |
unit |
string | optional |
Unit for width/height
(default: pt)
|
pages |
string | optional |
Pages to resize: "all" or "1-3,5"
(default: all)
|
Request Example
{"pdf": "<base64-pdf>", "width": 612, "height": 792, "unit": "pt"}
Response Example
{"success": true, "pdf": "JVBERi0xLjcK...", "pageCount": 3, "resizedPages": [1, 2, 3], "newSize": {"width": 612, "height": 792, "unit": "pt"}}
Code Examples
curl -X POST "https://docbutterfly.com/api/ResizePdfPages" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "width": 612, "height": 792, "unit": "pt"}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""width"": 612, ""height"": 792, ""unit"": ""pt""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/ResizePdfPages", 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/ResizePdfPages"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "width": 612, "height": 792, "unit": "pt"}')
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/ResizePdfPages
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "width": 612,
│ "height": 792,
│ "unit": "pt"
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ResizePdfPages"
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.)Flatten PDF
/api/FlattenPdf
1 token
Flatten all annotations into page content.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
returnBase64 |
boolean | optional |
Return base64
(default: true)
|
Request Example
{"pdf": "<base64-pdf>", "returnBase64": true}
Code Examples
curl -X POST "https://docbutterfly.com/api/FlattenPdf" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "returnBase64": true}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/FlattenPdf", 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/FlattenPdf"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "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/FlattenPdf
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\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/FlattenPdf"
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.)Flatten PDF Forms
/api/FlattenPdfForms
1 token
Flatten form fields, embedding values into page content.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
returnBase64 |
boolean | optional |
Return base64
(default: true)
|
Request Example
{"pdf": "<base64-pdf>", "returnBase64": true}
Code Examples
curl -X POST "https://docbutterfly.com/api/FlattenPdfForms" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "returnBase64": true}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/FlattenPdfForms", 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/FlattenPdfForms"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "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/FlattenPdfForms
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\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/FlattenPdfForms"
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.)Fill PDF Form
/api/FillPdfForm
1 token
Fill PDF form fields with provided values.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
fields |
object | required | Object mapping field names to values |
flatten |
boolean | optional |
Flatten after filling
(default: false)
|
returnBase64 |
boolean | optional |
Return base64
(default: true)
|
Request Example
{"pdf": "<base64-pdf>", "fields": {"name": "John Doe", "email": "john@example.com"}, "flatten": false, "returnBase64": true}
Code Examples
curl -X POST "https://docbutterfly.com/api/FillPdfForm" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "fields": {"name": "John Doe", "email": "john@example.com"}, "flatten": false, "returnBase64": true}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""fields"": {""name"": ""John Doe"", ""email"": ""john@example.com""}, ""flatten"": false, ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/FillPdfForm", 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/FillPdfForm"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "fields": {"name": "John Doe", "email": "john@example.com"}, "flatten": false, "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/FillPdfForm
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "fields": {
│ "name": "John Doe",
│ "email": "john@example.com"
│ },
│ "flatten": false,
│ "returnBase64": true
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/FillPdfForm"
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.)Secure PDF
/api/SecurePdf
1 token
Add password protection to a PDF.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
userPassword |
string | required | Password to open |
ownerPassword |
string | optional | Owner password |
returnBase64 |
boolean | optional |
Return base64
(default: true)
|
Request Example
{"pdf": "<base64-pdf>", "userPassword": "secret123", "returnBase64": true}
Code Examples
curl -X POST "https://docbutterfly.com/api/SecurePdf" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "userPassword": "secret123", "returnBase64": true}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""userPassword"": ""secret123"", ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/SecurePdf", 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/SecurePdf"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "userPassword": "secret123", "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/SecurePdf
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "userPassword": "secret123",
│ "returnBase64": true
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/SecurePdf"
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.)Unlock PDF
/api/UnlockPdf
1 token
Remove password protection from a PDF.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
password |
string | required | Current password |
returnBase64 |
boolean | optional |
Return base64
(default: true)
|
Request Example
{"pdf": "<base64-pdf>", "password": "secret123", "returnBase64": true}
Code Examples
curl -X POST "https://docbutterfly.com/api/UnlockPdf" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "password": "secret123", "returnBase64": true}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""password"": ""secret123"", ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/UnlockPdf", 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/UnlockPdf"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "password": "secret123", "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/UnlockPdf
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "password": "secret123",
│ "returnBase64": true
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/UnlockPdf"
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.)Set PDF Metadata
/api/SetPdfMetadata
1 token
Set PDF document metadata.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
metadata.title |
string | optional | Document title |
metadata.author |
string | optional | Author |
metadata.subject |
string | optional | Subject |
metadata.keywords |
string | optional | Keywords |
returnBase64 |
boolean | optional |
Return base64
(default: true)
|
Request Example
{"pdf": "<base64-pdf>", "metadata": {"title": "My Document", "author": "DocFlow"}, "returnBase64": true}
Code Examples
curl -X POST "https://docbutterfly.com/api/SetPdfMetadata" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "metadata": {"title": "My Document", "author": "DocFlow"}, "returnBase64": true}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""metadata"": {""title"": ""My Document"", ""author"": ""DocFlow""}, ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/SetPdfMetadata", 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/SetPdfMetadata"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "metadata": {"title": "My Document", "author": "DocFlow"}, "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/SetPdfMetadata
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "metadata": {
│ "title": "My Document",
│ "author": "DocFlow"
│ },
│ "returnBase64": true
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/SetPdfMetadata"
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.)Get PDF Metadata
/api/GetPdfMetadata
1 token
Extract PDF document metadata.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
Request Example
{"pdf": "<base64-pdf>"}
Response Example
{"title": "Document", "author": "DocFlow", "pageCount": 5, "creator": "pdf-lib"}
Code Examples
curl -X POST "https://docbutterfly.com/api/GetPdfMetadata" \
-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/GetPdfMetadata", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);import requests
import json
url = "https://docbutterfly.com/api/GetPdfMetadata"
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/GetPdfMetadata
│ │
│ 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/GetPdfMetadata"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as neededExtract PDF Text
/api/ExtractPdfText
1 token
Extract all text content from a PDF.
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/ExtractPdfText" \
-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/ExtractPdfText", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);import requests
import json
url = "https://docbutterfly.com/api/ExtractPdfText"
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/ExtractPdfText
│ │
│ 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/ExtractPdfText"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as neededExtract PDF Text by Page
/api/ExtractPdfTextByPage
1 token
Extract text from specific pages.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
pages |
string | optional | Page numbers: "1-3,5" |
Request Example
{"pdf": "<base64-pdf>", "pages": "1-3"}
Response Example
{"pages": [{"page": 1, "text": "Page 1 text..."}]}
Code Examples
curl -X POST "https://docbutterfly.com/api/ExtractPdfTextByPage" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "pages": "1-3"}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""pages"": ""1-3""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/ExtractPdfTextByPage", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);import requests
import json
url = "https://docbutterfly.com/api/ExtractPdfTextByPage"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "pages": "1-3"}')
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/ExtractPdfTextByPage
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "pages": "1-3"
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ExtractPdfTextByPage"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as neededExtract PDF Form Data
/api/ExtractPdfFormData
1 token
Extract form field names and values.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
Request Example
{"pdf": "<base64-pdf>"}
Response Example
{"fields": [{"name": "firstName", "type": "text", "value": "John"}]}
Code Examples
curl -X POST "https://docbutterfly.com/api/ExtractPdfFormData" \
-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/ExtractPdfFormData", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);import requests
import json
url = "https://docbutterfly.com/api/ExtractPdfFormData"
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/ExtractPdfFormData
│ │
│ 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/ExtractPdfFormData"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as neededExtract PDF Hyperlinks
/api/ExtractPdfHyperlinks
1 token
Extract all hyperlinks from a PDF.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
Request Example
{"pdf": "<base64-pdf>"}
Response Example
{"links": [{"url": "https://example.com", "page": 1}]}
Code Examples
curl -X POST "https://docbutterfly.com/api/ExtractPdfHyperlinks" \
-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/ExtractPdfHyperlinks", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);import requests
import json
url = "https://docbutterfly.com/api/ExtractPdfHyperlinks"
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/ExtractPdfHyperlinks
│ │
│ 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/ExtractPdfHyperlinks"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as neededExtract PDF Images
/api/ExtractPdfImages
1 token
Extract embedded images from a PDF.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
format |
string | optional |
png or jpeg
(default: png)
|
Request Example
{"pdf": "<base64-pdf>", "format": "png"}
Response Example
{"images": [{"page": 1, "width": 200, "height": 100, "data": "iVBORw0..."}]}
Code Examples
curl -X POST "https://docbutterfly.com/api/ExtractPdfImages" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "format": "png"}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""format"": ""png""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/ExtractPdfImages", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);import requests
import json
url = "https://docbutterfly.com/api/ExtractPdfImages"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "format": "png"}')
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/ExtractPdfImages
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "format": "png"
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ExtractPdfImages"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as neededExtract PDF Pages
/api/ExtractPdfPages
1 token
Extract pages as individual PDF files.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
pages |
string | required | Pages: "1-3,5" |
Request Example
{"pdf": "<base64-pdf>", "pages": "1-3"}
Response Example
{"pages": [{"page": 1, "pdf": "JVBERi0..."}]}
Code Examples
curl -X POST "https://docbutterfly.com/api/ExtractPdfPages" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "pages": "1-3"}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""pages"": ""1-3""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/ExtractPdfPages", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);import requests
import json
url = "https://docbutterfly.com/api/ExtractPdfPages"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "pages": "1-3"}')
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/ExtractPdfPages
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "pages": "1-3"
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ExtractPdfPages"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as neededExtract PDF Pages by Text
/api/ExtractPdfPagesByText
2 tokens
Extract pages containing specific text.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
searchText |
string | required | Text to search for |
caseSensitive |
boolean | optional |
Case-sensitive
(default: false)
|
Request Example
{"pdf": "<base64-pdf>", "searchText": "invoice", "caseSensitive": false}
Response Example
{"matchingPages": [1, 3], "pages": [{"page": 1, "pdf": "JVBERi0..."}]}
Code Examples
curl -X POST "https://docbutterfly.com/api/ExtractPdfPagesByText" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "searchText": "invoice", "caseSensitive": false}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""searchText"": ""invoice"", ""caseSensitive"": false}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/ExtractPdfPagesByText", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);import requests
import json
url = "https://docbutterfly.com/api/ExtractPdfPagesByText"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "searchText": "invoice", "caseSensitive": false}')
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/ExtractPdfPagesByText
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "searchText": "invoice",
│ "caseSensitive": false
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ExtractPdfPagesByText"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as neededCheck PDF Password
/api/CheckPdfPassword
1 token
Check if a PDF is password-protected.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
password |
string | optional | Password to verify |
Request Example
{"pdf": "<base64-pdf>"}
Response Example
{"isProtected": true, "passwordValid": null}
Code Examples
curl -X POST "https://docbutterfly.com/api/CheckPdfPassword" \
-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/CheckPdfPassword", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);import requests
import json
url = "https://docbutterfly.com/api/CheckPdfPassword"
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/CheckPdfPassword
│ │
│ 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/CheckPdfPassword"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as neededAdd PDF Attachments
/api/AddPdfAttachments
1 token
Embed file attachments into a PDF.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
attachments |
array | required | Array of {name, content, mimeType} |
returnBase64 |
boolean | optional |
Return base64
(default: true)
|
Request Example
{"pdf": "<base64-pdf>", "attachments": [{"name": "data.csv", "content": "<base64>", "mimeType": "text/csv"}], "returnBase64": true}
Code Examples
curl -X POST "https://docbutterfly.com/api/AddPdfAttachments" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "attachments": [{"name": "data.csv", "content": "<base64>", "mimeType": "text/csv"}], "returnBase64": true}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""attachments"": [{""name"": ""data.csv"", ""content"": ""<base64>"", ""mimeType"": ""text/csv""}], ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/AddPdfAttachments", 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/AddPdfAttachments"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "attachments": [{"name": "data.csv", "content": "<base64>", "mimeType": "text/csv"}], "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/AddPdfAttachments
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "attachments": [
│ {
│ "name": "data.csv",
│ "content": "\u003Cbase64\u003E",
│ "mimeType": "text/csv"
│ }
│ ],
│ "returnBase64": true
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/AddPdfAttachments"
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.)Crop PDF Pages
/api/CropPdfPages
1 token
Sets the crop (or media/bleed/trim/art) box on some or all pages, so the visible page is the region you name. Cropping is VISUAL — content outside the box is still in the file. To remove it, use the Redaction endpoints.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
box |
object | required | { x, y, width, height } in the unit given by "unit". width and height must be greater than zero |
pages |
string | optional |
Pages to crop: "all", "1-3,5", or an array of 1-based page numbers
(default: all)
|
unit |
string | optional |
Unit the box is expressed in
(default: pt)
|
boxType |
string | optional |
Which PDF box to set
(default: crop)
|
origin |
string | optional |
Where box.y is measured from. PDF user space is bottom-left; design and screenshot tools measure from the top
(default: bottom-left)
|
Request Example
{"pdf": "<base64-pdf>", "box": {"x": 0, "y": 0, "width": 400, "height": 600}, "unit": "pt", "origin": "bottom-left"}
Response Example
{"success": true, "pdf": "JVBERi0xLjcK...", "pageCount": 3, "croppedPages": [1, 2, 3], "boxType": "crop"}
Code Examples
curl -X POST "https://docbutterfly.com/api/CropPdfPages" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "box": {"x": 0, "y": 0, "width": 400, "height": 600}, "unit": "pt", "origin": "bottom-left"}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""box"": {""x"": 0, ""y"": 0, ""width"": 400, ""height"": 600}, ""unit"": ""pt"", ""origin"": ""bottom-left""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/CropPdfPages", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);import requests
import json
url = "https://docbutterfly.com/api/CropPdfPages"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "box": {"x": 0, "y": 0, "width": 400, "height": 600}, "unit": "pt", "origin": "bottom-left"}')
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/CropPdfPages
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "box": {
│ "x": 0,
│ "y": 0,
│ "width": 400,
│ "height": 600
│ },
│ "unit": "pt",
│ "origin": "bottom-left"
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/CropPdfPages"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as neededInsert PDF Pages
/api/InsertPdfPages
1 token
Inserts pages from one PDF into another at a chosen position — the one-call version of split-then-merge.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF to insert INTO |
insert |
string | required | Base64-encoded PDF to take pages FROM |
at |
number | optional |
1-based position: these pages become page N. Omit (or pass pageCount+1) to append
(default: append)
|
pages |
string | optional |
Which pages of "insert" to take: "all", "1-3,5", or an array of 1-based page numbers
(default: all)
|
Request Example
{"pdf": "<base64-pdf>", "insert": "<base64-pdf>", "at": 2, "pages": "1-2"}
Response Example
{"success": true, "pdf": "JVBERi0xLjcK...", "pageCount": 5, "originalPageCount": 3, "insertedPages": [2, 3], "at": 2}
Code Examples
curl -X POST "https://docbutterfly.com/api/InsertPdfPages" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "insert": "<base64-pdf>", "at": 2, "pages": "1-2"}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""insert"": ""<base64-pdf>"", ""at"": 2, ""pages"": ""1-2""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/InsertPdfPages", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);import requests
import json
url = "https://docbutterfly.com/api/InsertPdfPages"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "insert": "<base64-pdf>", "at": 2, "pages": "1-2"}')
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/InsertPdfPages
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "insert": "\u003Cbase64-pdf\u003E",
│ "at": 2,
│ "pages": "1-2"
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/InsertPdfPages"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as neededReorder PDF Pages
/api/ReorderPdfPages
1 token
Rewrites a PDF's page order in one call. "order" must be a PERMUTATION — every page listed exactly once — so a typo cannot silently drop or duplicate a page.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
order |
array | required | Every 1-based page number, exactly once, in the order you want them |
Request Example
{"pdf": "<base64-pdf>", "order": [3, 1, 2]}
Response Example
{"success": true, "pdf": "JVBERi0xLjcK...", "pageCount": 3, "order": [3, 1, 2]}
Code Examples
curl -X POST "https://docbutterfly.com/api/ReorderPdfPages" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "order": [3, 1, 2]}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""order"": [3, 1, 2]}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/ReorderPdfPages", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);import requests
import json
url = "https://docbutterfly.com/api/ReorderPdfPages"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "order": [3, 1, 2]}')
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/ReorderPdfPages
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "order": [
│ 3,
│ 1,
│ 2
│ ]
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ReorderPdfPages"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as neededAdd PDF Bookmarks
/api/AddPdfBookmarks
1 token
Adds a bookmark (outline) tree to a PDF from a nested list of titles and target pages, so readers get a navigable pane in Acrobat, Chrome and Edge.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
bookmarks |
array | required | Nested list of { title, page, collapsed?, children? }. page is 1-based and must exist in the document |
replace |
boolean | optional |
Overwrite an outline the document already has. Pass false to be told instead of losing it
(default: true)
|
openPane |
boolean | optional |
Open the reader's bookmark pane automatically (sets /PageMode /UseOutlines)
(default: true)
|
Request Example
{"pdf": "<base64-pdf>", "bookmarks": [{"title": "Chapter 1", "page": 1, "children": [{"title": "Section 1.1", "page": 2}]}, {"title": "Chapter 2", "page": 5, "collapsed": true}]}
Response Example
{"success": true, "pdf": "JVBERi0xLjcK...", "pageCount": 8, "bookmarkCount": 3, "topLevelCount": 2, "visibleCount": 3, "replacedExisting": false}
Code Examples
curl -X POST "https://docbutterfly.com/api/AddPdfBookmarks" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "bookmarks": [{"title": "Chapter 1", "page": 1, "children": [{"title": "Section 1.1", "page": 2}]}, {"title": "Chapter 2", "page": 5, "collapsed": true}]}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""bookmarks"": [{""title"": ""Chapter 1"", ""page"": 1, ""children"": [{""title"": ""Section 1.1"", ""page"": 2}]}, {""title"": ""Chapter 2"", ""page"": 5, ""collapsed"": true}]}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/AddPdfBookmarks", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);import requests
import json
url = "https://docbutterfly.com/api/AddPdfBookmarks"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "bookmarks": [{"title": "Chapter 1", "page": 1, "children": [{"title": "Section 1.1", "page": 2}]}, {"title": "Chapter 2", "page": 5, "collapsed": 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/AddPdfBookmarks
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "bookmarks": [
│ {
│ "title": "Chapter 1",
│ "page": 1,
│ "children": [
│ {
│ "title": "Section 1.1",
│ "page": 2
│ }
│ ]
│ },
│ {
│ "title": "Chapter 2",
│ "page": 5,
│ "collapsed": true
│ }
│ ]
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/AddPdfBookmarks"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as neededInsert PDF Table of Contents
/api/InsertPdfToc
1 token
Generates table-of-contents page(s) with clickable entries and inserts them into the PDF. Every target page is renumbered for the pages the contents itself adds, so the links land where the text says.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
entries |
array | optional | Flat list of { title, page, level? } — level indents the line (1 = flush left) |
bookmarks |
array | optional | Nested { title, page, children? } tree instead of entries; nesting becomes the indent level |
at |
number | optional |
1-based position for the contents pages
(default: 1)
|
title |
string | optional |
Heading printed at the top
(default: Table of Contents)
|
pageSize |
string | optional | Paper size for the generated pages. Defaults to matching the document's first page |
orientation |
string | optional | Orientation, when pageSize is named |
fontSize |
number | optional |
Entry text size in points
(default: 11)
|
titleFontSize |
number | optional |
Heading size in points
(default: 18)
|
indent |
number | optional |
Points of indent per level
(default: 18)
|
addBookmarks |
boolean | optional |
Also write the outline pane from the same tree (needs the nested "bookmarks" input)
(default: false)
|
Request Example
{"pdf": "<base64-pdf>", "bookmarks": [{"title": "Introduction", "page": 1, "children": [{"title": "Background", "page": 3}]}], "addBookmarks": true}
Response Example
{"success": true, "pdf": "JVBERi0xLjcK...", "pageCount": 13, "originalPageCount": 12, "tocPageNumbers": [1], "entryCount": 2, "at": 1, "bookmarksAdded": 2, "sanitizedTitles": 0}
Code Examples
curl -X POST "https://docbutterfly.com/api/InsertPdfToc" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "bookmarks": [{"title": "Introduction", "page": 1, "children": [{"title": "Background", "page": 3}]}], "addBookmarks": true}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""bookmarks"": [{""title"": ""Introduction"", ""page"": 1, ""children"": [{""title"": ""Background"", ""page"": 3}]}], ""addBookmarks"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/InsertPdfToc", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);import requests
import json
url = "https://docbutterfly.com/api/InsertPdfToc"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "bookmarks": [{"title": "Introduction", "page": 1, "children": [{"title": "Background", "page": 3}]}], "addBookmarks": 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/InsertPdfToc
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "bookmarks": [
│ {
│ "title": "Introduction",
│ "page": 1,
│ "children": [
│ {
│ "title": "Background",
│ "page": 3
│ }
│ ]
│ }
│ ],
│ "addBookmarks": true
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/InsertPdfToc"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as neededCompress PDF
/api/CompressPdf
1 token
Shrinks a PDF by re-encoding the images inside it at a lower quality, and optionally downsampling or converting them to grayscale. Best on scans and photos; a text-only PDF will barely change.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
imageQuality |
number | optional |
JPEG quality for re-encoded images, 1-100. Lower is smaller
(default: 60)
|
maxImageDimension |
number | optional | Downsample any image whose longest side exceeds this many pixels. Omit to keep pixel dimensions |
grayscale |
boolean | optional |
Convert re-encoded images to grayscale
(default: false)
|
Request Example
{"pdf": "<base64-pdf>", "imageQuality": 50, "maxImageDimension": 1600}
Response Example
{"success": true, "pdf": "JVBERi0xLjcK...", "originalSize": 4180233, "compressedSize": 812004, "bytesSaved": 3368229, "imagesFound": 6, "imagesRecompressed": 5, "imagesSkipped": 1, "images": [{"name": "Im0", "action": "recompressed", "originalBytes": 902114, "newBytes": 141602}]}
Code Examples
curl -X POST "https://docbutterfly.com/api/CompressPdf" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "imageQuality": 50, "maxImageDimension": 1600}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""imageQuality"": 50, ""maxImageDimension"": 1600}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/CompressPdf", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);import requests
import json
url = "https://docbutterfly.com/api/CompressPdf"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "imageQuality": 50, "maxImageDimension": 1600}')
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/CompressPdf
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "imageQuality": 50,
│ "maxImageDimension": 1600
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/CompressPdf"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as neededSign PDF (Digital Certificate)
/api/SignPdf
1 token
Applies a cryptographic digital signature to a PDF using YOUR PKCS#12 certificate, producing the signed-document banner Acrobat shows. Different from the e-signature endpoints, which orchestrate a person signing.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pdf |
string | required | Base64-encoded PDF |
pfx |
string | required | Your PKCS#12 bundle (.p12 / .pfx) as base64. Used for this call only and never stored |
passphrase |
string | optional | Password protecting the PKCS#12 bundle |
reason |
string | optional |
Reason recorded in the signature
(default: Signed with DocButterfly)
|
name |
string | optional | Signer name recorded in the signature |
location |
string | optional | Location recorded in the signature |
contactInfo |
string | optional | Contact details recorded in the signature |
pades |
boolean | optional |
Use the ETSI PAdES SubFilter instead of the Adobe one
(default: false)
|
signatureLength |
number | optional |
Bytes reserved for the signature. Raise only if signing fails because it does not fit
(default: 8192)
|
Request Example
{"pdf": "<base64-pdf>", "pfx": "<base64-p12>", "passphrase": "<certificate password>", "reason": "Approved by finance", "name": "A. Signer"}
Response Example
{"success": true, "pdf": "JVBERi0xLjcK...", "signedAt": "2026-08-21T10:04:11.000Z", "subFilter": "adbe.pkcs7.detached", "signatureLength": 8192, "pageCount": 3}
Code Examples
curl -X POST "https://docbutterfly.com/api/SignPdf" \
-H "X-API-Key: df_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"pdf": "<base64-pdf>", "pfx": "<base64-p12>", "passphrase": "<certificate password>", "reason": "Approved by finance", "name": "A. Signer"}'using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");
var json = @"{""pdf"": ""<base64-pdf>"", ""pfx"": ""<base64-p12>"", ""passphrase"": ""<certificate password>"", ""reason"": ""Approved by finance"", ""name"": ""A. Signer""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://docbutterfly.com/api/SignPdf", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);import requests
import json
url = "https://docbutterfly.com/api/SignPdf"
headers = {
"X-API-Key": "df_your_api_key_here",
"Content-Type": "application/json"
}
payload = json.loads('{"pdf": "<base64-pdf>", "pfx": "<base64-p12>", "passphrase": "<certificate password>", "reason": "Approved by finance", "name": "A. Signer"}')
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/SignPdf
│ │
│ Headers: │
│ X-API-Key: df_your_api_key_here │
│ Content-Type: application/json │
│ │
│ Body: │
│ {
│ "pdf": "\u003Cbase64-pdf\u003E",
│ "pfx": "\u003Cbase64-p12\u003E",
│ "passphrase": "\u003Ccertificate password\u003E",
│ "reason": "Approved by finance",
│ "name": "A. Signer"
│ }
│ │
└─────────────────────────────────────────────┘
Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/SignPdf"
4. Add the headers shown above
5. Paste the Body JSON into the Body field
6. Replace placeholder values with dynamic content as neededConvert Image to PDF
/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.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
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
{"images": ["<base64-jpeg>", "<base64-png>"], "pageSize": "fit", "dpi": 96}
Response Example
{"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 neededConvert TIFF to PDF
/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.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
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
{"tiff": "<base64-tiff>", "pageSize": "fit", "dpi": 200}
Response Example
{"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