Developer
Sales Invoice API
Issue IRD-aligned sales invoices and credit notes from your website, ERP, or custom stack, same numbering, VAT rules, and CBMS path as the dashboard.
Overview
The Nepal IRD Billing REST API lets server-side applications create sales invoices and credit notes that respect your workspace tax settings, fiscal-year sequences, and CBMS configuration.
All requests use JSON over HTTPS. Responses use standard HTTP status codes; validation errors return a structured error body with field-level hints.
Authentication
Send a workspace API key on every request using the X-API-Key header.
- Sign in as a workspace admin.
- Open Settings → API Keys.
- Create a key and copy the raw value immediately, it is displayed only once.
- Store the key in server environment variables (for example
NEPAL_IRD_BILLING_API_KEY).
Example keys look like NIB_live_••••••••. Rotate keys from Settings if compromised.
Base URL
Each workspace has a dedicated API host. Replace {workspace} with your workspace slug from the dashboard:
https://{workspace}.api.nepalirdbilling.comExample: https://acme-traders.api.nepalirdbilling.com
POST /v1/sales-invoices
Create a new tax invoice. On success the invoice is persisted and, when CBMS sync is enabled, queued for transmission using the same pipeline as counter sales.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| customer_name | string | Yes | Buyer or walk-in customer label printed on the tax invoice. |
| customer_pan | string | Conditional | Buyer PAN when B2B or buyer requests PAN on bill; omit or null for retail walk-ins. |
| phone | string | No | Contact number for receipt SMS or support follow-up. |
| payment_mode | enum | Yes | CA cash, CR credit, BA bank transfer, QR QR pay, KH Khalti, ES eSewa, PO purchase order. |
| invoice_date | string (ISO 8601) | No | Defaults to server time in Nepal timezone if omitted. |
| products | array | Yes | Line items; at least one product required. |
| products[].name | string | Yes | Product or service description. |
| products[].quantity | number | Yes | Sold quantity; decimals allowed where your catalog supports them. |
| products[].unit_price | number | Yes | Tax-exclusive or tax-inclusive unit price per your workspace tax setting. |
| products[].sku | string | No | Internal SKU or barcode reference. |
| products[].vat_rate | number | No | Override line VAT rate; defaults to product master or 13% standard rate. |
| discount_amount | number | No | Invoice-level discount before tax. |
| remarks | string | No | Printed or internal note; avoid PII you do not need on the invoice. |
| external_reference | string | No | Your order ID for idempotency and reconciliation. |
Payment mode codes
CA cash · CR credit · BA bank · QR QR pay · KH Khalti · ES eSewa · PO purchase order
POST /v1/credit-notes
Issue a credit note against a previously created sales invoice. Deletion of issued invoices is not supported, adjustments must flow through credit notes.
| Field | Type | Required | Description |
|---|---|---|---|
| original_invoice_id | string (UUID) | Yes | Nepal IRD Billing invoice ID returned when the original sale was created. |
| reason | string | Yes | Return, price adjustment, or cancellation reason for audit trail. |
| products | array | Yes | Lines being credited; quantities must not exceed the original sale. |
| payment_mode | enum | No | Refund channel if applicable; same codes as sales invoices. |
Examples
Sample JSON body
{
"customer_name": "Sharma Trading Pvt. Ltd.",
"customer_pan": "601234567",
"phone": "9800000000",
"payment_mode": "BA",
"external_reference": "ORD-2026-8842",
"products": [
{
"name": "LED Panel 24W",
"sku": "LED-24W",
"quantity": 4,
"unit_price": 1250,
"vat_rate": 13
}
],
"remarks": "Delivered to Baneshwor warehouse"
}cURL
curl -X POST "https://acme-traders.api.nepalirdbilling.com/v1/sales-invoices" \
-H "Content-Type: application/json" \
-H "X-API-Key: $NEPAL_IRD_BILLING_API_KEY" \
-d '{
"customer_name": "Sharma Trading Pvt. Ltd.",
"customer_pan": "601234567",
"phone": "9800000000",
"payment_mode": "BA",
"external_reference": "ORD-2026-8842",
"products": [
{
"name": "LED Panel 24W",
"sku": "LED-24W",
"quantity": 4,
"unit_price": 1250,
"vat_rate": 13
}
],
"remarks": "Delivered to Baneshwor warehouse"
}'fetch (Node / browser server routes)
const res = await fetch(
'https://acme-traders.api.nepalirdbilling.com/v1/sales-invoices',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': process.env.NEPAL_IRD_BILLING_API_KEY!,
},
body: JSON.stringify({
customer_name: 'Walk-in customer',
payment_mode: 'CA',
products: [{ name: 'Consulting hour', quantity: 1, unit_price: 5000 }],
}),
},
);
const data = await res.json();Success responses
A 201 Created response includes the invoice identity and totals:
{
"id": "8f3c2a1b-9d4e-4f5a-b6c7-d8e9f0a1b2c3",
"invoice_number": "2083/84-000124",
"status": "issued",
"cbms_status": "pending",
"total_amount": 5650,
"vat_amount": 650,
"issued_at": "2026-03-15T10:42:00+05:45",
"pdf_url": "https://acme-traders.api.nepalirdbilling.com/v1/sales-invoices/8f3c2a1b../pdf"
}cbms_status moves from pending to synced or surfaces IRD callback codes on the sync dashboard when transmission completes.
Notes
- Fiscal-year invoice numbering matches your workspace setting, the API does not accept arbitrary invoice numbers.
- VAT, buyer PAN rules, and line rounding follow the same configuration as the web POS.
- Never embed API keys in mobile apps or browser bundles; proxy through your backend.
- Configure allowed origins in Settings if you call the API from a dedicated integration subdomain; prefer server-to-server calls.
- Use
external_referenceto safely retry POSTs without duplicate bills where your integration supports idempotency.
FAQ
- Are API-created invoices IRD-aligned?
- Yes. API sales follow the same fiscal-year numbering, VAT breakdown, immutability rules, and CBMS transmission path as invoices created in the Nepal IRD Billing dashboard when CBMS sync is enabled on your plan.
- How do I get an API key?
- Workspace admins open Settings → API Keys in the dashboard, create a key, and copy the raw value immediately, it is shown only once. Store it in your server environment, not in client-side code.
- What can I build with the API?
- E-commerce checkouts, ERP shipment billing, franchise portals, mobile field-sales apps, and middleware that centralises orders before they become tax invoices, anything that should issue a compliant bill without manual re-entry.
- Which plans include API access?
- Sales invoice and credit-note endpoints are included on Pro CBMS and Enterprise. See pricing for user limits, branch rules, and CBMS requirements.
Ready to integrate?
Request API-enabled onboarding or discuss ERP mapping with our team.