{
    "info": {
        "name": "HishabBook API v1",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
        "description": "Set the variables base_url and api_key. Docs: https://hishabbook.com/developers"
    },
    "auth": {
        "type": "bearer",
        "bearer": [
            {
                "key": "token",
                "value": "{{api_key}}",
                "type": "string"
            }
        ]
    },
    "variable": [
        {
            "key": "base_url",
            "value": "https://hishabbook.com/api/v1"
        },
        {
            "key": "api_key",
            "value": ""
        }
    ],
    "item": [
        {
            "name": "Account",
            "description": "Check a key and see which business it belongs to.",
            "item": [
                {
                    "name": "Who am I",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/me",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "me"
                            ],
                            "query": []
                        },
                        "description": "The business, the key's permissions and the rate limit. Use it as a \"test connection\" call."
                    }
                }
            ]
        },
        {
            "name": "Parties",
            "description": "Customers and suppliers. \"balance\": positive = they owe you (to collect), negative = you owe them (to pay).",
            "item": [
                {
                    "name": "List parties",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/parties",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "parties"
                            ],
                            "query": [
                                {
                                    "key": "q",
                                    "value": "",
                                    "description": "string. Search name, phone or GSTIN",
                                    "disabled": true
                                },
                                {
                                    "key": "type",
                                    "value": "",
                                    "description": "customer | supplier. Filter",
                                    "disabled": true
                                },
                                {
                                    "key": "page",
                                    "value": "",
                                    "description": "integer. Page number, from 1",
                                    "disabled": true
                                },
                                {
                                    "key": "per_page",
                                    "value": "",
                                    "description": "integer. 1 to 100 (default 25)",
                                    "disabled": true
                                },
                                {
                                    "key": "updated_since",
                                    "value": "",
                                    "description": "ISO date-time. Only records changed since then (for syncing)",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "Sorted by name.\n\nNeeds permission: read"
                    }
                },
                {
                    "name": "Get a party",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/parties/:id",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "parties",
                                ":id"
                            ],
                            "query": []
                        },
                        "description": "Needs permission: read"
                    }
                },
                {
                    "name": "Create a party",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/parties",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "parties"
                            ],
                            "query": []
                        },
                        "description": "For a registered party the state is taken from the GSTIN.\n\nNeeds permission: parties.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"name\": \"Gupta Traders\",\n    \"type\": \"customer\",\n    \"gstin\": \"19ABCDE1234F1Z5\",\n    \"phone\": \"9800000000\",\n    \"credit_days\": 15\n}"
                        }
                    }
                },
                {
                    "name": "Update a party",
                    "request": {
                        "method": "PATCH",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/parties/:id",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "parties",
                                ":id"
                            ],
                            "query": []
                        },
                        "description": "Send only the fields to change.\n\nNeeds permission: parties.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"phone\": \"9811111111\",\n    \"credit_limit\": 75000\n}"
                        }
                    }
                }
            ]
        },
        {
            "name": "Items",
            "description": "Goods and services. Prices are stored without GST; \"sale_price_incl_tax\" is given for convenience.",
            "item": [
                {
                    "name": "List items",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/items",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "items"
                            ],
                            "query": [
                                {
                                    "key": "q",
                                    "value": "",
                                    "description": "string. Search name, code or HSN",
                                    "disabled": true
                                },
                                {
                                    "key": "category",
                                    "value": "",
                                    "description": "string",
                                    "disabled": true
                                },
                                {
                                    "key": "type",
                                    "value": "",
                                    "description": "goods | service",
                                    "disabled": true
                                },
                                {
                                    "key": "low_stock",
                                    "value": "",
                                    "description": "boolean. Only items at or below their low-stock level",
                                    "disabled": true
                                },
                                {
                                    "key": "page",
                                    "value": "",
                                    "description": "integer. Page number, from 1",
                                    "disabled": true
                                },
                                {
                                    "key": "per_page",
                                    "value": "",
                                    "description": "integer. 1 to 100 (default 25)",
                                    "disabled": true
                                },
                                {
                                    "key": "updated_since",
                                    "value": "",
                                    "description": "ISO date-time. Only records changed since then (for syncing)",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "Needs permission: read"
                    }
                },
                {
                    "name": "Get an item",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/items/:id",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "items",
                                ":id"
                            ],
                            "query": []
                        },
                        "description": "Needs permission: read"
                    }
                },
                {
                    "name": "Create an item",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/items",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "items"
                            ],
                            "query": []
                        },
                        "description": "Needs permission: items.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"name\": \"Basmati Rice 5kg\",\n    \"unit\": \"BAG\",\n    \"sale_price\": 472.5,\n    \"price_includes_tax\": true,\n    \"gst_rate\": 5,\n    \"hsn\": \"1006\",\n    \"opening_stock\": 40\n}"
                        }
                    }
                },
                {
                    "name": "Update an item",
                    "request": {
                        "method": "PATCH",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/items/:id",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "items",
                                ":id"
                            ],
                            "query": []
                        },
                        "description": "Send only the fields to change. Stock is changed with the stock endpoint.\n\nNeeds permission: items.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"sale_price\": 460\n}"
                        }
                    }
                },
                {
                    "name": "Change stock",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/items/:id/stock",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "items",
                                ":id",
                                "stock"
                            ],
                            "query": []
                        },
                        "description": "Add (positive) or remove (negative) stock by hand.\n\nNeeds permission: items.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"change\": 10\n}"
                        }
                    }
                }
            ]
        },
        {
            "name": "Sales invoices",
            "description": "Totals and GST (CGST + SGST or IGST) are always worked out by HishabBook from the lines.",
            "item": [
                {
                    "name": "List invoices",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/invoices",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "invoices"
                            ],
                            "query": [
                                {
                                    "key": "from",
                                    "value": "",
                                    "description": "YYYY-MM-DD. Bill date from",
                                    "disabled": true
                                },
                                {
                                    "key": "to",
                                    "value": "",
                                    "description": "YYYY-MM-DD. Bill date to",
                                    "disabled": true
                                },
                                {
                                    "key": "party_id",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                },
                                {
                                    "key": "type",
                                    "value": "",
                                    "description": "invoice | credit_note",
                                    "disabled": true
                                },
                                {
                                    "key": "cancelled",
                                    "value": "",
                                    "description": "boolean",
                                    "disabled": true
                                },
                                {
                                    "key": "q",
                                    "value": "",
                                    "description": "string. Search bill number",
                                    "disabled": true
                                },
                                {
                                    "key": "page",
                                    "value": "",
                                    "description": "integer. Page number, from 1",
                                    "disabled": true
                                },
                                {
                                    "key": "per_page",
                                    "value": "",
                                    "description": "integer. 1 to 100 (default 25)",
                                    "disabled": true
                                },
                                {
                                    "key": "updated_since",
                                    "value": "",
                                    "description": "ISO date-time. Only records changed since then (for syncing)",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "Newest first. Includes credit notes / sales returns unless you filter by type.\n\nNeeds permission: read"
                    }
                },
                {
                    "name": "Get an invoice",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/invoices/:id",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "invoices",
                                ":id"
                            ],
                            "query": []
                        },
                        "description": "With lines.\n\nNeeds permission: read"
                    }
                },
                {
                    "name": "Invoice PDF",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/invoices/:id/pdf",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "invoices",
                                ":id",
                                "pdf"
                            ],
                            "query": []
                        },
                        "description": "The bill in the business's chosen design. Add ?download=1 to download.\n\nNeeds permission: read"
                    }
                },
                {
                    "name": "Create an invoice",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/invoices",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "invoices"
                            ],
                            "query": []
                        },
                        "description": "Stock goes down for goods that keep stock. A line can be just item_id + qty: name, HSN, unit, price and GST come from the item. Without party_id it is a cash sale and is marked fully paid.\n\nNeeds permission: invoices.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"party_id\": 12,\n    \"items\": [\n        {\n            \"item_id\": 5,\n            \"qty\": 2\n        },\n        {\n            \"description\": \"Packing charge\",\n            \"qty\": 1,\n            \"price\": 20,\n            \"gst_rate\": 18\n        }\n    ],\n    \"payment\": {\n        \"amount\": 500,\n        \"mode\": \"UPI\"\n    }\n}"
                        }
                    }
                },
                {
                    "name": "Cancel an invoice",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/invoices/:id/cancel",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "invoices",
                                ":id",
                                "cancel"
                            ],
                            "query": []
                        },
                        "description": "Stock comes back. A bill with an IRN must have its IRN cancelled first (in the app).\n\nNeeds permission: invoices.write"
                    }
                }
            ]
        },
        {
            "name": "Payments",
            "description": "Payment In (from customers) and Payment Out (to suppliers).",
            "item": [
                {
                    "name": "List payments",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/payments",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "payments"
                            ],
                            "query": [
                                {
                                    "key": "direction",
                                    "value": "",
                                    "description": "in | out",
                                    "disabled": true
                                },
                                {
                                    "key": "party_id",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                },
                                {
                                    "key": "invoice_id",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                },
                                {
                                    "key": "from",
                                    "value": "",
                                    "description": "YYYY-MM-DD",
                                    "disabled": true
                                },
                                {
                                    "key": "to",
                                    "value": "",
                                    "description": "YYYY-MM-DD",
                                    "disabled": true
                                },
                                {
                                    "key": "page",
                                    "value": "",
                                    "description": "integer. Page number, from 1",
                                    "disabled": true
                                },
                                {
                                    "key": "per_page",
                                    "value": "",
                                    "description": "integer. 1 to 100 (default 25)",
                                    "disabled": true
                                },
                                {
                                    "key": "updated_since",
                                    "value": "",
                                    "description": "ISO date-time. Only records changed since then (for syncing)",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "Needs permission: read"
                    }
                },
                {
                    "name": "Get a payment",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/payments/:id",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "payments",
                                ":id"
                            ],
                            "query": []
                        },
                        "description": "Needs permission: read"
                    }
                },
                {
                    "name": "Record a payment",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/payments",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "payments"
                            ],
                            "query": []
                        },
                        "description": "Settles the given bill first, then the party's oldest unpaid bills; what is left stays as an advance. Returns one row per bill settled.\n\nNeeds permission: payments.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"direction\": \"in\",\n    \"party_id\": 12,\n    \"amount\": 500,\n    \"mode\": \"UPI\",\n    \"invoice_id\": 101,\n    \"reference\": \"UTR 4521\"\n}"
                        }
                    }
                }
            ]
        },
        {
            "name": "Purchases",
            "description": "Supplier bills (stock goes up), purchase returns and debit notes.",
            "item": [
                {
                    "name": "List purchases",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/purchases",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "purchases"
                            ],
                            "query": [
                                {
                                    "key": "from",
                                    "value": "",
                                    "description": "YYYY-MM-DD",
                                    "disabled": true
                                },
                                {
                                    "key": "to",
                                    "value": "",
                                    "description": "YYYY-MM-DD",
                                    "disabled": true
                                },
                                {
                                    "key": "party_id",
                                    "value": "",
                                    "description": "integer",
                                    "disabled": true
                                },
                                {
                                    "key": "type",
                                    "value": "",
                                    "description": "bill | purchase_return | debit_note",
                                    "disabled": true
                                },
                                {
                                    "key": "page",
                                    "value": "",
                                    "description": "integer. Page number, from 1",
                                    "disabled": true
                                },
                                {
                                    "key": "per_page",
                                    "value": "",
                                    "description": "integer. 1 to 100 (default 25)",
                                    "disabled": true
                                },
                                {
                                    "key": "updated_since",
                                    "value": "",
                                    "description": "ISO date-time. Only records changed since then (for syncing)",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "Needs permission: read"
                    }
                },
                {
                    "name": "Get a purchase",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/purchases/:id",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "purchases",
                                ":id"
                            ],
                            "query": []
                        },
                        "description": "With lines.\n\nNeeds permission: read"
                    }
                },
                {
                    "name": "Create a purchase bill",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/purchases",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "purchases"
                            ],
                            "query": []
                        },
                        "description": "Lines work like invoice lines; with only item_id the item's purchase price is used.\n\nNeeds permission: purchases.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"party_id\": 14,\n    \"number\": \"SUP/889\",\n    \"items\": [\n        {\n            \"item_id\": 5,\n            \"qty\": 20,\n            \"price\": 400\n        }\n    ]\n}"
                        }
                    }
                }
            ]
        },
        {
            "name": "Reports",
            "description": "Read-only summaries.",
            "item": [
                {
                    "name": "Business summary",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/reports/summary",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "reports",
                                "summary"
                            ],
                            "query": [
                                {
                                    "key": "from",
                                    "value": "",
                                    "description": "YYYY-MM-DD. Default 1st of this month",
                                    "disabled": true
                                },
                                {
                                    "key": "to",
                                    "value": "",
                                    "description": "YYYY-MM-DD. Default today",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "Sales, returns, purchases, expenses, money in/out for a period, and today's to-collect / to-pay.\n\nNeeds permission: read"
                    }
                },
                {
                    "name": "Outstanding by party",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/reports/outstanding",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "reports",
                                "outstanding"
                            ],
                            "query": [
                                {
                                    "key": "side",
                                    "value": "",
                                    "description": "collect | pay",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "Parties with a balance, biggest first.\n\nNeeds permission: read"
                    }
                },
                {
                    "name": "Stock",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/reports/stock",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "reports",
                                "stock"
                            ],
                            "query": []
                        },
                        "description": "Items that keep stock, with value at purchase price.\n\nNeeds permission: read"
                    }
                },
                {
                    "name": "GSTR-1 JSON",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/reports/gstr1",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "reports",
                                "gstr1"
                            ],
                            "query": [
                                {
                                    "key": "month",
                                    "value": "",
                                    "description": "YYYY-MM, required",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "Same JSON as the GSTR-1 download in the app. Check with your CA before filing.\n\nNeeds permission: read"
                    }
                }
            ]
        }
    ]
}