# Get Signed PDF

This API will accept any PDF as input and return the digitally signed pdf.

### **Request Method**&#x20;

POST

### **Request URL**

```
{base_url}/einv/pdf/sign
```

### **Request Headers**

<table><thead><tr><th width="213">Parameter</th><th width="119">Data Type</th><th width="168.33331298828125">Field Validations</th><th width="181">Description</th></tr></thead><tbody><tr><td>x-cleartax-auth-token</td><td>   String</td><td>Cannot be empty</td><td><p><strong>Mandatory.</strong> </p><p>User auth token.</p></td></tr><tr><td>gstin</td><td>String</td><td>Cannot be empty</td><td><p><strong>Mandatory.</strong> </p><p>This is the GSTIN of the business, as registered on ClearTax.</p></td></tr></tbody></table>

### **Request Path Parameters**

There are no path parameters for this API.

### **Request Query Parameters**

&#x20;There are no query parameters for this API.

### **Request Body**

| Parameter                      | Data Type | Field Validations                | Description                                                                                   |
| ------------------------------ | --------- | -------------------------------- | --------------------------------------------------------------------------------------------- |
| file                           | form-data | Content type: application/pdf    | <p><strong>Mandatory.</strong> </p><p>PDF file to be signed.</p>                              |
| x                              | form-data | number                           | Optional. X coordinate on pdf from top left Ex. 100                                           |
| y                              | form-data | number                           | Optional. Y coordinate on pdf from top left Ex. 50                                            |
| pageList                       | form-data | Enum - ALL                       | Optional. Parameter to denote if all signature needs to be placed on all pages. Ex. “ALL”     |
| pageNumberList                 | form-data | String (comma-separated numbers) | Optional. If signature is required on specific pages, this parameter can be used. Ex. “1,3,5” |
| reason                         | form-data | String                           | <p>Optional.                                                                                  |
| <br>Default Value: Invoice</p> |           |                                  |                                                                                               |

### **Response Status Codes**

<table><thead><tr><th width="274.33331298828125">HTTP Status Code</th><th width="429">Description</th><th data-hidden></th></tr></thead><tbody><tr><td>200</td><td>For a successful retrieval</td><td></td></tr><tr><td>401</td><td>If the user is not authenticated for the operation</td><td></td></tr><tr><td>403</td><td>If the user is not authorized for the operation</td><td></td></tr><tr><td>500</td><td>If there are any unhandled exceptions on the Clear side.</td><td></td></tr></tbody></table>

### &#x20;**Response Schema**

&#x20;Returns signed pdf.

### **Sample Request & Response**

#### **Request**

{% file src="<https://2888774781-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZ9fXxeBEm3pJiVldcu%2Fuploads%2FZe5b1cQIsCIVJJsZOEoJ%2FINV_24AABCK1613R1ZH_24AAFCD5862R005_InvTest847.pdf?alt=media&token=2c327284-0b5d-4aaa-bede-4d5855bd9b48>" %}

#### **Response (Success)**&#x20;

&#x20; **HTTP Status Code: 200**

{% file src="<https://2888774781-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZ9fXxeBEm3pJiVldcu%2Fuploads%2Fdo0v5bdOOV9zEOh3ei8m%2FINV_24AABCK1613R1ZH_24AAFCD5862R005_InvTest847.pdf?alt=media&token=a0c5b60d-b6f7-4cb4-b997-a0c9d1dd7db4>" %}

#### **Response (Failure)**&#x20;

**HTTP Status Code: 200**

&#x20; If DSC is not enabled-&#x20;

{% code lineNumbers="true" %}

```json
{
    "ErrorList": [
        {
            "ErrorCode": "300109",
            "ErrorMessage": "Exception occurred while sign PDF.",
            "ErrorSource": "CLEARTAX"
        }
    ]
}
```

{% endcode %}

### **API Validations**

1. The file in the request should be a PDF file.
2. Size limit of the file should be less than 1MB.&#x20;

### **API Constraints**

1. This API needs to be authenticated with a valid user authentication token. If the authentication token is not present or is invalid, the API will return HTTP Status Code 401.
2. If the authentication token is valid, but the user does not have the authorization to download invoice with given search parameters, then the API will return an error "You don't have any data present for the selected Document Details".
3. You should first enable DSC setting on Clear E-Invoice Portal. Also only admin or super admin user can sign DSC.
4. X,Y Signature coordinates depend on the resolution of the PDF. If signature exceeds the actual page size, signature won’t be visible on the output PDF.
5. For landscape pdf we can use x and y as <=500 ,anything above 500 will be set to default value.&#x20;
