Generate E-Invoice for a Document

This API enables the submits the e-invoicing payload for generation of LHDN compliant e-invoices. This is a bulk API which supports submitting an array of documents in one call to LHDN. This API will also share the document through the PEPPOL network if it's enabled for sharing.

Request Method

POST

Request URL

{{HOST}}/einvoice/v1/documents/generate

Rate Limit : 1000 API requests per minute

Request Headers

ParameterData TypeField ValidationsDescription

x-cleartax-auth-token

String

Cannot be empty

Mandatory. User auth token.

x-clear-tin

String

Cannot be empty

Mandatory. TIN of the entity

x-clear-branch

String

Should be a valid branch from the user account

Optional. Branch name (store name) added in the user account which maps to a TIN of the entity.

x-request-id

UUID

Should be unique for every request

Optional. Unique request ID.

Used for Debugging Support Issues

Content-Type

String

application/json

application/json

Request Path Params

There are no path parameters for this API.

Request Query Params

ParameterData TypeField ValidationsDescription

dry-run

Boolean

true/false

Default: false

Will only run Validations

einvoice-type

ENUM

SALES, PURCHASE, SALES_B2C

Default: SALES

Request Body

ParameterData TypeField ValidationsDescription

Documents

Array

MinListLength: 1

MaxListLength: 10

Mandatory. List of Documents

Version

String

NA

Mandatory. MY_GENERATE_UBL_2_1_V1

Documents Object

ParameterData TypeField ValidationsDescription

DocumentData

String

NA

Mandatory. Base64 of the document data shared below

DocumentFormat

ENUM

JSON, XML

Mandatory. Describes the data received is in the JSON Format or in the XML Format.

UniqueIdentifier

String

NA

Mandatory. Identifier provided by the user to distinctly identify the document at their end. Generally formed with concatenation of TIN, Document Number, Document Type, Fiscal Year fields with _

Example: C948329382_INV-101_INV_2024

CustomFields

Object

NA

Map of Custom fields with key-value pair eg : ( { “Internal Number” : “INV000012”

})

Custom Fields Object

This is a custom object of key-value pairs that can be used to display custom fields in custom output PDF templates or in certain reports.

For example:

{
    "country_of_origin": "IN",
    "total_containers": "3"
}

Sample Request

Request Body

