> **Source:** https://knowledge.leegality.com/sign-station/api/sign > **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 --- # POST /api/v1/documents/sign — Sign a new document Sign a new document with metadata including name, department, and file **Authentication:** `X-Auth-Token` header required on every request. ## Request URL ``` POST https://app1.leegality.com/api/api/v1/documents/sign ``` **Environments:** - Production: `https://app1.leegality.com/api/api/v1/documents/sign` - Sandbox: `https://sandbox.leegality.com/api/api/v1/documents/sign` --- ## Request Body **Content-Type:** `application/json` Document sign data with file upload | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `name` | string | Yes | Name of the document to be signed | `TestDocument.pdf` | | `file` | string | Yes | Document file to be signed | `null` | | `departmentId` | string | Yes | Department ID for the document | `18b45e41-5d8b-4417-bb83-1d769187aef9` | | `certificateId` | string | Yes | Certificate ID to be used for signing the document | `46d4e120-ed03-47cc-98c6-529bff3bbabc` | | `signatureCoordinates` | array\ | No | See **SignatureCoordinateDTO** below. | — | | `signerName` | string | No | Name of the signer to be displayed on the document | `Test Signer` | | `location` | string | No | Location to be displayed on the document | `Bangalore, India` | | `reason` | string | No | Reason for signing to be displayed on the document | `Testing signing via API` | #### SignatureCoordinateDTO | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `xcoordinate` | number | Yes | X coordinate for the signature placement on the page | `10` | | `ycoordinate` | number | Yes | Y coordinate for the signature placement on the page | `20` | | `pageNumber` | integer | Yes | Page number where the signature should be placed | `1` | | `width` | number | No | Width of the signature image | `200` | | `height` | number | No | Height of the signature image | `100` | ### Sample Request ```json { "name": "TestDocument.pdf", "file": null, "departmentId": "18b45e41-5d8b-4417-bb83-1d769187aef9", "certificateId": "46d4e120-ed03-47cc-98c6-529bff3bbabc", "signatureCoordinates": [ { "xcoordinate": 10, "ycoordinate": 20, "pageNumber": 1, "width": 200, "height": 100 } ], "signerName": "Test Signer", "location": "Bangalore, India", "reason": "Testing signing via API" } ``` --- ## Responses ### 200 — OK | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `code` | string | No | Response code indicating success or failure | `LE_SS_301` | | `message` | string | No | Response message providing additional information | `Document signed successfully.` | | `data` | DocumentVO | No | See **DocumentVO** below. | — | #### DocumentVO | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `id` | string | No | Document unique identifier | `5f8d0c2e-3a4b-4c6e-9f8e-2d3c4b5a6e7f` | | `name` | string | No | Name of the document | `TestDocument.pdf` | | `uploadedBy` | string | No | User ID of the person who uploaded the document | — | | `uploadedByName` | string | No | Name of the person who uploaded the document | `Test Signer` | | `department` | DepartmentVO | No | See **DepartmentVO** below. | — | | `status` | string | No | Current status of the document Allowed: `SUBMITTED`, `SIGNED`, `FAILED`. | — | | `signedAt` | string | No | The date and time when the document was signed | — | | `location` | string | No | Location where the document was signed | `Bangalore, India` | | `signerName` | string | No | Name of the signer | `Test Signer` | | `reason` | string | No | Reason for signing the document | `Testing signing via API` | | `createdAt` | string | No | The date and time when the document was created | — | | `enabled` | boolean | No | Indicates whether the document is enabled or disabled | — | | `certificate` | CertificateVO | No | See **CertificateVO** below. | — | ##### DepartmentVO | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `id` | string | No | Department unique identifier | `3fa85f64-5717-4562-b3fc-2c963f66afa6` | | `name` | string | No | The department's name (e.g., "Human Resources"). | `Human Resources` | | `enabled` | boolean | No | Indicates whether the department is active or inactive. | `true` | | `createdAt` | string | No | The date and time when the department was created. | `2025-12-15T10:20:30Z` | | `totalUsers` | integer | No | Total number of users in the department. | `25` | ##### CertificateVO | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `id` | string | No | Certificate unique identifier | `46d4e120-ed03-47cc-98c6-529bff3bbabc` | | `name` | string | No | Certificate name | `TestCertificate.leegality.com` | | `certificateType` | string | No | Type of the certificate Allowed: `PKCS12_PFX`, `PKCS12_HSM`, `PKCS11`. | — | | `expiry` | string | No | Certificate expiry date | — | | `createdAt` | string | No | The date and time when the certificate was created | — | | `departmentId` | string | No | Associated department ID | `18b45e41-5d8b-4417-bb83-1d769187aef9` | | `departmentName` | string | No | Associated department name | `HR` | ### 401 — Unauthorized - Invalid or expired token | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `code` | string | No | Top-level error code | `LE_ERR_SS_401` | | `errors` | array\ | No | List of error details See **ErrorDetail401Unauthorized** below. | — | #### ErrorDetail401Unauthorized | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `message` | string | No | Detailed error message | `Invalid or expired token` | | `path` | string | No | API path that generated the error | `/api/v1/*` | | `code` | string | No | Specific error code | `LE_ERR_SS_303` | ### 500 — Internal server error | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `code` | string | No | Top-level error code | `LE_ERR_SS_500` | | `errors` | array\ | No | List of error details See **ErrorDetailToken500VO** below. | — | #### ErrorDetailToken500VO | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `message` | string | No | Detailed error message | `Internal Server Error` | | `path` | string | No | API path that generated the error | `null` | | `code` | string | No | Specific error code | `null` | ### Sample Response (200) ```json { "code": "LE_SS_301", "message": "Document signed successfully.", "data": { "id": "5f8d0c2e-3a4b-4c6e-9f8e-2d3c4b5a6e7f", "name": "TestDocument.pdf", "uploadedBy": "string", "uploadedByName": "Test Signer", "department": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "Human Resources", "enabled": true, "createdAt": "2025-12-15T10:20:30Z", "totalUsers": 25 }, "status": "SUBMITTED", "signedAt": "string", "location": "Bangalore, India", "signerName": "Test Signer", "reason": "Testing signing via API", "createdAt": "string", "enabled": false, "certificate": { "id": "46d4e120-ed03-47cc-98c6-529bff3bbabc", "name": "TestCertificate.leegality.com", "certificateType": "PKCS12_PFX", "expiry": "string", "createdAt": "string", "departmentId": "18b45e41-5d8b-4417-bb83-1d769187aef9", "departmentName": "HR" } } } ```