Word Operations

Template population, merge, extract, watermark, and manipulate DOCX documents

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


Word Populate Template

POST /api/WordPopulateTemplate 1 token

Fill {placeholder} tags in a DOCX template with JSON data.

Parameters
NameTypeRequiredDescription
file string required Base64-encoded DOCX file
data object required Key-value pairs mapping placeholders to values
Request Example
JSON
{"file": "<base64-docx>", "data": {"name": "John Doe", "company": "ACME Corp", "date": "2026-02-06"}}
Response Example
JSON
{"file": "UEsDBBQAAAA..."}
Code Examples
curl -X POST "https://docbutterfly.com/api/WordPopulateTemplate" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"file": "<base64-docx>", "data": {"name": "John Doe", "company": "ACME Corp", "date": "2026-02-06"}}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""file"": ""<base64-docx>"", ""data"": {""name"": ""John Doe"", ""company"": ""ACME Corp"", ""date"": ""2026-02-06""}}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

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

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

url = "https://docbutterfly.com/api/WordPopulateTemplate"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"file": "<base64-docx>", "data": {"name": "John Doe", "company": "ACME Corp", "date": "2026-02-06"}}')

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/WordPopulateTemplate
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "file": "\u003Cbase64-docx\u003E",
│      "data": {
│        "name": "John Doe",
│        "company": "ACME Corp",
│        "date": "2026-02-06"
│      }
│    }
│                                             │
└─────────────────────────────────────────────┘

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

Word Merge Documents

POST /api/WordMergeDocuments 1 token

Combine multiple DOCX files into a single document with page breaks between them.

Parameters
NameTypeRequiredDescription
files array required Array of base64-encoded DOCX files
Request Example
JSON
{"files": ["<base64-docx-1>", "<base64-docx-2>"]}
Response Example
JSON
{"file": "UEsDBBQAAAA..."}
Code Examples
curl -X POST "https://docbutterfly.com/api/WordMergeDocuments" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"files": ["<base64-docx-1>", "<base64-docx-2>"]}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

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

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

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

url = "https://docbutterfly.com/api/WordMergeDocuments"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"files": ["<base64-docx-1>", "<base64-docx-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/WordMergeDocuments
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "files": [
│        "\u003Cbase64-docx-1\u003E",
│        "\u003Cbase64-docx-2\u003E"
│      ]
│    }
│                                             │
└─────────────────────────────────────────────┘

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

Word Extract Text

POST /api/WordExtractText 1 token

Extract plain text content from a DOCX document.

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

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

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

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

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

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

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

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

Word Extract Images

POST /api/WordExtractImages 1 token

Extract all embedded images from a DOCX document.

Parameters
NameTypeRequiredDescription
file string required Base64-encoded DOCX file
Request Example
JSON
{"file": "<base64-docx>"}
Response Example
JSON
{"images": [{"name": "image1.png", "data": "iVBORw0...", "mimeType": "image/png"}], "count": 1}
Code Examples
curl -X POST "https://docbutterfly.com/api/WordExtractImages" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"file": "<base64-docx>"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

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

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

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

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

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

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

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

Word Extract Metadata

POST /api/WordExtractMetadata 1 token

Extract document properties and metadata from a DOCX file.

Parameters
NameTypeRequiredDescription
file string required Base64-encoded DOCX file
Request Example
JSON
{"file": "<base64-docx>"}
Response Example
JSON
{"metadata": {"title": "Report", "creator": "John", "created": "2026-01-01"}}
Code Examples
curl -X POST "https://docbutterfly.com/api/WordExtractMetadata" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"file": "<base64-docx>"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

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

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

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

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

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

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

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

Word Add Text Watermark

POST /api/WordAddTextWatermark 1 token

Add a diagonal text watermark to a DOCX document.

Parameters
NameTypeRequiredDescription
file string required Base64-encoded DOCX file
text string required Watermark text
fontSize number optional Font size in pt (default: 72)
color string optional Hex color without # (default: CCCCCC)
Request Example
JSON
{"file": "<base64-docx>", "text": "CONFIDENTIAL", "fontSize": 72, "color": "CCCCCC"}
Response Example
JSON
{"file": "UEsDBBQAAAA..."}
Code Examples
curl -X POST "https://docbutterfly.com/api/WordAddTextWatermark" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"file": "<base64-docx>", "text": "CONFIDENTIAL", "fontSize": 72, "color": "CCCCCC"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

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

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

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

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

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/WordAddTextWatermark
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "file": "\u003Cbase64-docx\u003E",
│      "text": "CONFIDENTIAL",
│      "fontSize": 72,
│      "color": "CCCCCC"
│    }
│                                             │
└─────────────────────────────────────────────┘

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