{
    "Documents": [
        {
            "DocumentData": "ewogICAgIkludm9pY2VUeXBlQ29kZSI6IHsKICAgICAgICAiVmFsdWUiOiAiMDEiCiAgICB9LAogICAgIkludm9pY2VQZXJpb2QiOiB7CiAgICAgICAgIlN0YXJ0RGF0ZSI6ICIyMDI0LTA2LTAzIiwKICAgICAgICAiRW5kRGF0ZSI6ICIyMDI0LTA2LTAzIiwKICAgICAgICAiRGVzY3JpcHRpb24iOiAiTW9udGhseSIKICAgIH0sCiAgICAiQmlsbGluZ1JlZmVyZW5jZSI6IFsKICAgICAgICB7CiAgICAgICAgICAgICJBZGRpdGlvbmFsRG9jdW1lbnRSZWZlcmVuY2UiOiB7CiAgICAgICAgICAgICAgICAiSWQiOiAiIgogICAgICAgICAgICB9CiAgICAgICAgfQogICAgXSwKICAgICJJc3N1ZURhdGUiOiAiMjAyNC0wNi0wMyIsCiAgICAiSXNzdWVUaW1lIjogIjE4OjMwOjAwIiwKICAgICJEb2N1bWVudEN1cnJlbmN5Q29kZSI6ICJNWVIiLAogICAgIklkIjogIlRFU1QtU0FMRVMtMDAxIiwKICAgICJBY2NvdW50aW5nQ3VzdG9tZXJQYXJ0eSI6IHsKICAgICAgICAiUGFydHkiOiB7CiAgICAgICAgICAgICJDb250YWN0IjogewogICAgICAgICAgICAgICAgIkVsZWN0cm9uaWNNYWlsIjogImluZm9AZ21haWwuY29tIiwKICAgICAgICAgICAgICAgICJUZWxlcGhvbmUiOiAiNjAzMjIzMDA5MCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIlBhcnR5SWRlbnRpZmljYXRpb24iOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIklkIjogewogICAgICAgICAgICAgICAgICAgICAgICAiU2NoZW1lSUQiOiAiVElOIiwKICAgICAgICAgICAgICAgICAgICAgICAgIlZhbHVlIjogIkM1ODk2MjM0MDQwIgogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIklkIjogewogICAgICAgICAgICAgICAgICAgICAgICAiU2NoZW1lSUQiOiAiQlJOIiwKICAgICAgICAgICAgICAgICAgICAgICAgIlZhbHVlIjogIjE5OTUwMTAxMDY2NiIKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICJJZCI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgIlNjaGVtZUlEIjogIlNTVCIsCiAgICAgICAgICAgICAgICAgICAgICAgICJWYWx1ZSI6ICJOQSIKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJQYXJ0eUxlZ2FsRW50aXR5IjogewogICAgICAgICAgICAgICAgIlJlZ2lzdHJhdGlvbk5hbWUiOiAiRGVmbWFjcm8gU29mdHdhcmUgUHZ0IEx0ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIlBvc3RhbEFkZHJlc3MiOiB7CiAgICAgICAgICAgICAgICAiQWRkcmVzc0xpbmUiOiBbCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAiTGluZSI6ICJMZXZlbCAzMyIKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgIkxpbmUiOiAiSWxoYW0gVG93ZXIiCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICJMaW5lIjogIiA4IEphbGFuIEJpbmphaSIKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgIkNpdHlOYW1lIjogIiA4IEphbGFuIEJpbmphaSIsCiAgICAgICAgICAgICAgICAiQ291bnRyeSI6IHsKICAgICAgICAgICAgICAgICAgICAiSWRlbnRpZmljYXRpb25Db2RlIjogewogICAgICAgICAgICAgICAgICAgICAgICAiQ291bnRyeUNvZGUiOiAiTVlTIgogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAiQ291bnRyeVN1YmVudGl0eUNvZGUiOiAiMTQiLAogICAgICAgICAgICAgICAgIlBvc3RhbFpvbmUiOiAiNTA0NTAiCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9LAogICAgIkFjY291bnRpbmdTdXBwbGllclBhcnR5IjogewogICAgICAgICJQYXJ0eSI6IHsKICAgICAgICAgICAgIkNvbnRhY3QiOiB7CiAgICAgICAgICAgICAgICAiRWxlY3Ryb25pY01haWwiOiAiZ2VuZXJhbEBwbHVzLmNvbS5teSIsCiAgICAgICAgICAgICAgICAiVGVsZXBob25lIjogIjYwMzIyMzAwOTAiCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICJJbmR1c3RyeUNsYXNzaWZpY2F0aW9uQ29kZSI6IHsKICAgICAgICAgICAgICAgICJWYWx1ZSI6ICIwMTExMSIsCiAgICAgICAgICAgICAgICAiTmFtZSI6ICJPdGhlciBzZXJ2aWNlIGFjdGl2aXRpZXMgbi5lLmMuIgogICAgICAgICAgICB9LAogICAgICAgICAgICAiUGFydHlJZGVudGlmaWNhdGlvbiI6IFsKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAiSWQiOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICJTY2hlbWVJRCI6ICJUSU4iLAogICAgICAgICAgICAgICAgICAgICAgICAiVmFsdWUiOiAiQzU4NzQ2NzA4MDgwIgogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIklkIjogewogICAgICAgICAgICAgICAgICAgICAgICAiU2NoZW1lSUQiOiAiQlJOIiwKICAgICAgICAgICAgICAgICAgICAgICAgIlZhbHVlIjogIjIwMjQwMTAyMTEyOCIKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICJJZCI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgIlNjaGVtZUlEIjogIlNTVCIsCiAgICAgICAgICAgICAgICAgICAgICAgICJWYWx1ZSI6ICJOQSIKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICJJZCI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgIlNjaGVtZUlEIjogIlRUWCIsCiAgICAgICAgICAgICAgICAgICAgICAgICJWYWx1ZSI6ICJOQSIKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJQYXJ0eUxlZ2FsRW50aXR5IjogewogICAgICAgICAgICAgICAgIlJlZ2lzdHJhdGlvbk5hbWUiOiAiWFlaIgogICAgICAgICAgICB9LAogICAgICAgICAgICAiUG9zdGFsQWRkcmVzcyI6IHsKICAgICAgICAgICAgICAgICJBZGRyZXNzTGluZSI6IFsKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICJMaW5lIjogIk1lbmFyYSBLb3Jwb3JhdCIKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgIkxpbmUiOiAiUGVyc2FkYSBQTFVTIgogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAiTGluZSI6ICJQZXJzaW1wYW5nYW4gQmVydGluZ2thdCBTdWJhbmcgS00xNSIKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgIkNpdHlOYW1lIjogIkxlYnVocmF5YSBCYXJ1IExlbWJhaCBLbGFuZyIsCiAgICAgICAgICAgICAgICAiQ291bnRyeSI6IHsKICAgICAgICAgICAgICAgICAgICAiSWRlbnRpZmljYXRpb25Db2RlIjogewogICAgICAgICAgICAgICAgICAgICAgICAiQ291bnRyeUNvZGUiOiAiTVlTIgogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAiQ291bnRyeVN1YmVudGl0eUNvZGUiOiAiMTAiLAogICAgICAgICAgICAgICAgIlBvc3RhbFpvbmUiOiAiNDczMDEiCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9LAogICAgIkRlbGl2ZXJ5IjogewogICAgICAgICJEZWxpdmVyeVBhcnR5IjogewogICAgICAgICAgICAiQ29udGFjdCI6IHsKICAgICAgICAgICAgICAgICJFbGVjdHJvbmljTWFpbCI6ICJpbmZvQG9saXZlc3RvdWNoLmNvbSIsCiAgICAgICAgICAgICAgICAiVGVsZXBob25lIjogIjYwMzIyMzAwOTAiCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICJQYXJ0eUlkZW50aWZpY2F0aW9uIjogWwogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICJJZCI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgIlNjaGVtZUlEIjogIlRJTiIsCiAgICAgICAgICAgICAgICAgICAgICAgICJWYWx1ZSI6ICJDNTg5NjIzNDA0MCIKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICJJZCI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgIlNjaGVtZUlEIjogIkJSTiIsCiAgICAgICAgICAgICAgICAgICAgICAgICJWYWx1ZSI6ICIxOTk1MDEwMTA2NjYiCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAiSWQiOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICJTY2hlbWVJRCI6ICJTU1QiLAogICAgICAgICAgICAgICAgICAgICAgICAiVmFsdWUiOiAiTkEiCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICBdLAogICAgICAgICAgICAiUGFydHlMZWdhbEVudGl0eSI6IHsKICAgICAgICAgICAgICAgICJSZWdpc3RyYXRpb25OYW1lIjogIkNBTVBCRUxMIFNPVVAgU09VVEhFQVNUIEFTSUEgU0ROIEJIRCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIlBvc3RhbEFkZHJlc3MiOiB7CiAgICAgICAgICAgICAgICAiQWRkcmVzc0xpbmUiOiBbCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAiTGluZSI6ICJMZXZlbCAzMyIKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgIkxpbmUiOiAiSWxoYW0gVG93ZXIiCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICJMaW5lIjogIiA4IEphbGFuIEJpbmphaSIKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgIkNpdHlOYW1lIjogIiA4IEphbGFuIEJpbmphaSIsCiAgICAgICAgICAgICAgICAiQ291bnRyeSI6IHsKICAgICAgICAgICAgICAgICAgICAiSWRlbnRpZmljYXRpb25Db2RlIjogewogICAgICAgICAgICAgICAgICAgICAgICAiQ291bnRyeUNvZGUiOiAiTVlTIgogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAiQ291bnRyeVN1YmVudGl0eUNvZGUiOiAiMTQiLAogICAgICAgICAgICAgICAgIlBvc3RhbFpvbmUiOiAiNTA0NTAiCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9LAogICAgIkludm9pY2VMaW5lIjogWwogICAgICAgIHsKICAgICAgICAgICAgIklkIjogIjEiLAogICAgICAgICAgICAiSW52b2ljZWRRdWFudGl0eSI6IHsKICAgICAgICAgICAgICAgICJRdWFudGl0eSI6IDEsCiAgICAgICAgICAgICAgICAiVW5pdENvZGUiOiAiS0dTIgogICAgICAgICAgICB9LAogICAgICAgICAgICAiSXRlbSI6IHsKICAgICAgICAgICAgICAgICJDb21tb2RpdHlDbGFzc2lmaWNhdGlvbiI6IFsKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICJJdGVtQ2xhc3NpZmljYXRpb25Db2RlIjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIkxpc3RJRCI6ICJDTEFTUyIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAiVmFsdWUiOiAiMDExIgogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICJEZXNjcmlwdGlvbiI6ICJSZXBhaXIgYW5kIG1haW50ZW5hbmNlIiwKICAgICAgICAgICAgICAgICJPcmlnaW5Db3VudHJ5IjogewogICAgICAgICAgICAgICAgICAgICJJZGVudGlmaWNhdGlvbkNvZGUiOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICJDb3VudHJ5Q29kZSI6ICJNWVMiCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LAogICAgICAgICAgICAiSXRlbVByaWNlRXh0ZW5zaW9uIjogewogICAgICAgICAgICAgICAgIkFtb3VudCI6IHsKICAgICAgICAgICAgICAgICAgICAiQ3VycmVuY3lJRCI6ICJNWVIiLAogICAgICAgICAgICAgICAgICAgICJWYWx1ZSI6ICIxMjAwMDAiCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICJBbGxvd2FuY2VDaGFyZ2UiOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIkNoYXJnZUluZGljYXRvciI6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgICJNdWx0aXBsaWVyRmFjdG9yTnVtZXJpYyI6IDAuMTAsCiAgICAgICAgICAgICAgICAgICAgIkFsbG93YW5jZUNoYXJnZVJlYXNvbiI6ICJTYW1wbGUiLAogICAgICAgICAgICAgICAgICAgICJBbW91bnQiOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICJDdXJyZW5jeUlEIjogIk1ZUiIsCiAgICAgICAgICAgICAgICAgICAgICAgICJWYWx1ZSI6ICIxMjAwMC4wMCIKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICJDaGFyZ2VJbmRpY2F0b3IiOiB0cnVlLAogICAgICAgICAgICAgICAgICAgICJNdWx0aXBsaWVyRmFjdG9yTnVtZXJpYyI6IDAsCiAgICAgICAgICAgICAgICAgICAgIkFsbG93YW5jZUNoYXJnZVJlYXNvbiI6ICJTYW1wbGUiLAogICAgICAgICAgICAgICAgICAgICJBbW91bnQiOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICJDdXJyZW5jeUlEIjogIk1ZUiIsCiAgICAgICAgICAgICAgICAgICAgICAgICJWYWx1ZSI6ICIwLjAwIgogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgXSwKICAgICAgICAgICAgIlByaWNlIjogewogICAgICAgICAgICAgICAgIlByaWNlQW1vdW50IjogewogICAgICAgICAgICAgICAgICAgICJDdXJyZW5jeUlEIjogIk1ZUiIsCiAgICAgICAgICAgICAgICAgICAgIlZhbHVlIjogIjEwODAwMC4wMCIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwKICAgICAgICAgICAgIkxpbmVFeHRlbnNpb25BbW91bnQiOiB7CiAgICAgICAgICAgICAgICAiQ3VycmVuY3lJRCI6ICJNWVIiLAogICAgICAgICAgICAgICAgIlZhbHVlIjogIjEwODAwMCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIlRheFRvdGFsIjogewogICAgICAgICAgICAgICAgIlRheEFtb3VudCI6IHsKICAgICAgICAgICAgICAgICAgICAiQ3VycmVuY3lJRCI6ICJNWVIiLAogICAgICAgICAgICAgICAgICAgICJWYWx1ZSI6ICI4NjQwLjAwIgogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJUYXhTdWJ0b3RhbCI6IFsKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICJUYXhBbW91bnQiOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAiQ3VycmVuY3lJRCI6ICJNWVIiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIlZhbHVlIjogIjg2NDAuMDAiCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICJUYXhhYmxlQW1vdW50IjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIkN1cnJlbmN5SUQiOiAiTVlSIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICJWYWx1ZSI6ICIxMDgwMDAuMDAiCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICJUYXhDYXRlZ29yeSI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICJJZCI6ICIwMSIKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgIF0sCiAgICAiQWxsb3dhbmNlQ2hhcmdlIjogWwogICAgICAgIHsKICAgICAgICAgICAgIkNoYXJnZUluZGljYXRvciI6IGZhbHNlLAogICAgICAgICAgICAiQWxsb3dhbmNlQ2hhcmdlUmVhc29uIjogIlNhbXBsZSBEZXNjcmlwdGlvbiIsCiAgICAgICAgICAgICJBbW91bnQiOiB7CiAgICAgICAgICAgICAgICAiVmFsdWUiOiA4MDAwLAogICAgICAgICAgICAgICAgIkN1cnJlbmN5SUQiOiAiTVlSIgogICAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJDaGFyZ2VJbmRpY2F0b3IiOiB0cnVlLAogICAgICAgICAgICAiQWxsb3dhbmNlQ2hhcmdlUmVhc29uIjogIlNlcnZpY2UgY2hhcmdlIiwKICAgICAgICAgICAgIkFtb3VudCI6IHsKICAgICAgICAgICAgICAgICJWYWx1ZSI6IDAsCiAgICAgICAgICAgICAgICAiQ3VycmVuY3lJRCI6ICJNWVIiCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICBdLAogICAgIlRheFRvdGFsIjogWwogICAgICAgIHsKICAgICAgICAgICAgIlRheEFtb3VudCI6IHsKICAgICAgICAgICAgICAgICJDdXJyZW5jeUlEIjogIk1ZUiIsCiAgICAgICAgICAgICAgICAiVmFsdWUiOiAiMTAwMDAuMDAiCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICJUYXhTdWJ0b3RhbCI6IFsKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAiVGF4YWJsZUFtb3VudCI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgIkN1cnJlbmN5SUQiOiAiTVlSIiwKICAgICAgICAgICAgICAgICAgICAgICAgIlZhbHVlIjogIjEwMDAwMC4wMCIKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICJUYXhBbW91bnQiOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICJDdXJyZW5jeUlEIjogIk1ZUiIsCiAgICAgICAgICAgICAgICAgICAgICAgICJWYWx1ZSI6ICIxMDAwMC4wMCIKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICJUYXhDYXRlZ29yeSI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgIklkIjogIjAxIgogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAiTGVnYWxNb25ldGFyeVRvdGFsIjogewogICAgICAgICJMaW5lRXh0ZW5zaW9uQW1vdW50IjogewogICAgICAgICAgICAiQ3VycmVuY3lJRCI6ICJNWVIiLAogICAgICAgICAgICAiVmFsdWUiOiAiMTA4MDAwLjAwIgogICAgICAgIH0sCiAgICAgICAgIkFsbG93YW5jZVRvdGFsQW1vdW50IjogewogICAgICAgICAgICAiQ3VycmVuY3lJRCI6ICJNWVIiLAogICAgICAgICAgICAiVmFsdWUiOiAiODAwMC4wMCIKICAgICAgICB9LAogICAgICAgICJDaGFyZ2VUb3RhbEFtb3VudCI6IHsKICAgICAgICAgICAgIkN1cnJlbmN5SUQiOiAiTVlSIiwKICAgICAgICAgICAgIlZhbHVlIjogIjAuMDAiCiAgICAgICAgfSwKICAgICAgICAiVGF4RXhjbHVzaXZlQW1vdW50IjogewogICAgICAgICAgICAiQ3VycmVuY3lJRCI6ICJNWVIiLAogICAgICAgICAgICAiVmFsdWUiOiAiMTAwMDAwLjAwIgogICAgICAgIH0sCiAgICAgICAgIlRheEluY2x1c2l2ZUFtb3VudCI6IHsKICAgICAgICAgICAgIkN1cnJlbmN5SUQiOiAiTVlSIiwKICAgICAgICAgICAgIlZhbHVlIjogIjExMDAwMC4wMCIKICAgICAgICB9LAogICAgICAgICJQcmVwYWlkQW1vdW50IjogewogICAgICAgICAgICAiQ3VycmVuY3lJRCI6ICJNWVIiLAogICAgICAgICAgICAiVmFsdWUiOiAiMC4wMCIKICAgICAgICB9LAogICAgICAgICJQYXlhYmxlQW1vdW50IjogewogICAgICAgICAgICAiQ3VycmVuY3lJRCI6ICJNWVIiLAogICAgICAgICAgICAiVmFsdWUiOiAiMTEwMDAwLjAwIgogICAgICAgIH0sCiAgICAgICAgIlBheWFibGVSb3VuZGluZ0Ftb3VudCI6IHsKICAgICAgICAgICAgIlZhbHVlIjogIjAuMDAiCiAgICAgICAgfQogICAgfSwKICAgICJQYXltZW50TWVhbnMiOiB7CiAgICAgICAgIlBheW1lbnRNZWFuc0NvZGUiOiAiNCIKICAgIH0sCiAgICAiUGF5bWVudFRlcm1zIjogewogICAgICAgICJOb3RlIjogIlBheW1lbnQgTWV0aG9kIGlzIGNhc2giCiAgICB9Cn0=",
            "DocumentFormat": "JSON",
            "UniqueIdentifier": "C58746708080_TEST-SALES-001_01_2024",
            "CustomFields": {
                "Internal Number": "INV00001234561687"
            },
            "version": "MY_GENERATE_UBL_2_1_V1"
        }
    ]
}

