> **Source:** https://knowledge.leegality.com/document-execution/api/quick-start > **Site:** Leegality Knowledge Base — https://knowledge.leegality.com > **About:** Leegality is a document execution platform covering eSigning, stamps, NeSL, workflows, and REST API integration. > **Navigation:** Every article on this site has a plain-text version at `.txt` (this format). To get an index of all articles with their `.txt` links, read: https://knowledge.leegality.com/llms.txt > **AI Guide:** For instructions on how to navigate this knowledge base as an AI agent, read: https://knowledge.leegality.com/ai-readable.txt --- # Quick Start Get up and running with the Leegality API in four steps. ### 1. Create a Workflow Workflows define your document sending configuration — signers, signature types, signing order, and notifications. Create one in the Leegality dashboard before making your first API call. [Learn how to create a workflow →](https://knowledge.leegality.com/document-execution/workflows/create-workflow) ### 2. Download Request Payload Once your workflow is ready, download its API payload from the dashboard — this gives you the exact JSON structure to use in your API request, including the `profileId` and all workflow-specific fields. [Learn how to download the request payload →](https://knowledge.leegality.com/document-execution/workflows/run-workflow?type=via-api) ### 3. Send a Document for eSigning Use the Create eSigning Request API to send a document programmatically. The request body includes your workflow ID (`profileId`), the document as a Base64-encoded PDF, and the invitee details. [See the full API reference →](https://knowledge.leegality.com/document-execution/api/create-an-e-signing-request) ### 4. Track Document Progress After sending a document, you need to know what's happening with it — whether an invitee has signed, who's still pending, and where to find the final signed document. Leegality gives you two mechanisms for this, and most integrations use both: **[Webhooks](https://knowledge.leegality.com/document-execution/api/webhooks/webhook-configuration)** for real-time event notifications, and the **[Document Details API](https://knowledge.leegality.com/document-execution/api/check-document-details)** for the full document state on demand. #### Webhooks Webhooks are HTTP POST requests Leegality sends to a URL you configure on each invitee in the workflow. The moment an invitee completes a signing action — signs, approves, rejects, or fails certificate verification — Leegality fires a webhook to the corresponding URL. Each payload tells you: - Which document the event belongs to (`documentId`) - What happened (`webhookType`: `"Success"` or `"Error"`) - Whether the overall document is still `"Sent"` or now `"Completed"` (`documentStatus`) - The invitee's name, email, action taken, and signing URL (`request`) - A `mac` field — an HMAC-SHA1 signature using your Private Salt — to verify the request came from Leegality Webhooks cover six event types across success and error flows. See [Webhook Event Types](https://knowledge.leegality.com/document-execution/api/webhooks/webhook-event-types) for the full list, and [Verify Webhook Request](https://knowledge.leegality.com/document-execution/api/webhooks/verify-webhook-request) for how to validate the `mac` field. > **Warning** > > Always verify the `mac` field before processing a webhook payload. This confirms the request genuinely came from Leegality. **What webhooks do not include:** The webhook payload does not contain the signed document or the audit trail. Once you receive a webhook confirming document completion, use the [Check Document Details API](#check-document-details-api) to retrieve those. For endpoint requirements, configuration steps, and retry timing, see [Webhook Introduction](https://knowledge.leegality.com/document-execution/api/webhooks/webhook-configuration). #### Check Document Details API The [Check Document Details API](https://knowledge.leegality.com/document-execution/api/check-document-details) returns the full state of a document in a single GET request. This is a much richer data source than any individual webhook payload — not a fallback, but a complementary tool that serves different needs. A single call can return: - **Signed file and audit trail** — CDN URLs for the completed PDF and the audit trail (expires in 15 seconds — download server-side immediately) - **Every invitee's status** — name, email, signing timestamp, current invitation status, and rejection messages where applicable - **Certificate and verification data** — the signer's certificate details, verification configuration, and match results (name, face match, liveliness) - **Document metadata** — workflow name and type, template details, folder, sender, account/organization info - **Stamp paper details** — group name, number, stamp series, and associated document IDs - **NeSL transaction data** — for documents with NeSL-type signers The response is opt-in by field group — you pass boolean query parameters (`file=true`, `auditTrail=true`, `invitations_certificateData=true`, etc.) to request only the data you need. Fields you don't request are omitted entirely. Send a `GET` request to `/v3.3/document/details` with your `documentId` and `X-Auth-Token` header. See the [Check Document Details API reference](https://knowledge.leegality.com/document-execution/api/check-document-details) for the full parameter list and response schema. #### How They Work Together A typical integration uses both: 1. **Webhooks trigger your business logic** — when Leegality fires a `"Signer Signs Document"` webhook, your server records the event and can take immediate action (send a confirmation email, update a database, unlock a next step) 2. **Check Document Details provides the complete picture** — once the document is complete, call the API with `file=true` and `auditTrail=true` to fetch the signed PDF and audit trail for storage or downstream processing 3. **Check Document Details as recovery** — if a webhook is missed or your endpoint was temporarily down, the API gives you the full current state of the document at any time