صادقSadq®
GuidesAdmin
All Guides

Invitation Model Integration Guide

Complete step-by-step guide for integrating with the Sadq Invitation Model API — from authentication through webhook setup to document signing.

Overview

The Invitation Model is Sadq's document-centric signing approach. Your system uploads a PDF, defines the signers and their authentication method, and Sadq handles delivery (email/SMS), identity verification, and returns the signed document — either via webhook or on-demand download.

Key characteristics:

  • Document is uploaded to Sadq servers.
  • Signer identity is verified by Sadq using Nafath, Absher, SMS OTP, Email OTP, or WhatsApp.
  • Signer is redirected to Sadq's secure signing interface (or you can embed the link).
  • Signed PDF is returned to your system — in the webhook payload or via download API.

Workflow Definitions

This section defines the exact sequence of API calls required for each common task.

Workflow 1: Send a document to a signer for signing

Use this workflow when you want to upload a PDF and have one or more people sign it electronically.

OrderStepAPI CallWhat It Does
1AuthenticatePOST /Authentication/Authority/TokenGet a Bearer token to authorize all other calls
2Upload documentPOST /api/v1/envelopes/initiate-base64Upload the PDF — receive documentId and envelopeId
3Invite signer(s)POST /api/v3/invitationsDefine who signs, how they authenticate, where to sign
4Receive resultWebhook callback (or GET /api/v1/envelopes/{id}/status)Get notified when signing is done
5Download signed PDFGET /api/v1/documents/{id}/signedDownload the signed document

Note: Steps 4 and 5 are alternatives. If you registered a webhook, the signed file arrives automatically in the webhook payload — no need to call the download endpoint.

Workflow 2: Send multiple documents in one envelope

Use this workflow when multiple PDFs need to be signed together by the same set of signers.

OrderStepAPI CallWhat It Does
1AuthenticatePOST /Authentication/Authority/TokenGet a Bearer token
2Upload documentsPOST /api/v1/envelopes/bulk/initiate-base64Upload multiple PDFs in one envelope
3Invite signer(s)POST /api/v1/invitations/envelopeSend invitations using envelopeId
4Receive resultWebhook or GET /api/v1/envelopes/{id}/statusTrack completion status
5Download all filesGET /api/v1/envelopes/{id}/files/completedDownload all signed documents

Workflow 3: Send a document using a template

Use this workflow when the document structure, fields, and signer roles are pre-configured as a template in Sadq.

OrderStepAPI CallWhat It Does
1AuthenticatePOST /Authentication/Authority/TokenGet a Bearer token
2Create from templatePOST /api/v1/envelopes/initiate-by-templatePass templateId — document structure applied automatically
3Invite signer(s)POST /api/v3/invitationsSend invitations
4Receive resultWebhook or GET /api/v1/envelopes/{id}/statusTrack completion
5Download signed PDFGET /api/v1/documents/{id}/signedDownload the signed document

Workflow 4: Upload and invite in a single call

Use this shortcut workflow to combine upload and invitation into one API call. Ideal for simple, single-document signing flows.

OrderStepAPI CallWhat It Does
1AuthenticatePOST /Authentication/Authority/TokenGet a Bearer token
2Upload + invitePOST /api/v1/envelopes/bulk/initiate-and-inviteUpload the PDF and send invitations in one call
3Receive resultWebhook or GET /api/v1/envelopes/{id}/statusTrack completion
4Download signed PDFGET /api/v1/documents/{id}/signedDownload the signed document

Workflow 5: Handle a signer who has not signed yet

Use this workflow to follow up with a signer who received the invitation but has not completed signing.

OrderStepAPI CallWhat It Does
1Check statusGET /api/v1/envelopes/{envelopeId}/statusConfirm which signers are still pending
2aSend a reminderPOST /api/v1/invitations/reminders/sendSend a one-time reminder to the pending signer
2bExtend expiryPUT /api/v1/invitations/extendExtend the link with a new availableTo date

Note: Steps 2a and 2b are independent — you can do either or both depending on the situation.

Workflow 6: Cancel a signing request

Use this workflow to stop a signing process that is no longer needed. Cancellation is irreversible.