Word Add Image Watermark

POST /api/WordAddImageWatermark 1 token

Add an image watermark behind document content.

Parameters
NameTypeRequiredDescription
file string required Base64-encoded DOCX file
image string required Base64-encoded image
opacity number optional Opacity 0-1 (default: 0.5)
Request Example
JSON
{"file": "<base64-docx>", "image": "<base64-image>", "opacity": 0.5}
Response Example
JSON
{"file": "UEsDBBQAAAA..."}
Code Examples
curl -X POST "https://docbutterfly.com/api/WordAddImageWatermark" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"file": "<base64-docx>", "image": "<base64-image>", "opacity": 0.5}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

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

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

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

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

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/WordAddImageWatermark
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "file": "\u003Cbase64-docx\u003E",
│      "image": "\u003Cbase64-image\u003E",
│      "opacity": 0.5
│    }
│                                             │
└─────────────────────────────────────────────┘

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

Word Add Text Header/Footer

POST /api/WordAddTextHeaderFooter 1 token

Add text headers and/or footers to a DOCX document.

Parameters
NameTypeRequiredDescription
file string required Base64-encoded DOCX file
header object optional {left, center, right} text
footer object optional {left, center, right} text
Request Example
JSON
{"file": "<base64-docx>", "header": {"center": "CONFIDENTIAL"}, "footer": {"left": "DocFlow", "right": "Page 1"}}
Response Example
JSON
{"file": "UEsDBBQAAAA..."}
Code Examples
curl -X POST "https://docbutterfly.com/api/WordAddTextHeaderFooter" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"file": "<base64-docx>", "header": {"center": "CONFIDENTIAL"}, "footer": {"left": "DocFlow", "right": "Page 1"}}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""file"": ""<base64-docx>"", ""header"": {""center"": ""CONFIDENTIAL""}, ""footer"": {""left"": ""DocFlow"", ""right"": ""Page 1""}}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

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

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

url = "https://docbutterfly.com/api/WordAddTextHeaderFooter"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"file": "<base64-docx>", "header": {"center": "CONFIDENTIAL"}, "footer": {"left": "DocFlow", "right": "Page 1"}}')

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/WordAddTextHeaderFooter
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "file": "\u003Cbase64-docx\u003E",
│      "header": {
│        "center": "CONFIDENTIAL"
│      },
│      "footer": {
│        "left": "DocFlow",
│        "right": "Page 1"
│      }
│    }
│                                             │
└─────────────────────────────────────────────┘

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

Word Add Image Header/Footer

POST /api/WordAddImageHeaderFooter 1 token

Add images to DOCX headers and/or footers.

Parameters
NameTypeRequiredDescription
file string required Base64-encoded DOCX file
headerImage string optional Base64 image for header
footerImage string optional Base64 image for footer
width number optional Image width in px (default: 200)
height number optional Image height in px (default: 50)
Request Example
JSON
{"file": "<base64-docx>", "headerImage": "<base64-image>", "width": 200, "height": 50}
Response Example
JSON
{"file": "UEsDBBQAAAA..."}
Code Examples
curl -X POST "https://docbutterfly.com/api/WordAddImageHeaderFooter" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"file": "<base64-docx>", "headerImage": "<base64-image>", "width": 200, "height": 50}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

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

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

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

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

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/WordAddImageHeaderFooter
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "file": "\u003Cbase64-docx\u003E",
│      "headerImage": "\u003Cbase64-image\u003E",
│      "width": 200,
│      "height": 50
│    }
│                                             │
└─────────────────────────────────────────────┘

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

Word Find & Replace

POST /api/WordFindReplace 1 token

Find and replace text across a DOCX document including headers and footers.

Parameters
NameTypeRequiredDescription
file string required Base64-encoded DOCX file
replacements array required Array of {find, replace} or object {find: replace}
Request Example
JSON
{"file": "<base64-docx>", "replacements": [{"find": "{{name}}", "replace": "John Doe"}, {"find": "{{date}}", "replace": "2026-02-06"}]}
Response Example
JSON
{"file": "UEsDBBQAAAA...", "replacementCount": 4}
Code Examples
curl -X POST "https://docbutterfly.com/api/WordFindReplace" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"file": "<base64-docx>", "replacements": [{"find": "{{name}}", "replace": "John Doe"}, {"find": "{{date}}", "replace": "2026-02-06"}]}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""file"": ""<base64-docx>"", ""replacements"": [{""find"": ""{{name}}"", ""replace"": ""John Doe""}, {""find"": ""{{date}}"", ""replace"": ""2026-02-06""}]}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

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

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

