Detailed reference for POST /api/web/invoice/create-invoice. Use the interactive API playground to send test requests.

Endpoint

POST https://api.billclap.com/api/web/invoice/create-invoice
Your BillClap plan must include the API integration feature. See Authentication.

Authentication

Include your API token on every request:
HeaderValue
Content-Typeapplication/json
x-api-tokenYour API token from Settings → API Integration
Do not use Authorization: Bearer for this endpoint.

Request body

Top-level fields

FieldTypeRequiredDescription
typestringYesDocument type. Common values: SALESINVOICE, QUOTATION, SALESRETURN, PURCHASEBILL, PURCHASERETURN, DELIVERYCHALLAN, ORDER, PURCHASEORDER, SELLORDER, SALEORDER.
issue_datestringRecommendedInvoice issue date (stored on the invoice record).
due_datestringOptionalPayment due date.
invoice_numberstring | numberOptionalCustom invoice number. If omitted, the next number from invoice settings (with optional prefix) is used. Must be unique for the firm.
receive_amountnumberOptionalAmount received against the invoice. Used for payment-in/out and paid/partial status. Cannot exceed calculated total_amount.
bank_idnumberOptionalBank account to record payment against. Defaults to the business default bank; a cash bank is created if none exists.
party_detailobjectYesCustomer or supplier details. See Party detail.
product_detailsarrayYesLine items. At least one entry with product_name is expected. See Product details.
additional_chargesarrayOptionalExtra charges with tax. See Additional charges.
additional_discountnumberOptionalInvoice-level discount applied before totals are finalized.
autoRoundOffCheckedbooleanOptionalWhen true, rounds total_amount to the nearest integer and sets roundOffAmount.
is_bill_of_supplybooleanOptionalWhen true, marks the invoice as bill of supply ('1'), otherwise '0'.
is_txn_wise_tax_enabledstringOptionalTransaction-wise tax flag ('0' or '1').
txn_wise_tax_pctstringOptionalTransaction-wise tax percentage when enabled.
paymentIn_idnumberOptionalExisting payment record id when upserting a linked payment.
convert_invoice_idnumberOptionalSource invoice id when converting documents (inventory).

Party detail

Either link an existing party or create/match one by mobile number or cash sale.
FieldTypeRequiredDescription
party_idnumberConditionalExisting party id in your business. If valid, other fields are optional.
party_namestringRecommendedDisplay name; used when creating a new party.
mobile_nostringConditionalRequired when creating/finding a party unless cash_sale is used.
cash_salebooleanConditionalUse the cash-sale party instead of mobile lookup. Sets received amount to full total when used with calculation flags.
gst_nostringOptionalGSTIN.
addressstringOptionalBilling address line.
citystringOptionalBilling city.
statestringOptionalBilling state.
countrystringOptionalBilling country.
pin_codestringOptionalBilling PIN code.
Validation rules enforced by the API:
  • party_detail must be a non-empty object.
  • If party_id does not resolve to a party, either mobile_no or cash_sale is required.
  • New parties are created as CUSTOMER for sales documents and SUPPLIER for purchase types (PURCHASEBILL, PURCHASERETURN, PURCHASEORDER).

Product details

Each element describes one line item. Entries without product_name are skipped.
FieldTypeRequiredDescription
product_idnumberOptionalExisting product id. If set, product is loaded from catalog.
product_namestringYes*Product name. Used to match existing catalog product or create a new one.
product_sell_pricenumberConditionalRequired when creating a new product. Unit price.
product_gstnumberConditionalRequired when creating a new product. GST rate (e.g. 18).
product_sell_price_tax_typestringOptionalWith Tax (default) or Without Tax.
product_hsnstringOptionalHSN/SAC code.
product_quantitynumberOptionalQuantity (default 1).
discount_typestringOptionalRS (default) for fixed rupee discount per unit, or percentage when not RS.
product_discountnumberOptionalDiscount amount or percentage per line rules (default 0).
product_descriptionstringOptionalLine description.
*Required on at least one line item you intend to bill. When no catalog match exists, the API creates a product using product_sell_price and product_gst. Purchase documents (PURCHASEBILL, PURCHASERETURN) use purchase pricing logic; others use sales pricing.

