Build a Power Automate Flow
Navigation
- Getting Started with Build a Doc
- Purchase a Subscription
- Use the Customer Portal
- Generate an API Key
- Connect a Data Source
- Create a Template
- → Build a Power Automate Flow (You are here)
You’ll achieve: A working Power Automate flow that generates a PDF from your template.
Before You Start
You need:
- A Build a Doc Subscription (Purchase one the Microsoft Marketplace)
- Power Automate access (included with Microsoft 365)
- Build a Doc API key (see Manage API Keys)
- Word template in OneDrive/SharePoint (see Create a Template)
- JSON data prepared (see Connect a Data Source)
How to Create Your Flow
- Go to Power Automate
- Click + Create → Instant cloud flow
- Choose Manually trigger a flow
- Click Create
- Name it: e.g.
Generate Invoice PDF
Success: Your flow is created.
How to Add Your Template
- Click + New step
- Search for OneDrive for Business
- Select Get file content
- Click folder icon
- Select your template (e.g.,
Invoice-Template.docx)
Success: Flow can now access your template.
How to Add Build a Doc Action
- Click + New step
- Search for Build a Doc
- Select Convert Word Document
First time only:
Before setting up the connection, you will need:
- A Build a Doc Subscription. Find out how to purchase a subscription.
- A Build a Doc API key (see Manage API Keys)
Once you have these to hand:
- Enter connection name:
Build a Doc Production - Paste (don’t type) your API key
- Click Create
How to Configure the Action
Fill in these fields:
Document
- Click in the Document field
- Select File Content from the dynamic content picker (from your “Get file content” step)
Data Source - Name
Enter: Invoice
This name must match your template tags (e.g., <<[Invoice.InvoiceNumber]>>)
Data Source - Data
Paste this JSON into the Data field:
[ { "Name": "Invoice", "Data": { "invoice_number": "INV-2023-001", "bill_to": { "name": "John Smith", "customer_id": "12345", "address": "123 Main St, Suite 100", "phone": "0123456789" }, "payment_due_date": "2023-03-16", "sales_person": "Mary Johnson", "payment_terms": "Net 30", "items": [ { "sku": "SKU-001", "description": "Product A", "quantity": 2, "price": 10.0 }, { "sku": "SKU-002", "description": "Product B", "quantity": 1, "price": 20.0 } ] } }]Data Source - Format
Select: JSON
Output Format
Select: PDF (or DOCX if you prefer Word format)
Alternative: Using a Public API as Your Data Source
Instead of hardcoding JSON data, you can fetch live data from public APIs and use it to populate your documents dynamically.
How to Add an HTTP Request
- Before adding the Build a Doc action, click + New step
- Search for HTTP
- Select HTTP (the standard connector)
- Configure the request:
- Method: Select
GET - URI: Paste this URL:
https://api.open-meteo.com/v1/forecast?latitude=41.3888&longitude=2.159&hourly=temperature_2m&forecast_days=1&temporal_resolution=hourly_6
- Method: Select
Success: This will fetch today’s temperature forecast for Barcelona.
Understanding the API Response
The Open-Meteo API returns JSON data in this structure:
[ { "latitude": 41.375, "longitude": 2.125, "generationtime_ms": 0.03826618194580078, "utc_offset_seconds": 0, "timezone": "GMT", "timezone_abbreviation": "GMT", "elevation": 44.0, "hourly_units": { "time": "iso8601", "temperature_2m": "°C" }, "hourly": { "time": [ "2026-02-06T00:00", "2026-02-06T06:00", "2026-02-06T12:00", "2026-02-06T18:00" ], "temperature_2m": [12.5, 11.1, 16.6, 13.6] } }]How to Use API Data in Build a Doc
Now when you configure the Build a Doc action:
- Document: Select your template file content (as before)
- Data Source - Name: Enter
Weather - Data Source - Data:
- Click in the field
- From the dynamic content picker, select Body (from the HTTP action)
- This passes the entire API response as your data source
- Data Source - Format: Select
JSON - Output Format: Select your preferred format (PDF or DOCX)
How to Reference API Data in Your Template
In your Word template, you can now reference the API data using template tags:
Location: <<[Weather.latitude]>>, <<[Weather.longitude]>>Timezone: <<[Weather.timezone]>>
Temperature Readings:<<foreach [reading in Weather.hourly.time]>>- Time: <<[reading]>> - Temperature: <<[Weather.hourly.temperature_2m]>> °C<</foreach>>Success: Your document will now be populated with live weather data from the API.
Why Use Public APIs?
Using public APIs as data sources enables powerful automation scenarios:
- Live reporting: Generate documents with real-time data (weather, stock prices, exchange rates)
- Integration: Combine data from multiple sources (CRM + weather + calendar)
- Reduced manual work: No need to copy-paste data into templates
- Always current: Documents reflect the latest information at generation time
How to Save the Output
- Click + New step
- Search for OneDrive for Business
- Select Create file
- Configure:
- Folder Path: Select destination folder
- File Name:
Invoice.pdf(must match output format) - File Content: Select Document (from Build a Doc action)
Success: PDF will be saved to OneDrive.
How to Test Your Flow
- Click Save
- Click Test
- Select Manually
- Click Test → Run flow → Done
Watch each action:
- ✅ Green checkmark = success
- ❌ Red X = error
Success: Find your generated PDF in OneDrive.
How to Fix Common Errors
| Problem | ✅ Solution |
|---|---|
| ”401 Unauthorised” | Verify API key, check subscription is active |
| Blank fields in PDF | Check JSON keys match template tags exactly |
| ”File Not Found” | Re-select template using folder picker |
| Wrong file extension | Use .pdf for PDF output, .docx for Word |
Quick Checklist
Before running:
- API key configured in connection
- Template accessible from OneDrive/SharePoint
- JSON structure matches template tags
- Data source Name matches template root object
- Output format specified (PDF/DOCX)
- File name has correct extension
What You’ve Achieved
You now have:
- A working Power Automate flow
- Automated PDF generation
- Knowledge of how to troubleshoot errors
Congratulations! You’ve completed the Build a Doc quickstart journey. Your automation flow is now ready to generate documents automatically.