REFRACT Delivery API Reference
HTTP endpoint reference for creating delivery sessions, querying session state, OTP verification, and revoking access.
All REFRACT Delivery endpoints are hosted on the Dispatcher Azure Function. Initiator routes require a valid Entra ID JWT. Recipient portal routes use a delivery access token issued at session creation, sent by the portal as Authorization: Bearer <token>. A token in the URL (?t=) is refused with 401 LINK_TOKEN_IN_URL. The recipient's link carries a link reference (/d/<linkReference>), not the token: the portal resolves the reference and sends the token to the Dispatcher on the recipient's behalf.
Base URL
All paths are relative to your Dispatcher Function base URL, e.g. https://<your-dispatcher>.azurewebsites.net.
Create Delivery Session
POST /api/deliveryCreates one or more delivery sessions (one per recipient) for a rendered document.
Auth: Entra ID JWT. A signed-in user needs the Lifecycle.Reader role; an app-only token needs only the Render.Access application permission. Without it, 403 with code ROLE_MISSING naming the missing role.
Request body:
{
"correlationId": "rnd-00123",
"documentId": "DOC-456",
"documentName": "Invoice #INV-2026-001.pdf",
"pdfBlobPath": "generated-documents/invoice/2026/05/rnd-00123.pdf",
"mode": "secure-email",
"recipients": [
{
"email": "vendor@contoso.com",
"name": "Vendor Contact",
"role": "recipient"
}
],
"requesterOrg": "Contoso Ltd",
"message": "Please find your document attached. This link expires in 7 days.",
"expiresInHours": 168,
"requireOtp": false
}| Field | Type | Required | Description |
|---|---|---|---|
correlationId | string | Yes | Correlation ID of the rendered PDF being delivered. Used to link delivery events to the document audit trail. |
documentName | string | Yes | Filename shown to the recipient in the delivery portal and notification email. |
pdfBlobPath | string | Yes | Blob Storage path of the PDF to deliver. |
mode | secure-email | Yes | Delivery mode. |
recipients | array | Yes | One or more recipient objects. Max 20 recipients per request. A separate delivery session is created per recipient. |
recipients[].email | string | Yes | Recipient email address. Used for notification and OTP delivery. |
recipients[].name | string | No | Recipient display name used in the notification email. |
recipients[].role | string | No | Role label (e.g. vendor, customer). Recorded in the audit event. |
documentId | string | No | Document identifier for display purposes. Falls back to correlationId if omitted. |
requesterOrg | string | No | Sender organization name displayed in the notification email. |
message | string | No | Custom message body included in the notification email. |
expiresInHours | number | No | Session TTL in hours. Defaults to 168 (7 days). |
requireOtp | boolean | No | When true, recipient must verify a one-time passcode before accessing the document. Default false. |
reminders | object | No | Automatic reminder settings for this delivery: enabled and beforeExpiryDays (1 to 14, default 2). On by default; overrides the template's templateSettings.delivery.reminders field by field. Out-of-range or non-integer values are refused with HTTP 400 and code DELIVERY_REMINDERS_INVALID. See Reminders. |
idempotencyKey | string | No | Optional idempotency key. |
Response 201:
{
"sessions": [
{
"deliveryId": "a3f1c2d4-8e9b-4f0a-b2c3-1d4e5f6a7b8c",
"recipient": "vendor@contoso.com",
"portalUrl": "https://portal.refractplatform.com/d/<linkReference>"
}
],
"expiresAt": "2026-06-16T12:00:00.000Z",
"emailsSent": 1
}| Field | Type | Description |
|---|---|---|
deliveryId | string | UUID identifying the delivery session. Use this to query, revoke, or look up the session. |
recipient | string | Recipient email address (echoed from request). |
portalUrl | string | Full portal URL, in the form /d/<linkReference>. The reference is registered with the portal, which resolves it; the URL carries no token. This URL is emailed to the recipient. Absent on a held session (below). When the portal refuses the registration, nothing is sent and the answer is 502 DELIVERY_LINK_NOT_REGISTERED. |
held | true | Present when the portal could not register the recipient's link just now (unreachable, a timeout, or a 5xx). The session is created and stays pending, and its invitation is held and sent once the link registers. See When a Link Cannot Be Registered Yet. |
emailsHeld | number | How many invitations are held. Present when at least one is. |
Portal URL is on REFRACT Shared Services
The portalUrl points to the eSign/delivery portal (portal.refractplatform.com), hosted on REFRACT Shared Services. The portal redirects the browser to your Dispatcher or SharePoint site, which serves the document directly; the portal never receives it.
SharePoint write-back is not currently functional
A sharePointTarget field is accepted and stored on the session, but nothing reads it back to write the document into SharePoint. Do not rely on delivering to SharePoint through this API; use secure-email and your own SharePoint integration for that need.
Query Delivery Sessions
GET /api/delivery-sessions?correlationId={correlationId}Returns all delivery sessions for a given document correlation ID.
Auth: Entra ID JWT with the Lifecycle.Reader role (the response includes recipient addresses). Without it, 403 with code ROLE_MISSING.
Response 200:
{
"sessions": [
{
"id": "a3f1c2d4-8e9b-4f0a-b2c3-1d4e5f6a7b8c",
"mode": "secure-email",
"recipient": "vendor@contoso.com",
"recipientName": "Vendor Contact",
"recipientRole": "recipient",
"sentAt": "2026-06-09T12:00:00.000Z",
"accessExpires": "2026-06-16T12:00:00.000Z",
"openedAt": "2026-06-10T09:14:22.000Z",
"lastAccessedAt": "2026-06-10T09:15:01.000Z",
"viewCount": 2,
"state": "opened"
}
]
}Each session entry carries id, mode, recipient, recipientName, recipientRole, sentAt, accessExpires, openedAt, lastAccessedAt, viewCount, and state. There is no createdAt, per-item correlationId (it is the query filter, not a field on each session), documentName, or downloadedAt in this response.
Get Delivery Session (Portal)
GET /api/delivery/{deliveryId}Validates the recipient's access token and returns session metadata for the delivery portal UI, including the document name. Called by the portal when the recipient opens their link.
Auth: Delivery access token (Authorization: Bearer <token>, sent by the portal)
Returns 410 Gone if the session is expired or revoked.
Record Access Event
POST /api/delivery/{deliveryId}/accessRecords that the recipient accessed the document. Called by the delivery portal when the recipient opens the document view. The request body, if any, is ignored - the route does not read it, so any eventType or ip field sent has no effect.
Auth: Delivery access token
Sets the session state to opened, records openedAt/lastAccessedAt, and increments viewCount. Writes a DELIVERY_DOCUMENT_ACCESSED audit event carrying the delivery ID and the updated view count.
Response 200: { "ok": true }
Send OTP
POST /api/delivery/{deliveryId}/otp/sendSends a one-time passcode to the recipient's email address. Only valid when requireOtp: true was set at session creation.
Auth: Delivery access token
Returns 400 if OTP is not required for this session or has already been verified.
Response 200: { "ok": true }
Verify OTP
POST /api/delivery/{deliveryId}/otp/verifyVerifies the one-time passcode entered by the recipient.
Auth: Delivery access token
Request body:
{ "otp": "483921" }Response 200:
{ "ok": true, "verified": true }Returns 400 with details if the code is incorrect or expired.
Revoke Delivery Session
POST /api/delivery/{deliveryId}/revokeImmediately revokes a delivery session. Any subsequent recipient access attempt returns 410 Gone. Revoking a session does not write an audit event.
Auth: Entra ID JWT (initiator - must be same tenant as session creator)
Response 200:
{ "deliveryId": "a3f1c2d4-8e9b-4f0a-b2c3-1d4e5f6a7b8c", "state": "revoked" }The Delivery Access Token
The delivery access token is an HMAC-SHA256 value computed from the delivery ID and tenant ID. It is not a JWT and carries no embedded claims or expiry - access is gated entirely by the session's own accessExpires/state in Table Storage, checked on every route above. It travels in the Authorization header between the portal and the Dispatcher, not in the emailed link.
Track Deliveries in REFRACT Lifecycle
All delivery events are visible in the Deliveries tab of the Lifecycle Workspace alongside the full document audit timeline.
REFRACT Delivery
REFRACT Delivery provides secure document dispatch and delivery for REFRACT PDF-generated documents. Send documents to external recipients via time-limited access links, with access auditing and proof of delivery.
REFRACT Notification
REFRACT Notification is the shared notification layer for the REFRACT Platform. It routes email notifications for REFRACT Delivery and REFRACT Workflow through either REFRACT Shared Services ACS or your own Azure Communication Services instance.