Sample Request - Document Details - Decoded (JSON)

Sample Request - Document Details - Decoded (XML)

Response Status Codes

HTTP Status CodeDescription

200

For successfully submitted document or with validation errors

400

For any kind of Invalid Payload issues

401

If the user is not authenticated for the operation

403

If the user is not authorized for the operation

429

Too many requests

Response Schema

ParameterData TypeField ValidationsDescription

Success

Boolean

true/false

Mandatory. Indicates the request was successful or not

DocumentResponses

Array

NA

NA

ErrorDetails

Array<ErrorDetail>

Error details

Optional.

Error list from ClearTax

Document Details Object

ParameterData TypeField ValidationsDescription

DocumentId

String

NA

Unique document id generated in database

UniqueId

String

NA

Mandatory. Same uniqueId as shared in the request

UniqueIdentifier

String

NA

Unique identifier provided in the input request.

Success

Boolean

true/false

Indicates, if the request for this document was successfully processed or not

Uuid

Boolean

true/false

Mandatory. Cleartax reference Id used for further actions. Should be persisted in ERP

ErrorDetails

Array<ErrorDetail>

Error details

Optional.

Error list from ClearTax/LHDN

WarningDetails

Array<ErrorDetail>

Warning details

Optional. Warning list from ClearTax

