create_invoice
Generate a GST e-invoice and get an IRN (Invoice Reference Number) from the IRP (Invoice Registration Portal, run by GSTN), stamped through the Sandbox.co.in GSP. Bring your own Sandbox credentials via headers x-sandbox-api-key AND x-sandbox-api-secret (sign up at sandbox.co.in). Your GSTIN must already have GST e-Invoice API access enabled on the e-Invoice portal and mapped to Sandbox as your GSP. e-Invoicing is B2B only — BOTH seller and buyer must have valid 15-char GSTINs. Give flat fields (seller/buyer GSTIN + name + address, doc_number, line items with hsn_code, price, quantity, gst_rate) and this server COMPUTES the INV-01 tax schema for you: taxable value per line, CGST+SGST split for same-state supply vs IGST for cross-state supply (decided automatically from the seller GSTIN state vs the place-of-supply state), item totals, and the invoice totals (AssVal / TotInvVal). Returns Irn, AckNo, AckDt and SignedQRCode.
Parameters14
| seller_gstin | string | required | Seller (supplier) 15-char GSTIN, e.g. 29ABCDE1234F1Z5. Its first 2 digits are the seller state code and drive the CGST+SGST vs IGST decision. |
| seller_legal_name | string | required | Seller legal name (LglNm) exactly as registered under this GSTIN. |
| seller_address | string | required | Seller registered address line 1 (Addr1). |
| seller_city | string | required | Seller city / location (Loc). |
| seller_pincode | string | required | Seller 6-digit PIN code (Pin). |
| buyer_gstin | string | required | Buyer (recipient) 15-char GSTIN. Required — e-invoicing is B2B only. |
| buyer_legal_name | string | required | Buyer legal name (LglNm) as registered under the buyer GSTIN. |
| buyer_address | string | required | Buyer address line 1 (Addr1). |
| buyer_city | string | required | Buyer city / location (Loc). |
| buyer_pincode | string | required | Buyer 6-digit PIN code (Pin). |
| buyer_state_code | string | optional | Optional place-of-supply state code (POS), 2 digits. Defaults to the buyer GSTIN state code. Set this if the place of supply differs from the buyer registration state. |
| doc_number | string | required | Your invoice/document number (DocDtls.No), max 16 chars. |
| doc_date | string | optional | Invoice date DD/MM/YYYY (DocDtls.Dt). Defaults to today (UTC). |
| items | array | required | Line items. Each: description, hsn_code (HSN/SAC), price (unit price in INR, tax-EXCLUSIVE), gst_rate (percent, e.g. 18), optional quantity (default 1) and unit (default NOS). GST is computed on top of price*quantity. |
Raw schema
{
"type": "object",
"properties": {
"seller_gstin": {
"type": "string",
"description": "Seller (supplier) 15-char GSTIN, e.g. 29ABCDE1234F1Z5. Its first 2 digits are the seller state code and drive the CGST+SGST vs IGST decision."
},
"seller_legal_name": {
"type": "string",
"description": "Seller legal name (LglNm) exactly as registered under this GSTIN."
},
"seller_address": {
"type": "string",
"description": "Seller registered address line 1 (Addr1)."
},
"seller_city": {
"type": "string",
"description": "Seller city / location (Loc)."
},
"seller_pincode": {
"type": "string",
"description": "Seller 6-digit PIN code (Pin)."
},
"buyer_gstin": {
"type": "string",
"description": "Buyer (recipient) 15-char GSTIN. Required — e-invoicing is B2B only."
},
"buyer_legal_name": {
"type": "string",
"description": "Buyer legal name (LglNm) as registered under the buyer GSTIN."
},
"buyer_address": {
"type": "string",
"description": "Buyer address line 1 (Addr1)."
},
"buyer_city": {
"type": "string",
"description": "Buyer city / location (Loc)."
},
"buyer_pincode": {
"type": "string",
"description": "Buyer 6-digit PIN code (Pin)."
},
"buyer_state_code": {
"type": "string",
"description": "Optional place-of-supply state code (POS), 2 digits. Defaults to the buyer GSTIN state code. Set this if the place of supply differs from the buyer registration state."
},
"doc_number": {
"type": "string",
"description": "Your invoice/document number (DocDtls.No), max 16 chars."
},
"doc_date": {
"type": "string",
"description": "Invoice date DD/MM/YYYY (DocDtls.Dt). Defaults to today (UTC)."
},
"items": {
"type": "array",
"minItems": 1,
"description": "Line items. Each: description, hsn_code (HSN/SAC), price (unit price in INR, tax-EXCLUSIVE), gst_rate (percent, e.g. 18), optional quantity (default 1) and unit (default NOS). GST is computed on top of price*quantity.",
"items": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"hsn_code": {
"type": "string",
"description": "HSN (goods) or SAC (services) code."
},
"price": {
"type": "number",
"description": "Tax-exclusive unit price in INR."
},
"quantity": {
"type": "number",
"description": "Default 1."
},
"gst_rate": {
"type": "number",
"description": "GST rate percent, e.g. 0, 5, 12, 18, 28."
},
"unit": {
"type": "string",
"description": "Unit of measure (UQC), default NOS."
}
},
"required": [
"description",
"hsn_code",
"price",
"gst_rate"
]
}
}
},
"required": [
"seller_gstin",
"seller_legal_name",
"seller_address",
"seller_city",
"seller_pincode",
"buyer_gstin",
"buyer_legal_name",
"buyer_address",
"buyer_city",
"buyer_pincode",
"doc_number",
"items"
]
}