> For the complete documentation index, see [llms.txt](https://kb.logicerp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/inventory/pull/get-delta-stock-in-hand.md). Agents can also search and read this documentation through its [MCP server](https://kb.logicerp.com/~gitbook/mcp).

# Get Delta Stock In Hand

Returns the **current stock in hand of the items whose stock may have changed** since a time you give. Logic ERP looks at the documents saved or edited since that time – purchases, sales, challans, orders, stock issues and receipts, godown and bin transfers – collects the items on them, and returns the **full current stock** of those items, in the same layout as [Get Stock In Hand](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/inventory/pull/get-stock-in-hand.md). Use it to keep a stock copy in your web store or app up to date without downloading all stock every time.

"Delta" means **which items** are returned, not what quantity: each record holds the item's whole stock now, not the difference since your last call. Replace the stock you hold for that item with the one you receive.

### **Endpoint**

| Name          | Detail                                   |
| ------------- | ---------------------------------------- |
| Address       | `https://your-server/api/GetStockInHand` |
| Method        | `POST`                                   |
| Authorization | Basic Auth                               |

The same address as Get Stock In Hand; `"StockType": "DELTA"` makes it a delta call. The response and the common request fields are explained in [How Every API Call Works](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/how-every-api-call-works.md). This endpoint does **not** use the change-log bookmark (`GlobalModifyCode`, `DateFrom`, `DateTo`, `Doc_Codes`, `Branch_Codes_From`, `Doc_Num_Like`); they are ignored, and `LastGlobalModifyCode` is always `0`. Your own bookmark is the time you send in `RequestDate`.

### **Request fields**

| Field                           | Type          | Required                                                                                                  | Default | Meaning                                                                                                                                                                                                                                                                                          |
| ------------------------------- | ------------- | --------------------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `StockType`                     | text          | Yes                                                                                                       | –       | `"DELTA"`, exactly, in capitals. Any other value (also `"delta"`) gives a normal Get Stock In Hand call.                                                                                                                                                                                         |
| `RequestDate`                   | date and time | Yes                                                                                                       | –       | The time from which changes are looked for, as `yyyy-MM-dd HH:mm`, for example `"2026-11-10 09:30"`, in Logic ERP's local time – the clock that stamps saved documents (to the minute), not UTC. Normally the time of your previous successful call. A date alone means midnight. See the rules. |
| `Branch_Codes`                  | text          | Yes, unless you send `BranchShortNames` or your Logic ERP team has set default branches for this endpoint | empty   | Branch codes separated by commas, for example `"2"`. Only documents of these branches are looked at, and only stock of these branches is returned. Numbers and commas only (spaces around each code are removed); anything else is refused.                                                      |
| `BranchShortNames`              | text          | No                                                                                                        | empty   | Branch short names separated by commas, for example `"LDH"` (spaces around each name are removed). Used only when `Branch_Codes` is empty, in its place.                                                                                                                                         |
| `Godown_Name`                   | text          | No                                                                                                        | empty   | Godown names separated by commas. Only stock in these godowns is returned (as in Get Stock In Hand: a name that is not a godown in Logic ERP refuses the request, and see its known issue about default godowns).                                                                                |
| `UseBinStock`                   | text          | No                                                                                                        | `"0"`   | `"1"` = return the stock kept by warehouse bin instead of the normal stock.                                                                                                                                                                                                                      |
| `DisplayError`                  | text          | No                                                                                                        | `"0"`   | `"1"` = the lookups made for the call are written to the server log, and technical detail is added to errors. For troubleshooting only.                                                                                                                                                          |
| `LogicUserCode`, `AddlItemCode` | text          | –                                                                                                         | –       | **Ignored.** The items are chosen by Logic ERP from the changed documents; you cannot narrow them to particular items.                                                                                                                                                                           |
| `DisplayZeroStockAlso`          | text          | –                                                                                                         | –       | **Ignored.** Zero stock is always returned here (see the rules).                                                                                                                                                                                                                                 |

Field names are matched without regard to upper or lower case. Other fields in the request are ignored.

### **Rules Logic ERP applies**

* **Which changes are looked at.** Every purchase document (purchase vouchers and returns, stock transfers in, stock receipts from production and of blank pieces), purchase challan, sale document (sale invoices and returns, stock transfers out), sale challan, sale order, delivery order, stock issue, stock receipt, godown transfer and bin transfer **saved or edited** since `RequestDate`, and every sale-order stock reservation made or released since `RequestDate`. The items on those documents are collected. Other documents that move stock – for example physical stock verification, issues for processing or production, and purchase rejections – are **not** looked at, so a change made only by them does not bring the item.
* **How far back.** Logic ERP looks at document changes from **two hours before** `RequestDate` (an overlap, so a document saved just before your last call is not missed), but never from before midnight at the start of the `RequestDate` day. Reservations are looked at from `RequestDate` itself. There is no upper limit on how far back you can go, but a long period makes the call slow and returns many items.
* **What is returned.** For every collected item, the full current stock in the requested branches, exactly as Get Stock In Hand calculates it (same financial year, same settings for godowns, lots, bins, pending orders and fields) – except that **zero stock is always included**: every stock record of the item (one per lot, godown or bin as your settings show them) is returned, with `Stock_Qty` `0` when it has no stock or is below zero. A minimum-stock filter in the stock settings does not leave records out here; a record below the minimum is returned with `Stock_Qty` `0`. An item that is on a changed document but has no stock record in the branch is not returned.
* **Branches.** Both `Branch_Codes` (or `BranchShortNames`) and the default branches your Logic ERP team may have set apply. A document counts for the branch it belongs to, so a transfer appears for the branch that sent it and, through the receiving document, for the branch that received it.
* **Warehouse bins.** Where the warehouse app is used, items in bins whose bin group was changed there are also returned, once (see the known issue).
* **No batches.** All records are returned in one answer.
* **Minimum interval between calls.** Your Logic ERP team can set a minimum number of minutes between delta calls for your API site. The limit is **shared by everyone using your API site** – all your integrations and users of that address – and also by Get Stock In Hand: the interval runs from the last **accepted** stock call of either kind, whoever made it. A call made sooner is refused with `You have already refreshed DELTA Stock … minutes ago. Refreshing of stock is allowed only at minimum interval of … minutes.` (`Status: false`; the minutes are rounded, so `0 minutes ago` is possible). A refused call does not restart the interval; an accepted call restarts it even if it then fails. The interval is kept in the server's memory and starts afresh when the Logic ERP API site restarts or is recycled; the first stock call after that is always accepted. When no interval is set, there is no limit. The general limit in seconds described in How Every API Call Works does not apply here.
* **Suggested use:** take a full copy once with Get Stock In Hand. Then call this endpoint regularly, each time with `RequestDate` = the Logic ERP time of your previous successful call, and replace the stock of each item you receive. Repeat the full copy from time to time (for example nightly) because of the limits above and the known issues below.

> **Known issue – deleted documents and removed lines are not seen.** When a document is deleted, or an item line is removed from a document, that item is not returned, because the item is looked for on the document as it is now. Its stock in your copy stays at the old figure until another document with that item changes, or until you take a full copy with Get Stock In Hand.

> **Known issue – bin-group changes are returned to the first caller only.** Items in bins whose bin group was changed in the warehouse app are added to the next successful delta call of **any** caller of your API site, whatever its `RequestDate`, and are then marked as sent for everyone – even when that call asked for other branches and so did not return them. If several systems use this endpoint on one API site, only one of them receives those items; the others should take a full copy with Get Stock In Hand after bin-group changes.

### **Example request**

Items changed in branch 2 since the previous call at 09:30:

```json
{
  "StockType": "DELTA",
  "RequestDate": "2026-11-10 09:30",
  "Branch_Codes": "2",
  "BranchShortNames": "",
  "Godown_Name": ""
}
```

### **Response fields**

The same as [Get Stock In Hand](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/inventory/pull/get-stock-in-hand.md) – each item in `GetData` is one stock record with `Branch_Code`, `Branch_Name`, `BranchShortName`, `Godown_Name`, `Godown_Code`, `LogicUserCode`, `AddlItemCode`, `Item_Name`, `Shade_Name`, `Pack_Name`, `Packing`, `Lot_Number`, `Lot_Code`, `Stock_Qty`, `Carton_Stock`, the lot and item rates, `Item_Cf_1` – `Item_Cf_3`, the lot dates and `Bin_Code` / `Bin_Name`, with the same meanings. Here `Stock_Qty` can be `0`.

### **Example response**

```json
{
  "GetData": [
    {
      "Branch_Code": 2,
      "Branch_Name": "LUDHIANA MAIN",
      "BranchShortName": "LDH",
      "Godown_Name": "",
      "LogicUserCode": "KUR-1001-M",
      "AddlItemCode": "8901234567012",
      "Item_Name": "COTTON KURTA BLUE",
      "Shade_Name": "BLUE",
      "Pack_Name": "M",
      "Lot_Number": "L-2604",
      "Lot_Code": 0,
      "Packing": "PCS",
      "Stock_Qty": 16.0,
      "Lot_Sale_Rate": 0.0,
      "Lot_Basic_Rate": 0.0,
      "Lot_MRP": 1499.0,
      "Lot_SPRate1": 0.0,
      "Lot_SPRate2": 0.0,
      "Lot_SPRate3": 0.0,
      "Lot_SPRate4": 0.0,
      "Item_Sale_Rate": 1200.0,
      "Item_MRP": 1499.0,
      "Carton_Stock": 0.0,
      "Godown_Code": 0,
      "Item_Cf_1": 1,
      "Item_Cf_2": 1,
      "Item_Cf_3": 1,
      "Lot_Pur_Date": null,
      "Lot_Expiry_Date": null,
      "Lot_Mfg_Date": null,
      "Bin_Code": 0,
      "Bin_Name": ""
    },
    {
      "Branch_Code": 2,
      "Branch_Name": "LUDHIANA MAIN",
      "BranchShortName": "LDH",
      "Godown_Name": "",
      "LogicUserCode": "KUR-1001-L",
      "AddlItemCode": "8901234567029",
      "Item_Name": "COTTON KURTA BLUE",
      "Shade_Name": "BLUE",
      "Pack_Name": "L",
      "Lot_Number": "L-2604",
      "Lot_Code": 0,
      "Packing": "PCS",
      "Stock_Qty": 0.0,
      "Lot_Sale_Rate": 0.0,
      "Lot_Basic_Rate": 0.0,
      "Lot_MRP": 1499.0,
      "Lot_SPRate1": 0.0,
      "Lot_SPRate2": 0.0,
      "Lot_SPRate3": 0.0,
      "Lot_SPRate4": 0.0,
      "Item_Sale_Rate": 1200.0,
      "Item_MRP": 1499.0,
      "Carton_Stock": 0.0,
      "Godown_Code": 0,
      "Item_Cf_1": 1,
      "Item_Cf_2": 1,
      "Item_Cf_3": 1,
      "Lot_Pur_Date": null,
      "Lot_Expiry_Date": null,
      "Lot_Mfg_Date": null,
      "Bin_Code": 0,
      "Bin_Name": ""
    }
  ],
  "Status": true,
  "Message": "",
  "LastGlobalModifyCode": 0,
  "resultSize": "2 KB"
}
```

### **Messages you may see**

| Message                                                                                                                                              | Meaning                                                                                                          | What to do                                                             |
| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| `Stock Not Found...` (with `Status: true`, `GetData` `null`)                                                                                         | No document with stock items changed in the period, or the changed items have no stock record in these branches. | Nothing has changed – keep your stock as it is.                        |
| `You have already refreshed DELTA Stock … minutes ago. Refreshing of stock is allowed only at minimum interval of … minutes.` (with `Status: false`) | A stock call was accepted for your API site (by you or anyone else) less than the set interval ago.              | Wait at least the interval and call again with the same `RequestDate`. |
| `Request date not specified.. Please Check..` (with `Status: false`)                                                                                 | `RequestDate` is missing, `null` or not a date.                                                                  | Send `RequestDate` as `yyyy-MM-dd HH:mm`.                              |
| `Branch not defined for Get Stock Hand..Please Check..(…)` (with `Status: false`; a number in place of …)                                            | Changed items were found, but neither a branch nor default branches were given.                                  | Send `Branch_Codes`.                                                   |
| `Unable to found Branch Short Name : …` (with `Status: false`; the name in place of …)                                                               | A name in `BranchShortNames` does not exist.                                                                     | Send existing short names, separated by commas.                        |
| `Godown not found : …` (with `Status: false`; the unknown names in place of …)                                                                       | Changed items were found, and a name in `Godown_Name` is not a godown in Logic ERP.                              | Send godown names exactly as in Logic ERP.                             |
| `Invalid code in list: '…'. Only numeric codes are allowed.` (with `Status: false`; your entry in place of …)                                        | An entry in `Branch_Codes` is not a number.                                                                      | Send branch codes as numbers separated by commas.                      |
| `No valid numeric code supplied.` (with `Status: false`)                                                                                             | `Branch_Codes` holds only spaces or commas.                                                                      | Send branch codes, or leave the field out.                             |
| `API settings for this route are not configured for the API template.` (with `Status: false`)                                                        | The stock settings have not been saved for your API site.                                                        | Ask your Logic ERP support team.                                       |
| `Request cannot be processed. API Template is marked as In-Active in the configuration.` (with `Status: false`)                                      | The stock endpoint is switched off for your API site.                                                            | Ask your Logic ERP support team.                                       |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/inventory/pull/get-delta-stock-in-hand.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