Sample Response (Success)

HTTP Status Code

200

Response Body

{
    "ErrorDetails": null,
    "Success": true,
    "DocumentResponses": [
        {
            "DocumentId": "665f28c2f626dc2cac32abea",
            "Success": "true",
            "UniqueId": "C58746708080_TEST-SALES-001_01_2024",
            "Uuid": "Y4K7SPNCBE8FAQSCWDEEVHZH10",
            "InternalId": null,
            "ErrorDetails": [],
            "WarningDetails": null,
            "UniqueIdentifier": null
        }
    ]
}

Sample Response (Error)

HTTP Status Code: 400

Response Body

{
    "ErrorDetails": null,
    "Success": true,
    "DocumentResponses": [
        {
            "DocumentId": null,
            "Success": false,
            "UniqueId": "C10709273050_20240410035_01_2024",
            "Uuid": null,
            "InternalId": null,
            "ErrorDetails": [
                {
                    "ErrorCode": "ERR-10001",
                    "ErrorMessage": "Supplier TIN null is not matching the TIN present in the account",
                    "ErrorSource": "CLEARTAX"
                }
            ],
            "WarningDetails": [
                {
                    "Code": null,
                    "Message": null
                }
            ]
        }
    ]
}

API Validations

Currently there are no known validations.

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. Each customer is allowed to send a limited number of requests per minute to prevent server overload. If the limit is exceeded, the server will respond with a 429 Too Many Requests status code.

  3. If the auth token is valid, but the user does not have the authorization to generate an e-invoice for a document, then the API will return HTTP Status Code 403. The user, whose auth token is used, should have an Admin role for the particular TIN used in the request.

Last updated