Power Automate Integration
Learn how to automate PDF tasks in Microsoft Power Automate using our free API. Create workflows that merge, split, watermark, and protect PDFs automatically.
Prerequisites
Before you begin, make sure you have:
- Power Automate Premium - The HTTP connector requires a premium license
- Basic understanding of Power Automate - Know how to create flows and add actions
- A source for PDF files - SharePoint, OneDrive, Outlook attachments, etc.
✅ No API Key Required
Our API is completely free and doesn't require authentication. Just make HTTP requests directly to our endpoints.
Basic HTTP Action Setup
All API calls use the HTTP action in Power Automate. Here's the general pattern:
HTTP Action Configuration
| Setting | Value |
|---|---|
| Method | POST |
| URI | https://thegoodpdf.com/api/{endpoint} |
| Headers | Content-Type: multipart/form-data (automatic with body) |
| Body | Multipart form data (see examples below) |
⚠️ Important: Binary File Handling
When working with PDF files in Power Automate, use the $content property from file actions, which contains the base64-encoded file content.
Example: Merge PDFs
Combine multiple PDF files into a single document. Perfect for consolidating reports, invoices, or documents.
Parameters: files - Multiple PDF files (minimum 2)
Returns: Merged PDF file
Step-by-Step Instructions
Add Trigger
Choose your trigger (e.g., "When a file is created" in SharePoint)
Get File Contents
Add "Get file content" actions for each PDF you want to merge
Add HTTP Action
Configure the HTTP action with the following body:
{
"$content-type": "multipart/form-data",
"$multipart": [
{
"headers": {
"Content-Disposition": "form-data; name=\"files\"; filename=\"file1.pdf\""
},
"body": @{body('Get_file_content_1')?['$content']}
},
{
"headers": {
"Content-Disposition": "form-data; name=\"files\"; filename=\"file2.pdf\""
},
"body": @{body('Get_file_content_2')?['$content']}
}
]
}
Save the Result
Add "Create file" action to save the merged PDF:
Site Address: Your SharePoint site Folder Path: /Shared Documents/Output File Name: @{concat('merged_', utcNow('yyyyMMdd_HHmmss'), '.pdf')} File Content: @{body('HTTP')}
Example: Add Watermark
Add text watermarks to PDFs for branding or confidentiality marking.
Required: file - PDF file
Optional: text, opacity, fontSize, color, rotation
{
"$content-type": "multipart/form-data",
"$multipart": [
{
"headers": {
"Content-Disposition": "form-data; name=\"file\"; filename=\"document.pdf\""
},
"body": @{body('Get_file_content')?['$content']}
},
{
"headers": {
"Content-Disposition": "form-data; name=\"text\""
},
"body": "CONFIDENTIAL"
},
{
"headers": {
"Content-Disposition": "form-data; name=\"opacity\""
},
"body": "0.3"
},
{
"headers": {
"Content-Disposition": "form-data; name=\"color\""
},
"body": "#ff0000"
}
]
}
Watermark Parameters
| Parameter | Default | Description |
|---|---|---|
text |
"CONFIDENTIAL" | Watermark text to display |
opacity |
0.3 | Transparency (0 to 1) |
fontSize |
50 | Font size in points |
color |
#888888 | Hex color code |
rotation |
-45 | Rotation angle in degrees |
Example: Protect PDF with Password
Add password protection to sensitive documents automatically.
Required: file - PDF file, password - Password to set
{
"$content-type": "multipart/form-data",
"$multipart": [
{
"headers": {
"Content-Disposition": "form-data; name=\"file\"; filename=\"document.pdf\""
},
"body": @{body('Get_file_content')?['$content']}
},
{
"headers": {
"Content-Disposition": "form-data; name=\"password\""
},
"body": "YourSecurePassword123"
}
]
}
💡 Tip: Dynamic Passwords
Use Power Automate variables or Azure Key Vault to manage passwords securely instead of hardcoding them.
Example: Split / Extract Pages
Extract specific pages from a PDF document.
Required: file - PDF file
Optional: pages - Page range (e.g., "1-3,5,7-9")
{
"$content-type": "multipart/form-data",
"$multipart": [
{
"headers": {
"Content-Disposition": "form-data; name=\"file\"; filename=\"document.pdf\""
},
"body": @{body('Get_file_content')?['$content']}
},
{
"headers": {
"Content-Disposition": "form-data; name=\"pages\""
},
"body": "1-3,5"
}
]
}
Page Range Examples
| Input | Result |
|---|---|
1-3 |
Pages 1, 2, and 3 |
1,3,5 |
Pages 1, 3, and 5 |
1-3,7-9 |
Pages 1-3 and 7-9 |
5 |
Page 5 only |
All API Endpoints Reference
Quick reference for all available endpoints you can use in Power Automate:
| Endpoint | Description | Key Parameters |
|---|---|---|
/api/merge |
Combine multiple PDFs | files (multiple) |
/api/split |
Extract pages | file, pages |
/api/protect |
Add password | file, password |
/api/unlock |
Remove password | file, password |
/api/watermark |
Add text watermark | file, text, opacity |
/api/rotate |
Rotate pages | file, angle, pages |
/api/compress |
Reduce file size | file |
/api/page-numbers |
Add page numbers | file, position, format |
/api/delete-pages |
Remove pages | file, pages |
/api/info |
Get PDF metadata | file |
/api/status |
Check API status | None (GET request) |
Troubleshooting
Common Issues
❌ Error: "BadRequest" or "Invalid file"
Cause: The file content isn't being sent correctly.
Solution: Make sure you're using body('Get_file_content')?['$content'] to get the base64 file content, not the raw output.
❌ Error: "Unsupported Media Type"
Cause: Content-Type header is incorrect.
Solution: Use the $content-type and $multipart structure in the body. Power Automate will set the correct headers automatically.
❌ Output file is corrupted
Cause: The response body isn't being saved correctly.
Solution: Use body('HTTP') directly as the file content. Don't try to parse it as JSON.
❌ "Premium connector required"
Cause: The HTTP action requires Power Automate Premium.
Solution: You need a Power Automate Premium license, or use Power Automate per-flow/per-user plans.
Testing Your Flow
- Start with a simple test using the
/api/statusendpoint (GET request, no file needed) - Check that responses return status 200
- Use "Peek code" in Power Automate to verify your JSON structure
- Enable "Secure Outputs" to hide sensitive data in run history
🎉 Need More Help?
Check our full API documentation for detailed endpoint information and code examples in multiple languages.