OrderStepAPI CallWhat It Does
1Check statusGET /api/v1/envelopes/{envelopeId}/statusConfirm the envelope is still active
2CancelPOST /api/v1/envelopes/{envelopeId}/cancelCancel all pending signing links

Workflow 7: Set up webhook notifications

Use this workflow to configure Sadq to automatically notify your server when signing completes or is rejected. Set this up once before sending any signing requests.

OrderStepAPI CallWhat It Does
1AuthenticatePOST /Authentication/Authority/TokenGet a Bearer token
2Register webhookPOST /api/v1/webhooksRegister your server URL — save the returned id
3Use webhookIdPass webhookId in initiate-base64 bodyLink each envelope to your webhook
4Receive callbackYour server receives POST from SadqSadq posts status, signed files, and signer details

Which workflow should I use?

If you want to...Use workflow
Send one PDF to one or more signersWorkflow 1
Send multiple PDFs to sign togetherWorkflow 2
Sign using a pre-built document templateWorkflow 3
Upload and invite in the fewest possible API callsWorkflow 4
Remind or unblock a signer who has not signedWorkflow 5
Cancel a signing request that is no longer neededWorkflow 6
Receive automatic notifications when signing completesWorkflow 7

Environments

EnvironmentBase URLUsage
Sandboxhttps://sandbox-api.sadq-sa.comDevelopment & testing
Productionhttps://api.sadq-sa.comLive environment

API Workflow

Follow these steps in order. Steps marked OPTIONAL can be skipped depending on your implementation.

OPTIONAL — Register a Webhook (One-time setup)

Register your server endpoint once. Sadq will POST the signed file and full signer details to it automatically when signing completes. Skip this if you prefer to poll the status endpoint instead.

MethodEndpointPurpose
POST/api/v1/webhooksRegister a single webhook URL
POST/api/v1/webhooks/bulkRegister multiple webhook URLs at once
GET/api/v1/webhooksList all registered webhooks
PUT/api/v1/webhooksUpdate an existing webhook
GET/api/v1/webhooks/logsView delivery logs
POST/api/v1/webhooks/recallRetry a failed webhook delivery

Request body — POST /api/v1/webhooks

FieldRequiredDescription
webhookUrlYesYour HTTPS endpoint URL that will receive the POST callback
headerTokenNoAuth header value Sadq will include when calling your endpoint
isDefaultNoIf true, this webhook is used for all envelopes by default

Note: The id returned in the response is your webhookId. Save it — you will pass it in the Initiate Envelope call.

STEP 1 — Authenticate — Get Bearer Token

Call this before any other API. Send credentials as application/x-www-form-urlencoded with Basic Auth header. The returned JWT is valid for approximately 27.5 hours (99,200 seconds). Include it as Authorization: Bearer <token> on every subsequent request.

MethodEndpointPurpose
POST/Authentication/Authority/TokenObtain JWT Bearer token

Request fields

FieldRequiredDescription
grant_typeYesAlways set to "integration"
usernameYesYour integration username or email
passwordYesYour integration password
accountIdYesYour Sadq Account ID (GUID format)
accountSecretYesYour account secret key

Response fields

FieldDescription
access_tokenJWT Bearer token — include in all subsequent request headers
expires_inExpiry in seconds (99,200 = ~27.5 hours)
token_typeAlways "Bearer"
useraccessKeyPrivate key — store securely, never expose in logs or client code

STEP 2 — Initiate Envelope — Upload the Document

Upload your PDF document to create an envelope. The response returns a documentId and envelopeId that you will use in the next step.

MethodEndpointUse When
POST/api/v1/envelopes/initiate-base64Sending a single PDF as a Base64 JSON string
POST/api/v1/envelopes/initiateUploading a single PDF as multipart/form-data
POST/api/v1/envelopes/bulk/initiate-base64Uploading multiple PDFs in one envelope
POST/api/v1/envelopes/initiate-by-templateUsing a pre-built template (pass templateId)
POST/api/v1/envelopes/{envelopeId}/filesAdding more files to an existing envelope

Request fields (initiate-base64)

