Tutorials

Send an Invoice via Secure Delivery

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

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: REFRACT Packs (Receivables), REFRACT Delivery


What You'll Need

  • A REFRACT PDF licence with the vaultDelivery feature gate enabled
  • The invoice-standard template ID from the Receivables REFRACT Pack (or your own invoice template)
  • A customer email address
  • The Lifecycle.Reader role on your account if you call as a signed-in user, or the Render.Access application permission on your app if you call with client credentials. Listing delivery sessions needs Lifecycle.Reader either way.

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 REFRACT Lifecycle 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": "generated-documents/invoice/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": "generated-documents/invoice/2026/05/inv-2026-001.pdf",
  "mode": "secure-email",
  "recipients": [
    {
      "email": "accounts@contoso.com",
      "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...",
      "recipient": "accounts@contoso.com",
      "portalUrl": "https://portal.refractplatform.com/d/<linkReference>"
    }
  ],
  "expiresAt": "2026-06-06T12:00:00.000Z",
  "emailsSent": 1
}

mode is secure-email only

secure-email is the only working delivery mode. A sharePointTarget field is accepted on the request and stored, but nothing reads it back to write the document into SharePoint - don't build a SharePoint write-back flow on it.


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 sent to opened once the recipient accesses the document - there is no separate downloaded state. Session creation and each access are recorded in the audit trail for the document and are visible in the REFRACT Lifecycle workspace.


REFRACT Delivery Reference

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

On this page