Document

Create a document

Changed on

v1 is deprecated — use the v2 endpoint instead. Creates a document — an invoice, purchase, estimate, return, delivery challan, or subscription — based on document_type. Unknown party and items IDs are created automatically from the details you send; existing IDs are reused. Returns the document's hash_id, which addresses the document in every subsequent call, plus the IRN and QR code when einvoice is set. Send your own serial_number to make retries safe — a duplicate fails with DUPLICATE_DOC_SERIAL_NUMBER instead of creating a second document.

post/v1/doc

Request

  • Base URL
    https://app.getswipe.in/api/partner
  • URL
    https://app.getswipe.in/api/partner/v1/doc
  • Auth
    HTTP bearer

Request body

serial_numberstring

Serial Number, if not sent will be auto generated based on the default prefix.

document_type'invoice' | 'subscription' | 'pro_forma_invoice' | 'estimate' | 'sales_return' | 'purchase_return' required

Type of document to create. One of the enum values listed below; use 'invoice' for a standard GST invoice.

document_datestring required

DD-MM-YYYY, Invoice date (Ex: 11-06-2024 Need not to the current date)

due_datestring

DD-MM-YYYY, Payment Due date for the invoice (Ex: 11-06-2024)

referencestring

Any references you want to add to the doc

notesstring

Notes to show in invoice

termsstring

Terms to show in invoice

extra_discountnumber

Adjustment on overall invoice, doesn’t effect any tax amounts.

round_offboolean

Should Round Off total amount

tds_idinteger
tcs_idinteger
is_subscriptionboolean

Is Subscription

einvoiceboolean

Generate einvoice

is_exportboolean

Is Export

Example request

{
  "serial_number": "INV123",
  "document_type": "invoice",
  "document_date": "11-06-2024",
  "customer": {
    "id": "CUST123",
    "name": "John Doe",
    "country_code": "91",
    "phone_number": "1234567890",
    "company_name": "Company Name",
    "email": "johndoe@example.com",
    "gstin": "27AARCS7202C1ZD"
  },
  "party": {
    "id": "CUST123",
    "type": "customer",
    "name": "John Doe",
    "country_code": "91",
    "phone_number": "1234567890",
    "company_name": "Company Name",
    "email": "johndoe@example.com",
    "gstin": "27AARCS7202C1ZD"
  },
  "due_date": "11-06-2024",
  "reference": "Reference Text",
  "notes": "Notes for the document",
  "terms": "Terms and Conditions",
  "items": [
    {
      "id": "ITEM123",
      "name": "Item Name",
      "quantity": 1,
      "unit_price": 100,
      "tax_rate": 18,
      "price_with_tax": 118,
      "net_amount": 100,
      "total_amount": 118,
      "discount_percent": 10,
      "discount_amount": 10,
      "description": "Item Description",
      "hsn_code": "1234",
      "item_type": "Product",
      "unit": "kg",
      "category": "Electronics"
    }
  ],
  "extra_discount": 20,
  "round_off": true,
  "payments": [
    {
      "amount": 100,
      "method": "upi",
      "notes": "Payment notes"
    }
  ],
  "bank_details": {
    "account_number": "1234567890",
    "ifsc": "SBIN0000001",
    "bank_name": "State Bank of India",
    "branch": "Mumbai"
  },
  "company_shipping_address": {
    "address_line1": "123 Street",
    "address_line2": "Apt 4B",
    "city": "City Name",
    "state": "State Name",
    "country": "Country Name",
    "pincode": "123456"
  },
  "customer_shipping_address": {
    "address_line1": "123 Street",
    "address_line2": "Apt 4B",
    "city": "City Name",
    "state": "State Name",
    "country": "Country Name",
    "pincode": "123456"
  },
  "customer_billing_address": {
    "address_line1": "123 Street",
    "address_line2": "Apt 4B",
    "city": "City Name",
    "state": "State Name",
    "country": "Country Name",
    "pincode": "123456"
  },
  "subscription_details": {
    "start_time": "14-02-2024",
    "end_time": "14-02-2025",
    "repeat": 1,
    "repeat_type": "days"
  },
  "export_invoice_details": {
    "export_type": "With Payment of Tax",
    "country_id": "Afghanistan"
  }
}

Response

Success

successboolean

Success

messagestring

Message

serialNumberstring

Serial Number

hashIdstring

Hash ID

Example response

{
  "success": true,
  "message": "Document created successfully",
  "serialNumber": "SL123",
  "hashId": "SL123"
}

Changes