Generate IRN
You can generate an IRN by sending a PUT request to E-Invoicing API with the following request headers.
Request Method
PUT
Request URL
{{HOST}}/einv/v2/eInvoice/generateRequest Headers
X-Cleartax-Auth-Token
String
NA
Mandatory. The auth token generated from ClearTax user id and password.
Content-Type
String
NA
Mandatory. This will always be "application/json" for JSON and "application/xml" for XML
Accept
String
NA
Optional. This will be "application/xml" if you want the response in XML.
gstin
String
NA
Mandatory. GSTIN number for the user
branch
String
NA
Optional. Branch name for the user.
Request Path Params
There are no path parameters for this API.
Request Query Params
dryRun
Boolean
NA
Optional. If the flag is set to true, only ClearTax validations will run, however the EInvoice wonโt be generated. Default - false
Request Body
This API accepts an array of E-Invoice Custom Objects as the request body.
E-Invoice Custom Object
custom_fields
Object
Max: 10
Optional. Key value pair of custom fields. You can send a maximum of 10 custom fields only.
Response Status Codes
200
For a successfully processed request (may be a success or validation error).
400
Bad Request. The request body is in invalid format.
401
If the user is not authenticated for the operation.
403
If the user is not authorised for the operation.
500
If there are any unhandled exceptions on the Clear side.
Response Schema
Parameter
Data Type
Field Validations
Description
document_status
Status
Enum: IRN_GENERATED, NOT_CREATED,
IRN_CANCELLED, DOCUMENT_VALIDATION
Status of the IRN. In case of dry run, the document status will always be DOCUMENT_VALIDATION.
govt_response
Object
NA
Response containing EInvoice details.
Govt. Response Object
Parameter
Data Type
Field Validations
Description
Success
Boolean
โYโ, โNโ
If Success or Failure.
AckNo
Number
NA
Acknowledgement Number
AckDt
String
NA
Acknowledgement Date
IRN
String
64 Digits
Invoice Reference Number
SignedInvoice
String
NA
Signed Invoice
SignedQRCode
String
NA
QR code in JWT String.
Status
String
NA
Status of the Invoice
EwbNo
Number
NA
E-Way bill Number.
EwbDt
String
NA
E-Way bill generation date and time.
EwbValidTill
String
NA
E-Way bill expiry date and time.
ErrorDetails
List
NA
List of Error Objects. If there is no error, this field will not be given in the response.
Error Details Object
Parameter
Data Type
Field Validations
Description
error_code
Number
NA
Specific code as per the error.
error_message
String
NA
Specific message as per the error.
error_source
String
โCLEARTAXโ, โGOVTโ
Source of the error.
Sample Request and Response
Request
Response - Success: (Dryrun = False):
HTTP Status Code: 200 OK
Response - Success: (Dryrun = True)
HTTP Status Code: 200 OK
The parameter "Success" : "Y" denotes that the document has been successfully validated by ClearTax.
Response - Error: (Dryrun = False)
HTTP Status Code: 200 OK
Response - Error: (Dryrun = True)
HTTP Status Code: 200 OK
API Validations
For bulk generation, you can send a list of up to 10 Invoice Objects in the same request body.
API Constraints
The invoice you receive in response to this API is the invoice persisted by ClearTax. This may include fields sent by you at the time of generation which may not be part of the invoice returned by the Government.
Last updated
Was this helpful?