FieldRequiredDescription
files.fileYesBase64-encoded PDF content
files.fileNameYesName of the PDF file
userOnlySignerYesSet true if only the account owner will sign
webhookIdNoID of a registered webhook to notify on completion
workflowIdNoLink to a predefined signing workflow
referenceNumberNoYour own tracking reference (auto-generated if omitted)

Response fields

FieldDescription
data.documentIdUnique ID for the document — use this in Send Invitation
data.envelopeIdUnique ID for the envelope
data.referenceNumberYour reference number
errorCode0 = success, non-zero = error

STEP 3 — Send Invitations — Notify Signers

Define who should sign the document, how they authenticate, and where their signature appears. Sadq sends the signing link by email and/or SMS depending on which contact fields you provide.

Note: At least one of destinationEmail or destinationPhoneNumber is required per signer.

MethodEndpointKey Difference
POST/api/v1/invitationsStandard — by documentId. Sadq sends email/SMS. No link in response.
POST/api/v2/invitationsReturns invitationLink in response. No email/SMS sent.
POST/api/v3/invitationsBest of both — Sadq sends email/SMS AND returns invitationLink.
POST/api/v1/invitations/envelopeBy envelopeId — use when envelope has multiple documents.
POST/api/v1/invitations/bulk/sendSend to multiple documents in a single API call.

Destination object — per signer

FieldRequiredDescription
destinationNameYesFull name of the recipient
destinationEmailOne ofEmail address — signing link sent by email
destinationPhoneNumberOne ofPhone number — signing link sent by SMS
signeOrderYesSigning sequence: 1, 2, 3...
authenticationTypeNoIdentity verification method (see Authentication Types below)
destinationTypeNo1 = Signer, 3 = CC (copy), 4 = Reviewer
consentOnlyNotrue = click-to-agree, no drawn signature required
nationalIdNoRequired when authenticationType is Nafath
availableToNoLink expiry date/time in ISO 8601 format
redirectUrlNoURL to redirect signer to after completing signing
invitationLanguageNo0 = Arabic, 1 = English
allowUserToSignAnyWhereNotrue = signer can place signature freely on the document
dailyNotifyNotrue = send daily email reminders until signed
signatoriesConditionalArray of signature field positions (required if consentOnly is false)

Authentication types

ValueNameDescription
0NoneNo identity verification required
1Nafath KYCFirst-time Nafath verification, then Sadq credentials
2SMS OTPOne-time password sent via SMS
3Email OTPOne-time password sent via email
5Digital SignDigital signature authentication
7Nafath AppPush authentication via the Nafath mobile app (every time)
9Absher OTPOTP via the Absher platform
10WhatsAppOTP sent via WhatsApp

Signatory object — signature field placement

FieldRequiredDescription
typeYesSignature / initial / stamp / signDate / TextField / radio / checkbox
positionXYesX coordinate on the page (PDF units from bottom-left)
positionYYesY coordinate on the page (PDF units from bottom-left)
signatureWidthYesWidth of the signature box in PDF units
signatureHighYesHeight of the signature box in PDF units
pageNumberYesPage number where the signature appears (1-based)
isRequiredNoWhether the field must be filled by the signer
appendDateNoAutomatically append the signing date next to the signature

OPTIONAL — Shortcut: Initiate + Invite in One Call

MethodEndpointPurpose
POST/api/v1/envelopes/bulk/initiate-and-inviteUpload + send invitations in a single API call

Supports SaveAsDraft: true to create the envelope without sending invitations yet.

STEP 4 — Track Signing Status

Option A — Webhook (recommended)

Sadq automatically POSTs to your registered URL when all signers complete or reject. The signed PDF is included as Base64 in the payload — no separate download call needed.

Webhook payload structure

FieldTypeDescription
RequestIdGUIDYour original requestId from the initiate call
StatusInteger1 = Completed, 2 = Rejected
ReferencNumberStringYour reference number
Files[].FileNameStringName of the signed PDF file
Files[].FileStringSigned PDF as Base64 — save directly
Signatory[].StatusStringSIGNED or REJECTED per signer
Signatory[].FullNameStringSigner full name (English)
Signatory[].FullNameArStringSigner full name (Arabic)
Signatory[].NationalIdStringNational ID (populated for Nafath-verified signers)
Signatory[].AuthenticationTypeStringe.g. NAFATH, SADQLOGIN, WITHOUTVALIDATION
Signatory[].GenderStringMALE or FEMALE
Signatory[].RejectReasonStringRejection reason text (null if signed)

