Batch Document Dispatch
Render multiple documents from a single payload, get an intake receipt, route through an approver, and deliver each PDF to its recipient via VaultDelivery.
This tutorial covers the full VaultDispatch batch flow: submitting a batch payload, reviewing the intake receipt, approving, and tracking delivery per recipient.
Products used: VaultDispatch + VaultDelivery
Feature gates required: vaultDispatch (and optionally vaultDelivery for per-record email delivery)
How Batch Dispatch Works
Batch dispatch is triggered via the standard POST /api/render endpoint with dataSource as an array of records and features.vaultDispatch: true. There is no separate batch endpoint.
The Dispatcher validates the records, generates a batch intake receipt PDF, and returns it as the response body (HTTP 202). The batch then enters the approval flow (if requireApproval: true) before the Processor renders and delivers each document independently.
Step 1: Submit the Batch
Submit all records in a single render request. Each record in dataSource is an independent document payload sharing the same template.
POST /api/render
Authorization: Bearer <Entra ID JWT>
Content-Type: application/json{
"templatePath": "templates/account-statement.vpdf",
"options": {
"correlationId": "batch-stmt-may-2026",
"documentId": "BATCH-STMT-MAY-2026",
"generatedBy": "[email protected]",
"sourceSystem": "D365_FO",
"documentIdTemplate": "STMT-{{accountNumber}}"
},
"dataSource": [
{
"accountNumber": "ACC-001",
"accountName": "Contoso Ltd",
"recipientEmail": "[email protected]",
"recipientName": "Customer One",
"statementPeriod": "May 2026",
"closingBalance": 850.00
},
{
"accountNumber": "ACC-002",
"accountName": "Fabrikam Inc",
"recipientEmail": "[email protected]",
"recipientName": "Customer Two",
"statementPeriod": "May 2026",
"closingBalance": 2100.00
}
],
"templateSettings": {
"distribution": {
"mode": "individual",
"requireApproval": true,
"fileNameTemplate": "Statement_{{accountNumber}}_{BATCHID_1}",
"approversEmail": "[email protected]",
"deliveryConfig": {
"mode": "secure-email",
"expiresInHours": 168
}
}
},
"features": {
"vaultDispatch": true
}
}Response 202 Accepted:
The response body is the batch intake receipt PDF. Extract the batch identifiers from the response headers:
| Header | Value |
|---|---|
X-VaultPDF-BatchId | UUID — use this for all /api/dispatch/batch/* calls |
X-VaultPDF-CorrelationId | Correlation ID for the batch activity record |
X-VaultPDF-DispatchReadiness | READY, PARTIAL, or INVALID |
File the receipt
The intake receipt PDF summarises the validation result for every record (ready, warning, or invalid). Store it against the originating record in your source system (Dynamics 365, SharePoint) for audit purposes.
INVALID response is 422
When any records have error-severity validation failures, X-VaultPDF-DispatchReadiness is INVALID and the status code is 422. Correct the failing records and resubmit. The receipt details which records failed and why.
Step 2: Approve the Batch
When requireApproval: true, the batch waits in pending-approval state. The configured approver(s) receive an email notification. To approve:
POST /api/dispatch/batch/{batchId}/decide
Authorization: Bearer <Entra ID JWT>
Content-Type: application/json{
"decision": "approve",
"comments": "Validated against AP records — proceed."
}decision accepts approve, reject, or request-changes. On approval, the batch transitions to queued and the Processor begins rendering.
Skip approval for automated pipelines
Set distribution.requireApproval: false in the template settings to auto-approve immediately at intake. The batch goes directly from validation to queued — no /decide call is needed. Use this for fully automated pipelines where the submitting system is authoritative.
Step 3: Track Processing
Poll the batch to track overall progress:
GET /api/dispatch/batch/{batchId}
Authorization: Bearer <Entra ID JWT>The response includes processedCount and errorCount which update as records complete. The batch reaches completed (all succeeded) or partially-failed (some failed) when processing finishes.
To see all individual documents from the batch in VaultLifecycle, open:
https://your-sharepoint-site/SitePages/Home.aspx?batchId={batchId}All child activity items link back to the batch via their ReferenceID column.
Step 4: Track Delivery Per Recipient
Each record that completes processing gets its own correlationId (set by the Processor). Recipients receive a VaultDelivery notification email with a time-limited portal link. Track delivery for any record:
GET /api/delivery-sessions?correlationId={itemCorrelationId}
Authorization: Bearer <Entra ID JWT>Access and download events are recorded per document. Proof of delivery for every statement is available from the VaultLifecycle workspace under the Delivery tab.
Without Approval: Fully Automated Pipeline
For automated pipelines (nightly batch jobs, event-driven triggers), set requireApproval: false to skip the human approval gate entirely:
{
"templateSettings": {
"distribution": {
"mode": "individual",
"requireApproval": false,
"fileNameTemplate": "Remittance_{{invoiceNumber}}_{BATCHID_1}",
"deliveryConfig": {
"mode": "secure-email",
"expiresInHours": 72
}
}
},
"features": { "vaultDispatch": true }
}The batch receipt is still generated and returned (202). The batch immediately enters queued state — no approver action required.
VaultDispatch Reference
Batch lifecycle states, template distribution settings, and full API reference for list, get, decide, and cancel.
Run a Governed Approval Workflow
Use VaultWorkflow to collect structured data from a participant, run schema-driven validation, route to an approver, and seal the final PDF on approval.
Invoice Template
A complete recipe for building a professional invoice PDF - line items, totals, and formatted billing parties - using Section, Layout Group, Table, and Template Settings together.