---
updatedAt: 2026-05-04T16:00:44.000Z
agentTools:
  projectIndex: https://developer.onefinops.com/llms.txt
---

# Generate IRN

Submits an invoice to the IRP and returns the IRN registration record. The handler is
Optionally, including an `eWayBillDetails` block in the body issues a linked EWB in the same IRP
call; the response then also carries `ewbNumber`, `ewbDate` and `ewbValidTill`.


# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "OneFinOps API",
    "version": "1.0.0",
    "summary": "Programmatic access to the Indian GSTN portal — IRN registration, e-Way Bills, and GSP credential management.",
    "description": "The OneFinOps GST API lets you generate IRNs (e-invoices), manage e-Way Bills, and onboard GSP\ncredentials directly against your tenant. This reference documents every public endpoint exposed\non `api.in.onefinops.com` (production) and `sandbox-api.in.onefinops.com` (sandbox).\n\nAll endpoints are authenticated with OAuth 2.0 client credentials. See **Authentication** in the\nguides for token issuance, scope semantics, and SDK examples.\n",
    "contact": {
      "name": "OneFinOps Developer Support",
      "email": "developers@onefinops.com",
      "url": "https://onefinops.com"
    },
    "license": {
      "name": "Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://api.in.onefinops.com",
      "description": "Production"
    },
    {
      "url": "https://sandbox-api.in.onefinops.com",
      "description": "Sandbox"
    }
  ],
  "tags": [
    {
      "name": "E-Invoice",
      "description": "Generate, fetch, cancel and poll IRN registrations against the NIC IRP."
    }
  ],
  "security": [
    {
      "oauth2": []
    }
  ],
  "paths": {
    "/v1/einvoices/generate": {
      "post": {
        "tags": [
          "E-Invoice"
        ],
        "operationId": "generateEInvoice",
        "summary": "Generate IRN",
        "description": "Submits an invoice to the IRP and returns the IRN registration record. The handler is\nOptionally, including an `eWayBillDetails` block in the body issues a linked EWB in the same IRP\ncall; the response then also carries `ewbNumber`, `ewbDate` and `ewbValidTill`.\n",
        "security": [
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/GstinHeader"
          },
          {
            "$ref": "#/components/parameters/RequestIdHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEInvoiceRequest"
              },
              "examples": {
                "minimalB2B": {
                  "summary": "Minimal B2B (intra-state, IRN only)",
                  "description": "Single-item B2B invoice within the same state (CGST+SGST,\nno IGST). The smallest body that mints an IRN. Use this\nas your first call to verify credentials + connectivity\nbefore layering on EWB or export-specific fields.\n",
                  "value": {
                    "documentDetails": {
                      "type": "INV",
                      "number": "INV/2026/00001",
                      "date": "2026-05-14"
                    },
                    "transactionDetails": {
                      "taxScheme": "GST",
                      "supplyType": "B2B"
                    },
                    "seller": {
                      "gstin": "{{sellerGstin}}",
                      "legalName": "OneFinOps QA Seller",
                      "address1": "Plot 1, IT Park",
                      "location": "Hyderabad",
                      "pincode": 500032,
                      "stateCode": "36"
                    },
                    "buyer": {
                      "gstin": "{{buyerGstin}}",
                      "legalName": "QA Buyer (Telangana)",
                      "address1": "Plot 9, Industrial Area",
                      "location": "Hyderabad",
                      "pincode": 500001,
                      "stateCode": "36",
                      "placeOfSupplyStateCode": "36"
                    },
                    "items": [
                      {
                        "serialNumber": "1",
                        "productDescription": "QA Test Product",
                        "hsnCode": "100190",
                        "quantity": 10,
                        "unit": "NOS",
                        "unitPrice": 100,
                        "totalAmount": 1000,
                        "assessableAmount": 1000,
                        "gstRate": 18,
                        "cgstAmount": 90,
                        "sgstAmount": 90,
                        "totalItemValue": 1180
                      }
                    ],
                    "valueDetails": {
                      "assessableValue": 1000,
                      "cgstValue": 90,
                      "sgstValue": 90,
                      "totalInvoiceValue": 1180
                    }
                  }
                },
                "irnWithEwayBill": {
                  "summary": "IRN with linked E-Way Bill",
                  "description": "Inter-state invoice (IGST) that issues both the IRN and a\nlinked E-Way Bill in one call. NIC returns the EWB\nnumber + validity alongside the IRN. Use when goods\nmovement starts at invoice time.\n",
                  "value": {
                    "documentDetails": {
                      "type": "INV",
                      "number": "INV/2026/00002",
                      "date": "2026-05-14"
                    },
                    "transactionDetails": {
                      "taxScheme": "GST",
                      "supplyType": "B2B"
                    },
                    "seller": {
                      "gstin": "{{sellerGstin}}",
                      "legalName": "OneFinOps QA Seller",
                      "address1": "Plot 1, IT Park",
                      "location": "Hyderabad",
                      "pincode": 500032,
                      "stateCode": "36"
                    },
                    "buyer": {
                      "gstin": "{{buyerGstin}}",
                      "legalName": "QA Buyer (HP)",
                      "address1": "Plot 9, Solan IT Park",
                      "location": "Solan",
                      "pincode": 173212,
                      "stateCode": "02",
                      "placeOfSupplyStateCode": "02"
                    },
                    "items": [
                      {
                        "serialNumber": "1",
                        "productDescription": "QA Test Product",
                        "hsnCode": "100190",
                        "quantity": 10,
                        "unit": "NOS",
                        "unitPrice": 100,
                        "totalAmount": 1000,
                        "assessableAmount": 1000,
                        "gstRate": 18,
                        "igstAmount": 180,
                        "totalItemValue": 1180
                      }
                    ],
                    "valueDetails": {
                      "assessableValue": 1000,
                      "igstValue": 180,
                      "totalInvoiceValue": 1180
                    },
                    "eWayBillDetails": {
                      "transporterId": "{{transporterNumber}}",
                      "transportMode": "1",
                      "distance": 1850,
                      "vehicleNumber": "TG09AB1234",
                      "vehicleType": "R"
                    }
                  }
                },
                "exportInvoice": {
                  "summary": "Export invoice (zero-rated)",
                  "description": "Export shipment under LUT (Letter of Undertaking) — no\nIGST charged. Buyer GSTIN is the URP (Unregistered\nPerson) sentinel `URP`. The `exportDetails` block carries\nshipping bill + port info NIC validates separately.\n",
                  "value": {
                    "documentDetails": {
                      "type": "INV",
                      "number": "EXP/2026/00001",
                      "date": "2026-05-14"
                    },
                    "transactionDetails": {
                      "taxScheme": "GST",
                      "supplyType": "EXPWOP"
                    },
                    "seller": {
                      "gstin": "{{sellerGstin}}",
                      "legalName": "OneFinOps QA Seller",
                      "address1": "Plot 1, IT Park",
                      "location": "Hyderabad",
                      "pincode": 500032,
                      "stateCode": "36"
                    },
                    "buyer": {
                      "gstin": "URP",
                      "legalName": "Overseas Customer",
                      "address1": "221B Baker Street",
                      "location": "London",
                      "pincode": 999999,
                      "stateCode": "96",
                      "placeOfSupplyStateCode": "96"
                    },
                    "items": [
                      {
                        "serialNumber": "1",
                        "productDescription": "Software services",
                        "hsnCode": "998313",
                        "isService": true,
                        "quantity": 1,
                        "unit": "OTH",
                        "unitPrice": 50000,
                        "totalAmount": 50000,
                        "assessableAmount": 50000,
                        "gstRate": 0,
                        "totalItemValue": 50000
                      }
                    ],
                    "valueDetails": {
                      "assessableValue": 50000,
                      "totalInvoiceValue": 50000
                    },
                    "exportDetails": {
                      "countryCode": "GB",
                      "shippingBillNumber": "1234567",
                      "shippingBillDate": "2026-05-14",
                      "portCode": "INMAA1"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "e-invoice generated. Identical to the response NIC IRP returns\non a fresh submit. On a duplicate submission (same seller GSTIN,\ndoc type, doc number, financial year) the body is the same\nshape but `message` is `2150 : Duplicate IRN` and `infoCode`\nis `DUPIRN` — the existing IRN is returned. Customers should\ncheck `infoCode` for programmatic replay detection.\n",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerateIrnResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "description": "OAuth 2.0 client credentials flow. Mint your token from `login.onefinops.com` using your `ofin_live_*` (production) or `ofin_test_*` (sandbox) credentials issued from the Developer console. The realm attaches `onefinops.api` as a **default scope** to every `ofin_*` client at provision time — you do not pass `scope=...` on the token request. The minted access token carries `aud=onefinops.api` and `client_class=external_customer`.",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://login.onefinops.com/realms/onefinops/protocol/openid-connect/token",
            "scopes": {}
          }
        }
      }
    },
    "parameters": {
      "GstinHeader": {
        "in": "header",
        "name": "gstin",
        "required": true,
        "description": "GSTIN whose NIC IRP / EWB-portal credential authorizes the call.\nSeed each GSTIN's credential through the Developer Console.\n",
        "schema": {
          "type": "string",
          "pattern": "^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z][A-Z0-9]{3}$",
          "minLength": 15,
          "maxLength": 15,
          "example": "05AAACG2409A1ZH"
        }
      },
      "RequestIdHeader": {
        "in": "header",
        "name": "X-Request-Id",
        "required": false,
        "description": "Optional client-supplied UUID for correlation across logs and dashboards. If omitted, OneFinOps mints one and echoes it back on the response.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      }
    },
    "headers": {
      "XRequestId": {
        "description": "Echoed request id (X-Request-Id, or server-generated).",
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Request rejected.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or invalid token.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "Forbidden": {
        "description": "Token lacks the required scope for this endpoint.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "Conflict": {
        "description": "State conflict — see `code` for the specific reason.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "ValidationError": {
        "description": "Body or query failed validation.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Rate limit exceeded.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "ServerError": {
        "description": "Unexpected server-side error.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      }
    },
    "schemas": {
      "ApiError": {
        "type": "object",
        "description": "Canonical error body returned on every 4xx / 5xx response. The HTTP\nstatus carries the category — there is no `httpStatus` field in the\nbody. NIC IRP / EWB rejections come through as the top-level `code`\n(numeric NIC code or `GSP_GATEWAY_REJECT` for non-NIC vendor errors);\nthe verbatim NIC text is preserved in `details` keyed by code.\n",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "Stable machine-readable code. For NIC business errors this is the NIC numeric code (e.g. `\"382\"`); for our own errors it is a dotted identifier (e.g. `einvoice.cancel_window_expired`). Branch on this — never on `message`.",
            "examples": [
              "382",
              "einvoice.cancel_window_expired",
              "validation_error",
              "GSP_GATEWAY_REJECT"
            ]
          },
          "message": {
            "type": "string",
            "description": "Human-readable explanation. Safe to show end users, but not for programmatic logic."
          },
          "details": {
            "type": "object",
            "description": "Optional. Keys are error codes (or field paths on 422 validation\nfailures); values are arrays of messages. For NIC errors the\nverbatim message text from NIC is preserved here under the NIC\ncode key.\n",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "examples": [
              {
                "382": [
                  "You Cannot Extend as EWB can be Extended only 8 hour before or after w.r.t Validity of EWB"
                ]
              },
              {
                "documentDetails.documentDate": [
                  "The document date should not be a future date."
                ]
              }
            ]
          },
          "requestId": {
            "type": "string",
            "description": "Echoes the request id (X-Request-Id) for support correlation."
          },
          "traceId": {
            "type": "string",
            "description": "W3C trace-id for distributed-tracing correlation."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "UTC timestamp the error was generated."
          }
        }
      },
      "EInvoiceTransactionDetails": {
        "type": "object",
        "description": "Transaction-level details.",
        "required": [
          "supplyType"
        ],
        "properties": {
          "taxScheme": {
            "type": "string",
            "enum": [
              "GST"
            ],
            "default": "GST",
            "description": "Optional. Tax scheme; defaults to `GST` (the only supported value for India)."
          },
          "supplyType": {
            "type": "string",
            "enum": [
              "B2B",
              "SEZWP",
              "SEZWOP",
              "EXPWP",
              "EXPWOP",
              "DEXP"
            ],
            "description": "Supply type code. Required — pick the\nshape that matches the transaction.\n\n- `B2B`    — Business to Business\n- `SEZWP`  — SEZ with Payment of IGST\n- `SEZWOP` — SEZ Without Payment of IGST\n- `EXPWP`  — Export with Payment of IGST\n- `EXPWOP` — Export Without Payment of IGST (LUT)\n- `DEXP`   — Deemed Export\n"
          },
          "reverseCharge": {
            "type": "string",
            "enum": [
              "Y",
              "N"
            ],
            "nullable": true,
            "description": "Reverse charge flag — `Y` or `N`."
          },
          "ecommerceGstin": {
            "type": "string",
            "minLength": 15,
            "maxLength": 15,
            "nullable": true,
            "description": "E-commerce operator GSTIN (only for e-commerce supplies)."
          },
          "igstOnIntra": {
            "type": "string",
            "enum": [
              "Y",
              "N"
            ],
            "nullable": true,
            "description": "IGST on intra-state supply (Section 7 IGST Act) — `Y` or `N`."
          }
        }
      },
      "EInvoiceDocumentDetails": {
        "type": "object",
        "description": "Document details.",
        "required": [
          "type",
          "number",
          "date"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "INV",
              "CRN",
              "DBN"
            ],
            "description": "Document type. Required.\n\n- `INV` — Tax Invoice\n- `CRN` — Credit Note\n- `DBN` — Debit Note\n"
          },
          "number": {
            "type": "string",
            "maxLength": 16,
            "description": "Document number (max 16 chars; alphanumeric + hyphen + slash).",
            "example": "PAQA001"
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "Document date (YYYY-MM-DD).",
            "example": "2026-05-14"
          }
        }
      },
      "EInvoiceParty": {
        "type": "object",
        "description": "Party details — used for Seller (and via inheritance for Shipping).",
        "required": [
          "gstin",
          "legalName",
          "address1",
          "location",
          "pincode",
          "stateCode"
        ],
        "properties": {
          "gstin": {
            "type": "string",
            "minLength": 15,
            "maxLength": 15,
            "nullable": true,
            "description": "15-character GSTIN. Omit for unregistered buyers (use `URP` semantics on the buyer side via supply type)."
          },
          "legalName": {
            "type": "string"
          },
          "tradeName": {
            "type": "string",
            "nullable": true
          },
          "address1": {
            "type": "string"
          },
          "address2": {
            "type": "string",
            "nullable": true
          },
          "location": {
            "type": "string",
            "description": "City / locality."
          },
          "pincode": {
            "type": "integer",
            "description": "6-digit pincode (numeric, NIC verbatim — lowercase `c`).",
            "example": 500032
          },
          "stateCode": {
            "type": "string",
            "description": "Two-digit state code per NIC (string, preserves leading zero).",
            "example": "29"
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "EInvoiceBuyer": {
        "type": "object",
        "description": "Buyer details — party + place of supply.",
        "required": [
          "gstin",
          "legalName",
          "address1",
          "location",
          "pincode",
          "stateCode",
          "placeOfSupplyStateCode"
        ],
        "properties": {
          "gstin": {
            "type": "string",
            "minLength": 15,
            "maxLength": 15,
            "nullable": true
          },
          "legalName": {
            "type": "string"
          },
          "tradeName": {
            "type": "string",
            "nullable": true
          },
          "address1": {
            "type": "string"
          },
          "address2": {
            "type": "string",
            "nullable": true
          },
          "location": {
            "type": "string"
          },
          "pincode": {
            "type": "integer",
            "example": 173212
          },
          "stateCode": {
            "type": "string",
            "example": "02"
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "placeOfSupplyStateCode": {
            "type": "string",
            "description": "Place-of-supply 2-digit state code.",
            "example": "02"
          }
        }
      },
      "EInvoiceDispatcher": {
        "type": "object",
        "description": "Dispatcher details. Populate only when goods are dispatched from a non-seller location.",
        "required": [
          "name",
          "address1",
          "location",
          "pincode",
          "stateCode"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "address1": {
            "type": "string"
          },
          "address2": {
            "type": "string",
            "nullable": true
          },
          "location": {
            "type": "string"
          },
          "pincode": {
            "type": "integer"
          },
          "stateCode": {
            "type": "string"
          }
        }
      },
      "EInvoiceShipping": {
        "type": "object",
        "description": "Shipping details — same shape as Seller. Populate only when goods ship to a non-buyer location.",
        "required": [
          "legalName",
          "address1",
          "location",
          "pincode",
          "stateCode"
        ],
        "properties": {
          "gstin": {
            "type": "string",
            "minLength": 15,
            "maxLength": 15,
            "nullable": true
          },
          "legalName": {
            "type": "string"
          },
          "tradeName": {
            "type": "string",
            "nullable": true
          },
          "address1": {
            "type": "string"
          },
          "address2": {
            "type": "string",
            "nullable": true
          },
          "location": {
            "type": "string"
          },
          "pincode": {
            "type": "integer"
          },
          "stateCode": {
            "type": "string"
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "EInvoiceBatch": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "expiryDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "warrantyDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          }
        }
      },
      "EInvoiceItemAttribute": {
        "type": "object",
        "required": [
          "name",
          "value"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        }
      },
      "EInvoiceItem": {
        "type": "object",
        "description": "One line item on the invoice.",
        "required": [
          "serialNumber",
          "hsnCode",
          "unitPrice",
          "totalAmount",
          "assessableAmount",
          "gstRate",
          "totalItemValue"
        ],
        "properties": {
          "serialNumber": {
            "type": "string",
            "description": "Line-item serial number (string per NIC).",
            "example": "1"
          },
          "productDescription": {
            "type": "string",
            "nullable": true,
            "description": "Optional. Description of the product or service for this line item; may be omitted."
          },
          "isService": {
            "type": "boolean",
            "default": false
          },
          "hsnCode": {
            "type": "string",
            "example": "998314"
          },
          "barcode": {
            "type": "string",
            "nullable": true
          },
          "quantity": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "freeQuantity": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "unit": {
            "type": "string",
            "nullable": true,
            "description": "Unit of measure (`NOS`, `KGS`, `BOX`, ...)."
          },
          "unitPrice": {
            "type": "number",
            "format": "double"
          },
          "totalAmount": {
            "type": "number",
            "format": "double",
            "description": "Gross amount = unit price x quantity."
          },
          "discount": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "preTaxValue": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "assessableAmount": {
            "type": "number",
            "format": "double",
            "description": "Taxable value (TotalAmount minus Discount)."
          },
          "gstRate": {
            "type": "number",
            "format": "double",
            "description": "GST rate as percentage (e.g. 18 for 18%)."
          },
          "igstAmount": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "cgstAmount": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "sgstAmount": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "cessRate": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "cessAmount": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "cessNonAdvolAmount": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "stateCessRate": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "stateCessAmount": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "stateCessNonAdvolAmount": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "otherCharges": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "totalItemValue": {
            "type": "number",
            "format": "double"
          },
          "orderLineReference": {
            "type": "string",
            "nullable": true
          },
          "originCountryCode": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2,
            "nullable": true,
            "description": "ISO 3166-1 alpha-2 country of origin."
          },
          "productSerialNumber": {
            "type": "string",
            "nullable": true
          },
          "batch": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EInvoiceBatch"
              }
            ],
            "nullable": true
          },
          "attributes": {
            "type": "array",
            "nullable": true,
            "items": {
              "$ref": "#/components/schemas/EInvoiceItemAttribute"
            }
          }
        }
      },
      "EInvoiceValue": {
        "type": "object",
        "description": "Invoice value totals.",
        "required": [
          "assessableValue",
          "totalInvoiceValue"
        ],
        "properties": {
          "assessableValue": {
            "type": "number",
            "format": "double"
          },
          "cgstValue": {
            "type": "number",
            "format": "double"
          },
          "sgstValue": {
            "type": "number",
            "format": "double"
          },
          "igstValue": {
            "type": "number",
            "format": "double"
          },
          "cessValue": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "stateCessValue": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "discount": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "otherCharges": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "roundOffAmount": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "totalInvoiceValue": {
            "type": "number",
            "format": "double"
          },
          "totalInvoiceValueForeignCurrency": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Total invoice value in foreign currency (exports only)."
          }
        }
      },
      "EInvoicePayment": {
        "type": "object",
        "description": "Payment details.",
        "properties": {
          "payeeName": {
            "type": "string",
            "nullable": true
          },
          "accountDetails": {
            "type": "string",
            "nullable": true
          },
          "mode": {
            "type": "string",
            "nullable": true
          },
          "financialInstitutionBranch": {
            "type": "string",
            "nullable": true
          },
          "paymentTerm": {
            "type": "string",
            "nullable": true
          },
          "paymentInstruction": {
            "type": "string",
            "nullable": true
          },
          "creditTransfer": {
            "type": "string",
            "nullable": true
          },
          "directDebit": {
            "type": "string",
            "nullable": true
          },
          "creditDays": {
            "type": "integer",
            "nullable": true
          },
          "paidAmount": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "paymentDue": {
            "type": "number",
            "format": "double",
            "nullable": true
          }
        }
      },
      "EInvoiceDocumentPeriod": {
        "type": "object",
        "required": [
          "invoiceStartDate",
          "invoiceEndDate"
        ],
        "properties": {
          "invoiceStartDate": {
            "type": "string",
            "format": "date"
          },
          "invoiceEndDate": {
            "type": "string",
            "format": "date"
          }
        }
      },
      "EInvoicePrecedingDocument": {
        "type": "object",
        "required": [
          "invoiceNumber",
          "invoiceDate"
        ],
        "properties": {
          "invoiceNumber": {
            "type": "string"
          },
          "invoiceDate": {
            "type": "string",
            "format": "date"
          },
          "otherReferenceNumber": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "EInvoiceContract": {
        "type": "object",
        "properties": {
          "receiptAdviceReference": {
            "type": "string",
            "nullable": true
          },
          "receiptAdviceDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "tenderReference": {
            "type": "string",
            "nullable": true
          },
          "contractReference": {
            "type": "string",
            "nullable": true
          },
          "externalReference": {
            "type": "string",
            "nullable": true
          },
          "projectReference": {
            "type": "string",
            "nullable": true
          },
          "purchaseOrderReference": {
            "type": "string",
            "nullable": true
          },
          "purchaseOrderReferenceDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          }
        }
      },
      "EInvoiceReference": {
        "type": "object",
        "description": "Reference details.",
        "properties": {
          "invoiceRemarks": {
            "type": "string",
            "nullable": true
          },
          "documentPeriod": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EInvoiceDocumentPeriod"
              }
            ],
            "nullable": true
          },
          "precedingDocuments": {
            "type": "array",
            "nullable": true,
            "description": "Preceding documents — mandatory for credit and debit notes.",
            "items": {
              "$ref": "#/components/schemas/EInvoicePrecedingDocument"
            }
          },
          "contracts": {
            "type": "array",
            "nullable": true,
            "items": {
              "$ref": "#/components/schemas/EInvoiceContract"
            }
          }
        }
      },
      "EInvoiceAdditionalDocument": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "nullable": true
          },
          "documents": {
            "type": "string",
            "nullable": true
          },
          "info": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "EInvoiceExport": {
        "type": "object",
        "description": "Export details — required for SEZ / Export supply types.",
        "properties": {
          "shippingBillNumber": {
            "type": "string",
            "nullable": true
          },
          "shippingBillDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "port": {
            "type": "string",
            "nullable": true
          },
          "refundClaim": {
            "type": "string",
            "enum": [
              "Y",
              "N"
            ],
            "nullable": true,
            "description": "Refund claim flag — `Y` or `N`."
          },
          "foreignCurrencyCode": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3,
            "nullable": true,
            "description": "ISO 4217 alpha-3 currency code."
          },
          "countryCode": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2,
            "nullable": true,
            "description": "ISO 3166-1 alpha-2 country code."
          },
          "exportDuty": {
            "type": "number",
            "format": "double",
            "nullable": true
          }
        }
      },
      "EInvoiceEWayBillGenerationDetails": {
        "type": "object",
        "description": "E-Way Bill details — populate to generate the EWB with the IRN.\nEither `transporterId` (Part-A only) or `vehicleNumber` (Part-A + Part-B) must be supplied.",
        "required": [
          "distance"
        ],
        "properties": {
          "transporterId": {
            "type": "string",
            "minLength": 15,
            "maxLength": 15,
            "nullable": true,
            "description": "Transporter GSTIN or NIC TRANSIN. Required when `vehicleNumber` is not supplied."
          },
          "transporterName": {
            "type": "string",
            "nullable": true
          },
          "distance": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4000,
            "default": 0,
            "description": "Consignment distance in km, used by NIC to compute EWB validity. Pass `0` to let NIC auto-calculate the pin-to-pin road distance from the source and destination pincodes (recommended when the exact road distance is unknown). Any non-zero value is validated against NIC's pin-to-pin reference and is rejected if it deviates beyond NIC's tolerance (≈10% above the calculated value) with \"The distance between the pincodes given is too high\". For a small number of pincode pairs NIC has not mapped, `0` is rejected with \"The distance between the given pincodes are not available in the system. Please provide distance\". Retry with the actual road distance (a positive value up to 4000 km; NIC accepts your value on these unmapped routes). The field is mandatory; omitting it returns \"Invalid Approximate Distance\". The applied distance is returned on generation and on Get E-Way Bill."
          },
          "transportDocumentNumber": {
            "type": "string",
            "nullable": true
          },
          "transportDocumentDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "vehicleNumber": {
            "type": "string",
            "nullable": true,
            "description": "Vehicle number — required for road movements when generating Part-B in the same call."
          },
          "vehicleType": {
            "type": "string",
            "enum": [
              "R",
              "O"
            ],
            "nullable": true,
            "description": "`R` Regular or `O` Over-Dimensional Cargo."
          },
          "transportMode": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3",
              "4"
            ],
            "nullable": true,
            "description": "1=Road, 2=Rail, 3=Air, 4=Ship."
          }
        }
      },
      "CreateEInvoiceRequest": {
        "type": "object",
        "description": "Customer-facing IRN-generation request. Nested objects (`transactionDetails`, `documentDetails`, `seller`, `buyer`, `items`, `valueDetails`, `eWayBillDetails`) keep a stable, well-documented canonical shape. Idempotency uses the",
        "required": [
          "transactionDetails",
          "documentDetails",
          "seller",
          "buyer",
          "items",
          "valueDetails"
        ],
        "properties": {
          "transactionDetails": {
            "$ref": "#/components/schemas/EInvoiceTransactionDetails"
          },
          "documentDetails": {
            "$ref": "#/components/schemas/EInvoiceDocumentDetails"
          },
          "seller": {
            "$ref": "#/components/schemas/EInvoiceParty"
          },
          "buyer": {
            "$ref": "#/components/schemas/EInvoiceBuyer"
          },
          "dispatcherDetails": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EInvoiceDispatcher"
              }
            ],
            "nullable": true
          },
          "shippingDetails": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EInvoiceShipping"
              }
            ],
            "nullable": true
          },
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 1000,
            "description": "At least one item is required; IRP allows up to 1000.",
            "items": {
              "$ref": "#/components/schemas/EInvoiceItem"
            }
          },
          "valueDetails": {
            "$ref": "#/components/schemas/EInvoiceValue"
          },
          "paymentDetails": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EInvoicePayment"
              }
            ],
            "nullable": true
          },
          "referenceDetails": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EInvoiceReference"
              }
            ],
            "nullable": true
          },
          "additionalDocuments": {
            "type": "array",
            "nullable": true,
            "items": {
              "$ref": "#/components/schemas/EInvoiceAdditionalDocument"
            }
          },
          "exportDetails": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EInvoiceExport"
              }
            ],
            "nullable": true,
            "description": "Required for SEZ / Export supply types — IRP rejects export invoices without it."
          },
          "eWayBillDetails": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EInvoiceEWayBillGenerationDetails"
              }
            ],
            "nullable": true,
            "description": "Optional. When present, IRP generates the linked e-Way Bill in the same call and the response carries `ewbNumber` / `ewbDate` / `ewbValidTill`."
          }
        }
      },
      "GenerateIrnResponse": {
        "type": "object",
        "description": "Response for `POST /v1/einvoices/generate`. Mirrors what NIC IRP actually returns for a successful\nIRN registration — the IRN, the acknowledgement pair, `status` = `ACT`, and the two IRP-signed JWS\nblobs (`signedInvoice` + `signedQRCode`). When the request included an `eWayBillDetails` block,\nthe IRP also issues a linked EWB in the same call and echoes the EWB triple back.",
        "required": [
          "irn",
          "status"
        ],
        "properties": {
          "irn": {
            "type": "string",
            "description": "64-character IRN hash issued by the IRP.",
            "minLength": 64,
            "maxLength": 64
          },
          "ackNumber": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "IRP acknowledgement number (15-digit BIGINT).",
            "example": 112610251262290
          },
          "ackDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "IRP acknowledgement timestamp (UTC)."
          },
          "status": {
            "type": "string",
            "description": "IRP status — `ACT` on successful generate.",
            "enum": [
              "ACT"
            ]
          },
          "signedInvoice": {
            "type": "string",
            "nullable": true,
            "description": "IRP-signed JWS of the full e-invoice payload. Decode to recover the canonical IRP signed document."
          },
          "signedQRCode": {
            "type": "string",
            "nullable": true,
            "description": "IRP-signed QR JWS."
          },
          "ewbNumber": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Linked EWB number — populated only when the request body included an `eWayBillDetails` block and IRP generated the EWB in the same call."
          },
          "ewbDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Linked e-Way Bill generation timestamp."
          },
          "ewbValidTill": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Linked e-Way Bill validity expiry."
          },
          "remarks": {
            "type": "string",
            "nullable": true,
            "description": "Free-text remarks from NIC (usually null on Generate)."
          },
          "message": {
            "type": "string",
            "nullable": true,
            "description": "IRP envelope-level message text, echoed verbatim. On a fresh\ngenerate this is `E-Invoice generated successfully`. On a\nduplicate submission this is `2150 : Duplicate IRN` — NIC's\nstandard idempotent-replay message — and the existing IRN is\nreturned in this same response body. Customers can render this\nstring directly; it is the same text the IRP itself surfaces.\n",
            "example": "E-Invoice generated successfully"
          },
          "infoCode": {
            "type": "string",
            "nullable": true,
            "description": "NIC info code when the IRP returned an info-code envelope\ninstead of a fresh write. Currently the only value is\n`DUPIRN` — the request was a duplicate of an already-generated\nIRN (same seller GSTIN, doc type, doc number, financial year)\nand the existing IRN is returned. Null on a fresh generate.\nUse this for programmatic replay detection instead of parsing\n`message`.\n",
            "enum": [
              "DUPIRN"
            ],
            "example": "DUPIRN"
          }
        }
      }
    }
  }
}
```