Pull Stock Balance via API

Is it possible to GET request Stock Balance via api?

You will have to create a whitelisted method which returns the data from execute method in stock_balance.py

Is there an example of this?


def get_stock_balance_report(args):
    from erpnext.stock.report.stock_balance.stock_balance import execute
    return execute(args)

You can now GET request on hostname.com/api/method/your_app.api.get_stock_balance_report

1 Like


You can also get the actual_qty and projected_qty using get_bin_details method.

Although it will return stock balance for only single item, to fetch the stock balance for all items you will need to write the custom method as suggested by @netchampfaris

thanks i will try that

its not the best method i have tried Bin with the for loop even Stock Ledger Entry

I generally use erpnext.stock.utils.get_latest_stock_qty which is already a whitelist method.

url :
method: POST
pass this parameter in body

report_name:Stock Balance