Additional charges

FieldTypeRequiredDescription
chargeNamestringYesLabel for the charge.
chargeValuenumberYesTaxable charge amount before GST on the charge.
taxnumberYesTax rate percent on the charge.
hsn_codestringOptionalHSN for the charge.
Only items with both chargeValue and tax are included in totals.

Example request

curl -X POST 'https://api.billclap.com/api/web/invoice/create-invoice' \
  -H 'Content-Type: application/json' \
  -H 'x-api-token: YOUR_API_TOKEN' \
  -d '{
    "type": "SALESINVOICE",
    "issue_date": "2026-07-01",
    "due_date": "2026-07-15",
    "receive_amount": 1180,
    "party_detail": {
      "party_name": "Acme Traders",
      "mobile_no": "9876543210",
      "gst_no": "29ABCDE1234F1Z5",
      "address": "123 MG Road",
      "city": "Bengaluru",
      "state": "Karnataka",
      "country": "India",
      "pin_code": "560001"
    },
    "product_details": [
      {
        "product_name": "Consulting Service",
        "product_sell_price": 1000,
        "product_sell_price_tax_type": "With Tax",
        "product_gst": 18,
        "product_hsn": "998314",
        "product_quantity": 1
      }
    ],
    "additional_charges": [
      {
        "chargeName": "Packaging",
        "chargeValue": 50,
        "tax": 18,
        "hsn_code": "9985"
      }
    ]
  }'

Success response

HTTP 200 OK
{
  "result": {
    "status": true,
    "message": "Invoice created successfully",
    "invoice_id": 12345,
    "link": "https://app.billclap.com/preview/12345/abc123token",
    "code": 200
  }
}
FieldDescription
result.invoice_idInternal BillClap invoice id.
result.linkShareable preview URL for the created document.
result.messageHuman-readable success message.
result.codeApplication status code (200 on success).

Error responses

Authentication and plan (before handler)

HTTPBodyCause
401{ "status": false, "message": "API token is required" }Missing x-api-token header.
401{ "status": false, "message": "Invalid token type" }Token is not an API integration token.
401{ "status": false, "message": "<jwt error>" }Expired, invalid, or tampered token.
200{ "status": false, "error": "You don't have permission to access this resource: API integration", "message": "..." }Plan does not include API integration.

Validation and business errors (handler)

When invoice creation fails inside the transaction, the API responds with HTTP 500 and:
{
  "status": false,
  "error": "<error message>"
}
Common error values returned from invoice creation:
MessageTypical cause
Credits Expired!!!Invoice credit quota exhausted for the user.
Business not foundToken business is missing or inactive.
Party detail is requiredMissing or empty party_detail.
Mobile number or cash sale is requiredNo valid party_id, and neither mobile_no nor cash_sale provided.
Product name is requiredLine item missing product identity when required.
Product sell price and gst is requiredNew product creation without price or GST.
Invoice number already existsDuplicate invoice_number for the firm.
Received amount can not be greater than invoice total amountreceive_amount exceeds calculated total.
Other failures (database, inventory, or unexpected errors) also return HTTP 500 with error set to the underlying message.

Behavior notes

  • Totals (taxable_amount, total_tax, total_discount, total_amount) are computed server-side from line items, additional charges, and optional invoice-level discount; you do not send final totals.
  • Default warehouse, invoice settings (prefix, sequence, notes, terms), and default signature are applied from the business configuration.
  • For most document types except quotations, purchase orders, and delivery challans, inventory and ledger entries are created automatically.
  • SMS/WhatsApp notifications may be sent according to business reminder settings when a mobile number is present.