Email & Web

Send emails, parse EML files, and capture web pages

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


Send Email

POST /api/SendEmail 1 token

Send HTML email via Microsoft Graph API.

Requires GRAPH_TENANT_ID, GRAPH_CLIENT_ID, GRAPH_CLIENT_SECRET, GRAPH_SENDER_EMAIL.
Parameters
NameTypeRequiredDescription
to array required Recipient(s)
subject string required Subject line
body string required HTML body
cc array optional CC recipients
bcc array optional BCC recipients
attachments array optional Array of {name, contentType, content}
importance string optional normal, high, low
Request Example
JSON
{"to": ["recipient@example.com"], "subject": "Test from DocFlow", "body": "<h1>Hello</h1><p>Sent via DocFlow API.</p>"}
Response Example
JSON
{"sent": true, "messageId": "AAMkADQ..."}
Code Examples
curl -X POST "https://docbutterfly.com/api/SendEmail" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"to": ["recipient@example.com"], "subject": "Test from DocFlow", "body": "<h1>Hello</h1><p>Sent via DocFlow API.</p>"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""to"": [""recipient@example.com""], ""subject"": ""Test from DocFlow"", ""body"": ""<h1>Hello</h1><p>Sent via DocFlow API.</p>""}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

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

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

url = "https://docbutterfly.com/api/SendEmail"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"to": ["recipient@example.com"], "subject": "Test from DocFlow", "body": "<h1>Hello</h1><p>Sent via DocFlow API.</p>"}')

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

data = response.json()
print(json.dumps(data, indent=2))
┌─────────────────────────────────────────────┐
│  Power Automate - HTTP Action               │
├─────────────────────────────────────────────┤
│                                             │
│  Method:  POST                              │
│  URI:     https://docbutterfly.com/api/SendEmail
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "to": [
│        "recipient@example.com"
│      ],
│      "subject": "Test from DocFlow",
│      "body": "\u003Ch1\u003EHello\u003C/h1\u003E\u003Cp\u003ESent via DocFlow API.\u003C/p\u003E"
│    }
│                                             │
└─────────────────────────────────────────────┘

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

Parse Email

POST /api/ParseEmail 1 token

Parse EML/MIME email metadata.

Parameters
NameTypeRequiredDescription
email string required Base64 EML or raw MIME
Request Example
JSON
{"email": "<base64-eml>"}
Response Example
JSON
{"from": "sender@test.com", "to": ["recipient@test.com"], "subject": "Test", "hasAttachments": true}
Code Examples
curl -X POST "https://docbutterfly.com/api/ParseEmail" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"email": "<base64-eml>"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

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

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

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

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

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/ParseEmail
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "email": "\u003Cbase64-eml\u003E"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ParseEmail"
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

Extract Email Attachments

POST /api/ExtractEmailAttachments 1 token

Extract attachments from EML file.

Parameters
NameTypeRequiredDescription
email string required Base64 EML or raw MIME
Request Example
JSON
{"email": "<base64-eml>"}
Response Example
JSON
{"attachments": [{"name": "report.pdf", "contentType": "application/pdf", "size": 12345}]}
Code Examples
curl -X POST "https://docbutterfly.com/api/ExtractEmailAttachments" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"email": "<base64-eml>"}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

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

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

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

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

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/ExtractEmailAttachments
│                                             │
│  Headers:                                   │
│    X-API-Key:    df_your_api_key_here       │
│    Content-Type: application/json           │
│                                             │
│  Body:                                      │
│    {
│      "email": "\u003Cbase64-eml\u003E"
│    }
│                                             │
└─────────────────────────────────────────────┘

Steps:
1. Add an HTTP action to your flow
2. Set Method to "POST"
3. Set URI to "https://docbutterfly.com/api/ExtractEmailAttachments"
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

Capture Web Page

POST /api/CaptureWebPage 2 tokens

Capture a URL as PDF or screenshot.

Parameters
NameTypeRequiredDescription
url string required URL to capture
output string optional pdf or screenshot (default: pdf)
options.captureMode string optional screen (full visual fidelity), print (traditional), fast (minimal wait) (default: screen)
options.format string optional A4, Letter
options.fullPage boolean optional Full page capture
options.viewport object optional {width, height} in pixels
options.timeout number optional Navigation timeout in ms (max 60000) (default: 30000)
returnBase64 boolean optional Return base64 (default: true)
Request Example
JSON
{"url": "https://example.com", "output": "pdf", "options": {"format": "A4"}, "returnBase64": true}
Code Examples
curl -X POST "https://docbutterfly.com/api/CaptureWebPage" \
  -H "X-API-Key: df_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "output": "pdf", "options": {"format": "A4"}, "returnBase64": true}'
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "df_your_api_key_here");

var json = @"{""url"": ""https://example.com"", ""output"": ""pdf"", ""options"": {""format"": ""A4""}, ""returnBase64"": true}";
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://docbutterfly.com/api/CaptureWebPage", 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/CaptureWebPage"
headers = {
    "X-API-Key": "df_your_api_key_here",
    "Content-Type": "application/json"
}
payload = json.loads('{"url": "https://example.com", "output": "pdf", "options": {"format": "A4"}, "returnBase64": true}')

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

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

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

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