url = "https://docbutterfly.com/api/WordFindReplace"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"file": "<base64-docx>", "replacements": [{"find": "{{name}}", "replace": "John Doe"}, {"find": "{{date}}", "replace": "2026-02-06"}]}')

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/WordFindReplace
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "file": "\u003Cbase64-docx\u003E",
│      "replacements": [
│        {
│          "find": "{{name}}",
│          "replace": "John Doe"
│        },
│        {
│          "find": "{{date}}",
│          "replace": "2026-02-06"
│        }
│      ]
│    }
│                                             │
└─────────────────────────────────────────────┘

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

Word Set Metadata

POST /api/WordSetMetadata 1 token

Set document properties and metadata on a DOCX file.

Parameters
NameTypeRequiredDescription
file string required Base64-encoded DOCX file
metadata object required {title, subject, creator, keywords, description, category}
Request Example
JSON
{"file": "<base64-docx>", "metadata": {"title": "Updated Report", "creator": "DocFlow API"}}
Response Example
JSON
{"file": "UEsDBBQAAAA..."}
Code Examples
curl -X POST "https://docbutterfly.com/api/WordSetMetadata" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"file": "<base64-docx>", "metadata": {"title": "Updated Report", "creator": "DocFlow API"}}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

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

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

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

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

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/WordSetMetadata
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "file": "\u003Cbase64-docx\u003E",
│      "metadata": {
│        "title": "Updated Report",
│        "creator": "DocFlow API"
│      }
│    }
│                                             │
└─────────────────────────────────────────────┘

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

Word Split Document

POST /api/WordSplitDocument 1 token

Split a DOCX at section breaks or page breaks into separate files.

Parameters
NameTypeRequiredDescription
file string required Base64-encoded DOCX file
splitBy string optional section or pagebreak (default: section)
Request Example
JSON
{"file": "<base64-docx>", "splitBy": "section"}
Response Example
JSON
{"documents": [{"index": 0, "file": "UEsDBBQ..."}], "count": 3}
Code Examples
curl -X POST "https://docbutterfly.com/api/WordSplitDocument" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"file": "<base64-docx>", "splitBy": "section"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

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

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

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

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

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/WordSplitDocument
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "file": "\u003Cbase64-docx\u003E",
│      "splitBy": "section"
│    }
│                                             │
└─────────────────────────────────────────────┘

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

Markdown to Word

POST /api/ConvertMarkdownToDocx 1 token

Convert Markdown text to a DOCX document. Supports three engines: mohtasham (default, best for business docs with TOC/page breaks), remark (best for code with syntax highlighting), vace (best for technical docs with math/footnotes).

Parameters
NameTypeRequiredDescription
markdown string required Raw Markdown text
engine string optional mohtasham (default), remark, or vace (default: mohtasham)
options object optional Engine-specific options (styling, theme, metadata)
Request Example
JSON
{"markdown": "# Hello World\n\nThis is **bold** and *italic* text.\n\n- Item 1\n- Item 2\n\n| Col A | Col B |\n|-------|-------|\n| 1 | 2 |", "engine": "mohtasham"}
Response Example
JSON
{"file": "UEsDBBQAAAA...", "engine": "mohtasham"}
Code Examples
curl -X POST "https://docbutterfly.com/api/ConvertMarkdownToDocx" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"markdown": "# Hello World\n\nThis is **bold** and *italic* text.\n\n- Item 1\n- Item 2\n\n| Col A | Col B |\n|-------|-------|\n| 1 | 2 |", "engine": "mohtasham"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""markdown"": ""# Hello World\n\nThis is **bold** and *italic* text.\n\n- Item 1\n- Item 2\n\n| Col A | Col B |\n|-------|-------|\n| 1 | 2 |"", ""engine"": ""mohtasham""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

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

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

url = "https://docbutterfly.com/api/ConvertMarkdownToDocx"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"markdown": "# Hello World\n\nThis is **bold** and *italic* text.\n\n- Item 1\n- Item 2\n\n| Col A | Col B |\n|-------|-------|\n| 1 | 2 |", "engine": "mohtasham"}')

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/ConvertMarkdownToDocx
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "markdown": "# Hello World\n\nThis is **bold** and *italic* text.\n\n- Item 1\n- Item 2\n\n| Col A | Col B |\n|-------|-------|\n| 1 | 2 |",
│      "engine": "mohtasham"
│    }
│                                             │
└─────────────────────────────────────────────┘

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