Option B — Poll envelope status

MethodEndpointPurpose
GET/api/v1/envelopes/{envelopeId}/statusGet current signing status and per-signer progress

Possible status values: Pending, In Progress, Completed, Rejected, Cancelled, Expired

STEP 5 — Download the Signed Document

If you used a webhook, the signed file is already in the Files[] array of the payload and no download call is needed.

MethodEndpointReturns
GET/api/v1/documents/{id}/signedSigned PDF as binary file download
GET/api/v1/documents/{id}/completed/base64Signed PDF as Base64 JSON — single file
GET/api/v1/envelopes/{envelopeId}/files/completedAll completed files in the envelope as Base64 array

Lifecycle Management

Extend invitation expiry

MethodEndpointUse When
PUT/api/v1/invitations/extendExtending one specific signer's link — pass destinationId
PUT/api/v1/envelopes/extend-invitationsExtending all signers at once — pass envelopeId

Send reminders

MethodEndpointUse When
POST/api/v1/invitations/reminders/sendSending a reminder to a single signer
POST/api/v1/invitations/bulk/reminders/sendSending reminders to multiple signers in one call

Cancel envelope

MethodEndpointNotes
POST/api/v1/envelopes/{envelopeId}/cancelCancels all pending signing links. Irreversible.

Error Codes

Every API response includes an errorCode field. A value of 0 indicates success.

CodeNameDescription
0SuccessOperation completed successfully
1SessionTimeOutThe session has expired — re-authenticate
3UnAuthorizedToken missing or does not have permission
4InvalidUserNameOrPasswordCredentials are incorrect
8ValidationErrorRequest body failed validation — check required fields
9BadRequestMalformed or invalid request
10InvalidFileIdOrRequestIdProvided file ID or request ID does not exist
14UnauthorizedRequestRequest is not authorized for this account
16ContentIsEmptyRequest body content is empty
21SignFailedThe document signing process failed
24DisabledAccountThe account is disabled
28ExceededAccountTransactionQuotaAccount transaction quota exceeded
100GeneralErrorUnexpected server-side error
102PasswordProtectedFileUploaded PDF is password-protected
134InvalidWebhookUrlThe webhook URL is not reachable or invalid

Quick Reference

MethodEndpointStepPurpose
POST/api/v1/webhooksSetupRegister webhook
POST/Authentication/Authority/Token1Get Bearer token
POST/api/v1/envelopes/initiate-base642Upload PDF (Base64)
POST/api/v1/envelopes/initiate2Upload PDF (multipart)
POST/api/v1/envelopes/bulk/initiate-base642Upload multiple PDFs
POST/api/v1/envelopes/initiate-by-template2Upload via template
POST/api/v1/invitations3Invite by documentId (v1)
POST/api/v2/invitations3Invite — returns link only
POST/api/v3/invitations3Invite — returns link + notifies
POST/api/v1/invitations/envelope3Invite by envelopeId
POST/api/v1/invitations/bulk/send3Bulk invite
POST/api/v1/envelopes/bulk/initiate-and-invite2+3Upload + invite in one call
GET/api/v1/envelopes/{envelopeId}/status4Poll signing status
GET/api/v1/documents/{id}/signed5Download signed PDF (binary)
GET/api/v1/documents/{id}/completed/base645Download as Base64
GET/api/v1/envelopes/{id}/files/completed5All envelope files
PUT/api/v1/invitations/extendMgmtExtend single signer expiry
PUT/api/v1/envelopes/extend-invitationsMgmtExtend all signers expiry
POST/api/v1/invitations/reminders/sendMgmtSend reminder
POST/api/v1/invitations/bulk/reminders/sendMgmtBulk send reminders
POST/api/v1/envelopes/{envelopeId}/cancelMgmtCancel envelope