# Get E-Invoice PDF

Fetch the e-invoice PDF using the invoice identifiers associated with the invoice data previously transmitted to Clear

### Request Method

GET

### Request URL

```
{{HOST}}/einvoice/v1/documents/print
```

### Request Headers

| Parameter             | Data Type | Field Validations                              | Description                                                                                                  |
| --------------------- | --------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| x-cleartax-auth-token | String    | Cannot be empty                                | <p>Mandatory.</p><p>User auth token.</p>                                                                     |
| x-clear-vat           | String    | Cannot be empty                                | <p>Mandatory.</p><p>VAT of the entity</p>                                                                    |
| x-clear-branch        | String    | Should be a valid branch from the user account | <p>Optional.</p><p>Branch name (store name) added in the user account which maps to a TIN of the entity.</p> |
| x-clear-country-code  | String    | Cannot be empty                                | <p>Mandatory.</p><p>Country Code.</p>                                                                        |
| x-request-id          | UUID      | Should be unique for every request             | <p>Optional.</p><p>Unique request ID.</p>                                                                    |

### Request Path Params

There are no path params for this API.

### Request Query Params&#x20;

| Parameter           | Data Type | Field Validations                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Description                                                                                                                                      |
| ------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| document-id         | String    | NA                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | <p>Conditional. </p><p></p><p>Required if these fields are not provided- document-number,  document-date, document-type, taxpayer-identifier</p> |
| template-id         | String    | NA                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | <p>Optional.</p><p></p><p>Default is “2” (Standard Invoice Template).</p><p>Contact your CSM for Custom Print Templates. </p>                    |
| einvoice-type       | ENUM      | SALES, PURCHASE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | <p>Optional.</p><p></p><p>Default: SALES, if key not passed. </p>                                                                                |
| document-number     | String    | NA                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | <p>Conditional. </p><p></p><p>Document Number of Invoice.</p><p>Required if document-id is not provided. </p>                                    |
| document-date       | String    | yyyy-mm-dd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | <p>Conditional. </p><p></p><p>Document Date of Invoice.</p><p>Required if document-id is not provided. </p>                                      |
| document-type       | ENUM      | <p>REQUEST\_FOR\_PAYMENT</p><p>DEBIT\_NOTE\_GOODS\_OR\_SERVICES</p><p>METERED\_SERVICES\_INVOICE</p><p>DEBIT\_NOTE\_FINANCIAL\_ADJUSTMENTS</p><p>TAX\_NOTIFICATION</p><p>FINAL\_PAYMENT\_REQUEST</p><p>PAYMENT\_REQUEST\_COMPLETED\_UNITS</p><p>COMMERCIAL\_INVOICE\_PACKING\_LIST</p><p>COMMERCIAL\_INVOICE</p><p>COMMISSION\_NOTE</p><p>DEBIT\_NOTE</p><p>PREPAYMENT\_INVOICE</p><p>TAX\_INVOICE</p><p>FACTORED\_INVOICE</p><p>CONSIGNMENT\_INVOICE</p><p>FORWARDERS\_INVOICE\_DISCREPANCY</p><p>INSURERS\_INVOICE</p><p>FORWARDERS\_INVOICE</p><p>FREIGHT\_INVOICE</p><p>CLAIM\_NOTIFICATION</p><p>CONSULAR\_INVOICE</p><p>PARTIAL\_CONSTRUCTION\_INVOICE</p><p>PARTIAL\_FINAL\_CONSTRUCTION\_INVOICE</p><p>FINAL\_CONSTRUCTION\_INVOICE</p><p>CREDIT\_NOTE\_GOODS\_OR\_SERVICES</p><p>CREDIT\_NOTE\_FINANCIAL\_ADJUSTMENTS</p><p>CREDIT\_NOTE</p><p>FACTORED\_CREDIT\_NOTE</p><p>FORWARDERS\_CREDIT\_NOTE</p> | <p>Conditional.</p><p></p><p>Document Type of Invoice.</p><p>Required if document-id is not provided. </p>                                       |
| taxpayer-identifier | String    | NA                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | <p>Conditional.</p><p></p><p>Issuer VAT.</p><p>Required if document-id is not provided. </p>                                                     |

### Request Body <a href="#request-body" id="request-body"></a>

There is no request body for this API.

### Response Status Codes

| HTTP Status Code | Description                                        |
| ---------------- | -------------------------------------------------- |
| 200              | For successfully printed                           |
| 400              | For any cleartax validation error                  |
| 401              | If the user is not authenticated for the operation |
| 403              | If the user is not authorized for the operation    |
| 404              | If data is not present                             |
| 5XX              | Unhandled exception                                |

### Response Schema

The response will be a PDF file for a successful scenario. In case of an error, the error response will be an array of error details objects.

### Sample Request & Response

#### **Request**

There is no request body for this API.

#### Response (Success)

HTTP Status Code: 200 OK

PDF File containing Invoice Data.&#x20;

#### Response (Error)

HTTP Status Code 404

```json
{
    "ErrorDetails": [
        {
            "ErrorCode": "EINV-DOC-NF-001",
            "ErrorMessage": "You don't have any data present for the selected Document Details",
            "ErrorSource": "CLEARTAX"
        }
    ]
}
```

### API Validations

1. The Document Id should be valid and the invoice data for this document must be present in Clear.

### API Constraints

1. This API needs to be authenticated with a valid user authentication token. If the auth token is not present or is invalid, the API will return HTTP Status Code 401.
2. If the auth token is valid, but the user does not have the authorization to print E-Invoice, then the API will return HTTP Status Code 403.&#x20;
3. If data is not present in the cleartax then the API will return HTTP Status Code 404.&#x20;
