Tutorials

Send an Invoice via Secure Delivery

Render an invoice from the Receivables VaultPack and deliver it to a customer through a time-limited secure portal link using VaultDelivery.

This tutorial walks through the most common accounts receivable scenario: generate a professional invoice PDF and deliver it to a customer through a secure, audited portal link, without attaching the PDF directly to an email.

Products used: VaultPacks (Receivables), VaultDelivery


What You'll Need

  • A VaultPDF licence with the vaultDelivery feature gate enabled
  • The invoice-standard template ID from the Receivables VaultPack (or your own invoice template)
  • A customer email address

Step 1: Render the Invoice

POST to /api/render with your invoice data. Use a stable, business-meaningful correlationId such as the invoice number — it links the rendered PDF to all downstream events, delivery sessions, and the VaultLifecycle audit trail.

POST /api/render
Authorization: Bearer <Entra ID JWT>
Content-Type: application/json
{
  "templateId": "invoice-standard",
  "correlationId": "inv-2026-001",
  "documentId": "INV-2026-001",
  "customer": {
    "name": "Contoso Ltd",
    "address": "123 Main Street, London, EC1A 1BB"
  },
  "invoiceDate": "2026-05-30",
  "dueDate": "2026-06-13",
  "lineItems": [
    { "description": "Professional Services", "qty": 10, "unitPrice": 150.00 }
  ]
}

The response includes the pdfBlobPath you will need in the next step:

{
  "correlationId": "inv-2026-001",
  "pdfBlobPath": "generatedDocuments/2026/05/inv-2026-001.pdf",
  "status": "success"
}

Step 2: Create a Delivery Session

POST to /api/delivery with the correlationId and pdfBlobPath from the render response. The Dispatcher issues a time-limited access token, stores the session, and sends a notification email to the recipient.

POST /api/delivery
Authorization: Bearer <Entra ID JWT>
Content-Type: application/json
{
  "correlationId": "inv-2026-001",
  "documentId": "INV-2026-001",
  "documentName": "Invoice INV-2026-001.pdf",
  "pdfBlobPath": "generatedDocuments/2026/05/inv-2026-001.pdf",
  "mode": "secure-email",
  "recipients": [
    {
      "email": "[email protected]",
      "name": "Accounts Payable",
      "role": "recipient"
    }
  ],
  "requesterOrg": "Your Company Name",
  "message": "Please find your invoice attached. This link expires in 7 days.",
  "expiresInHours": 168
}

The response returns a deliveryId and portal URL per recipient:

{
  "sessions": [
    {
      "deliveryId": "dlv-xxxx...",
      "recipientEmail": "[email protected]",
      "portalUrl": "https://delivery.vaultpdf.io/portal/dlv-xxxx...",
      "expiresAt": "2026-06-06T12:00:00.000Z",
      "state": "pending"
    }
  ]
}

SharePoint write-back

To write the invoice directly to a SharePoint document library instead of (or alongside) email delivery, set "mode": "sharepoint" or "mode": "both" and include a sharePointTarget object. See the VaultDelivery API Reference for the full field reference.


Step 3: Track Delivery

Query session state at any time using the correlationId:

GET /api/delivery-sessions?correlationId=inv-2026-001
Authorization: Bearer <Entra ID JWT>

The session state progresses from pending through opened to downloaded. Every access event is recorded in the immutable audit log for the document and is visible in the VaultLifecycle workspace.


VaultDelivery Reference

Full API reference for delivery modes, session states, SharePoint write-back, and batch dispatch.

On this page