> 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/masters/pull/get-branch-+-party-+-item-defaults.md).

# Get Branch + Party + Item Defaults

Returns the **party + item wise defaults** set up in Logic ERP for one **branch**. A default is a set of terms agreed with a particular customer (party) for a particular item at that branch – for example *"at the Ludhiana branch, Shree Ganesh Traders gets 2% cash discount and 5% trade discount on Tea 500 g, at a rate of ₹ 245"*. When that party is billed for that item at that branch, Logic ERP fills these values into the bill automatically. Use this endpoint to give your ordering or billing system the same terms as a starting point. Some settings that also affect the bill are not returned (see Rules).

For defaults set for a whole **item group** rather than single items, use Get Branch + Party + Item Group Defaults.

### **Endpoint**

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

The response envelope is 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 common request fields (`GlobalModifyCode`, `DateFrom`, `DateTo`, `Doc_Codes`, `Branch_Codes_From`, `Doc_Num_Like`); it has its own request, below. Every call returns the current defaults; `LastGlobalModifyCode` is always `0`.

### **Request fields**

| Field           | Type   | Required | Default | Meaning                                                                                                                                                                                                  |
| --------------- | ------ | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `BranchCode`    | number | Yes      | `0`     | The branch whose defaults you want (Logic ERP's branch number). If you leave it out, `0` is used.                                                                                                        |
| `ListCustomers` | list   | No       | empty   | The parties you want, each with the items you want. Leave it empty to ask for every party that has defaults at the branch – but see Known limitations; we recommend always listing the parties you want. |

**`ListCustomers`** – one entry per party:

| Field                      | Type         | Required | Default | Meaning                                                                                                                                                               |
| -------------------------- | ------------ | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CustomerCode`             | text         | Yes      | —       | The party code as shown in Logic ERP, for example `"C1045"`. Capitals and small letters are treated alike.                                                            |
| `ListItems`                | list of text | No       | empty   | The items you want, by item code (or by barcode, see next field), for example `["TEA-500", "TEA-250"]`. Leave empty for all items that have a default for this party. |
| `UseEANItemCodeAsItemCode` | true / false | No       | `false` | `true` when `ListItems` holds the items' **barcode / EAN codes** instead of item codes.                                                                               |
| `ItemGroupNames`           | text         | No       | —       | Not used by this endpoint.                                                                                                                                            |

### **Rules Logic ERP applies**

* Only defaults set for a **named party and a single item** are returned. Defaults that Logic ERP keeps for **all parties** or for a **party group** at the branch, and defaults for item groups, are not returned, although they also affect the bill.
* The branch must have at least one single-item default (for a party, a party group or all parties), otherwise the call fails (see Messages).
* Each party you list must exist, and each item you list must exist. One wrong code makes the **whole call fail** – nothing is returned for the other parties.
* Each party you list must have at least one default at the branch (for the items you listed, when you listed some). Otherwise the whole call fails.
* An item you list that exists but has no default for that party is simply left out.
* An item code or barcode kept on more than one item counts for all of them: the defaults of each such item come back as separate entries in `ListItems`.
* Listing the same item twice returns it once. Listing the same party twice returns its items twice, inside the same party entry.
* Parties and items come in no particular order.
* Two settings that the bill uses are not returned: a price expression on the default (when one is set, the bill does not use `Rate`), and the adjustment per item.
* The call has succeeded when `GetData` is not `null`.

### **Known limitations**

* **An empty `ListCustomers` returns only parties with defaults of their own.** Each such party comes back once, with its items. If the branch has only defaults for "all parties" or for a party group, the answer has `Status: true` and an empty `Customers` list. We recommend sending the parties you want.
* **An empty `ListCustomers` can return a very large answer** at a branch with many parties. Send the parties you want.
* **`LabourIn` and `LabourType` (and `AdjustIn` and `AdjustType`) do not carry what their names say.** `LabourIn` holds the *labour type* (`Use Zero` / `Ignore Zero`). `LabourType` holds `Ignore Zero` when labour is per unit and `Use Zero` for any other basis, so the actual basis cannot be read from it. The same applies to the adjust fields.
* **`Net_Rate` is not a rate.** It is the "rate type": `-1` = *Use Zero* for `Rate`, `0` = *Ignore Zero*. The bill does not use it: a `Rate` of `0` is never applied.

### **What "Use Zero" and "Ignore Zero" mean**

Each value comes with a type. When the value is **more than zero**, the bill uses it. When the value is **zero**:

* **Use Zero** – the bill uses zero (for example: no cash discount for this party on this item).
* **Ignore Zero** – the zero means "not set here", and Logic ERP takes the value from its next setting (for example the party's item-group default or the item's own default).

### **Example request**

```json
{
  "BranchCode": 2,
  "ListCustomers": [
    {
      "CustomerCode": "C1045",
      "UseEANItemCodeAsItemCode": false,
      "ListItems": ["TEA-500", "TEA-250"]
    }
  ]
}
```

### **Test it**

Send a request to the Logic ERP **sandbox** (a test company) from this page: open the block below, enter the sandbox user name and password (ask your Logic ERP support team), change the request if you like, and press **Test it**. Always list the parties you want in `ListCustomers` (see the known issues on this page).

## Get Branch + Party + Item Defaults

> Returns the party + item wise defaults set up in Logic ERP for one branch. A default is a set of terms agreed with a particular customer (party) for a particular item at that branch – for example "at the Ludhiana branch, Shree Ganesh Traders gets 2% cash discount and 5% trade discount on Tea 500 g, at a rate of ₹ 245". When that party is billed for that item at that branch, Logic ERP fills these values into the bill automatically. Use this endpoint to give your ordering or billing system the same terms as a starting point. Some settings that also affect the bill are not returned (see Rules).

```json
{"openapi":"3.0.3","info":{"title":"Logic ERP API","version":"1.0"},"tags":[{"name":"Masters - Pull"}],"servers":[{"url":"https://demo.logicerp.com/api","description":"Logic ERP sandbox (test company)"}],"security":[{"basicAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic","description":"The user name and password of your API site."}}},"paths":{"/GetBranchPartyItemDefaults":{"post":{"tags":["Masters - Pull"],"operationId":"GetBranchPartyItemDefaults","summary":"Get Branch + Party + Item Defaults","description":"Returns the party + item wise defaults set up in Logic ERP for one branch. A default is a set of terms agreed with a particular customer (party) for a particular item at that branch – for example \"at the Ludhiana branch, Shree Ganesh Traders gets 2% cash discount and 5% trade discount on Tea 500 g, at a rate of ₹ 245\". When that party is billed for that item at that branch, Logic ERP fills these values into the bill automatically. Use this endpoint to give your ordering or billing system the same terms as a starting point. Some settings that also affect the bill are not returned (see Rules).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"BranchCode":{"type":"integer","description":"The branch whose defaults you want (Logic ERP's branch number). If you leave it out, `0` is used."},"ListCustomers":{"type":"array","items":{"type":"object","properties":{"CustomerCode":{"type":"string","description":"The party code as shown in Logic ERP, for example `\"C1045\"`. Capitals and small letters are treated alike."},"UseEANItemCodeAsItemCode":{"type":"boolean","description":"`true` when `ListItems` holds the items' barcode / EAN codes instead of item codes."},"ListItems":{"type":"array","items":{"type":"string"},"description":"The items you want, by item code (or by barcode, see next field), for example `[\"TEA-500\", \"TEA-250\"]`. Leave empty for all items that have a default for this party."}}},"description":"The parties you want, each with the items you want. Leave it empty to ask for every party that has defaults at the branch – but see Known limitations; we recommend always listing the parties you want."},"CustomerCode":{"type":"string","description":"The party code as shown in Logic ERP, for example `\"C1045\"`. Capitals and small letters are treated alike."},"ListItems":{"type":"string","description":"The items you want, by item code (or by barcode, see next field), for example `[\"TEA-500\", \"TEA-250\"]`. Leave empty for all items that have a default for this party."},"UseEANItemCodeAsItemCode":{"type":"boolean","description":"`true` when `ListItems` holds the items' barcode / EAN codes instead of item codes."},"ItemGroupNames":{"type":"string","description":"Not used by this endpoint."}},"required":["BranchCode","CustomerCode"]}}}},"responses":{"200":{"description":"Always HTTP 200. Check Status, Message and GetData.","content":{"application/json":{"schema":{"type":"object","properties":{"GetData":{"type":"object","properties":{"BranchCode":{"type":"integer","description":"The branch number."},"BranchName":{"type":"string","description":"The branch name."},"Customers":{"type":"array","items":{"type":"object","properties":{"PartyCode":{"type":"string","description":"The party code shown in Logic ERP."},"PartyName":{"type":"string","description":"The party name."},"ListItems":{"type":"array","items":{"type":"object","properties":{"ItemCode":{"type":"string","description":"The item code shown in Logic ERP."},"EANCode":{"type":"string","description":"The item's barcode / EAN code; empty when none is kept."},"CD_P":{"type":"number","description":"Cash discount %."},"CD_Type":{"type":"string","description":"`Use Zero` or `Ignore Zero` for `CD_P`."},"SPCD_P":{"type":"number","description":"Special cash discount %."},"SPCD_Type":{"type":"string","description":"`Use Zero` or `Ignore Zero` for `SPCD_P`."},"TD_P":{"type":"number","description":"Trade discount %."},"TD_Type":{"type":"string","description":"`Use Zero` or `Ignore Zero` for `TD_P`."},"Excise_P":{"type":"number","description":"Excise %."},"Excise_Type":{"type":"string","description":"`Use Zero` or `Ignore Zero` for `Excise_P`."},"Tax1_P":{"type":"number","description":"Tax 1 %."},"Tax1_Type":{"type":"string","description":"`Use Zero` or `Ignore Zero` for `Tax1_P`."},"Tax2_P":{"type":"number","description":"Tax 2 %."},"Tax2_Type":{"type":"string","description":"`Use Zero` or `Ignore Zero` for `Tax2_P`."},"LabourPerUnit":{"type":"number","description":"Labour charge, in ₹ – per unit, or per conversion unit of the item (the basis is not returned, see Known limitations)."},"LabourIn":{"type":"string","description":"`Use Zero` or `Ignore Zero` for `LabourPerUnit` (see Known limitations)."},"LabourType":{"type":"string","description":"See Known limitations."},"AdjustPerUnit":{"type":"number","description":"Adjustment, in ₹ – per unit, or per conversion unit of the item (the basis is not returned, see Known limitations)."},"AdjustIn":{"type":"string","description":"`Use Zero` or `Ignore Zero` for `AdjustPerUnit` (see Known limitations)."},"AdjustType":{"type":"string","description":"See Known limitations."},"Add_PInRate":{"type":"number","description":"% to add to the rate."},"Rate":{"type":"number","description":"Fixed rate for this party and item, in ₹. `0` when none. The bill uses it only when it is more than zero and the default has no price expression (see Rules)."},"Net_Rate":{"type":"number","description":"The type for `Rate`: `-1` = Use Zero, `0` = Ignore Zero (see Known limitations)."}}},"description":"One entry per item that has a default for this party. See below."}}},"description":"One entry per party. See below."}},"nullable":true,"description":"The records found; null when the call failed or nothing was found - read Message."},"Status":{"type":"boolean","description":"See the Status rules on this page and on How Every API Call Works."},"Message":{"type":"string","description":"Why the call failed, or a note. The reason may be followed by technical detail - read the first line."},"LastGlobalModifyCode":{"type":"integer","description":"The change-log bookmark (see How Every API Call Works)."},"resultSize":{"type":"string","description":"Size of the answer, for example \"2 KB\"."}}}}}},"401":{"description":"No login was sent."}}}}}}
```

### **Response fields**

`GetData` is **one object** (not a list) for the branch:

| Field        | Type   | Meaning                         |
| ------------ | ------ | ------------------------------- |
| `BranchCode` | number | The branch number.              |
| `BranchName` | text   | The branch name.                |
| `Customers`  | list   | One entry per party. See below. |

**`Customers`**:

| Field       | Type | Meaning                                                          |
| ----------- | ---- | ---------------------------------------------------------------- |
| `PartyCode` | text | The party code shown in Logic ERP.                               |
| `PartyName` | text | The party name.                                                  |
| `ListItems` | list | One entry per item that has a default for this party. See below. |

**`ListItems`**:

| Field           | Type   | Meaning                                                                                                                                                       |
| --------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ItemCode`      | text   | The item code shown in Logic ERP.                                                                                                                             |
| `EANCode`       | text   | The item's barcode / EAN code; empty when none is kept.                                                                                                       |
| `CD_P`          | number | Cash discount %.                                                                                                                                              |
| `CD_Type`       | text   | `Use Zero` or `Ignore Zero` for `CD_P`.                                                                                                                       |
| `SPCD_P`        | number | Special cash discount %.                                                                                                                                      |
| `SPCD_Type`     | text   | `Use Zero` or `Ignore Zero` for `SPCD_P`.                                                                                                                     |
| `TD_P`          | number | Trade discount %.                                                                                                                                             |
| `TD_Type`       | text   | `Use Zero` or `Ignore Zero` for `TD_P`.                                                                                                                       |
| `Excise_P`      | number | Excise %.                                                                                                                                                     |
| `Excise_Type`   | text   | `Use Zero` or `Ignore Zero` for `Excise_P`.                                                                                                                   |
| `Tax1_P`        | number | Tax 1 %.                                                                                                                                                      |
| `Tax1_Type`     | text   | `Use Zero` or `Ignore Zero` for `Tax1_P`.                                                                                                                     |
| `Tax2_P`        | number | Tax 2 %.                                                                                                                                                      |
| `Tax2_Type`     | text   | `Use Zero` or `Ignore Zero` for `Tax2_P`.                                                                                                                     |
| `LabourPerUnit` | number | Labour charge, in ₹ – per unit, or per conversion unit of the item (the basis is not returned, see Known limitations).                                        |
| `LabourIn`      | text   | `Use Zero` or `Ignore Zero` for `LabourPerUnit` (see Known limitations).                                                                                      |
| `LabourType`    | text   | See Known limitations.                                                                                                                                        |
| `AdjustPerUnit` | number | Adjustment, in ₹ – per unit, or per conversion unit of the item (the basis is not returned, see Known limitations).                                           |
| `AdjustIn`      | text   | `Use Zero` or `Ignore Zero` for `AdjustPerUnit` (see Known limitations).                                                                                      |
| `AdjustType`    | text   | See Known limitations.                                                                                                                                        |
| `Add_PInRate`   | number | % to add to the rate.                                                                                                                                         |
| `Rate`          | number | Fixed rate for this party and item, in ₹. `0` when none. The bill uses it only when it is more than zero and the default has no price expression (see Rules). |
| `Net_Rate`      | number | The type for `Rate`: `-1` = Use Zero, `0` = Ignore Zero (see Known limitations).                                                                              |

### **Example response**

```json
{
  "GetData": {
    "BranchCode": 2,
    "BranchName": "LUDHIANA MAIN",
    "Customers": [
      {
        "PartyCode": "C1045",
        "PartyName": "SHREE GANESH TRADERS",
        "ListItems": [
          {
            "ItemCode": "TEA-500",
            "EANCode": "8901234567012",
            "CD_P": 2.0,
            "CD_Type": "Ignore Zero",
            "SPCD_P": 0.0,
            "SPCD_Type": "Ignore Zero",
            "TD_P": 5.0,
            "TD_Type": "Ignore Zero",
            "Excise_P": 0.0,
            "Excise_Type": "Ignore Zero",
            "Tax1_P": 0.0,
            "Tax1_Type": "Ignore Zero",
            "Tax2_P": 0.0,
            "Tax2_Type": "Ignore Zero",
            "LabourPerUnit": 0.0,
            "LabourIn": "Ignore Zero",
            "LabourType": "Ignore Zero",
            "AdjustPerUnit": 0.0,
            "AdjustIn": "Ignore Zero",
            "AdjustType": "Ignore Zero",
            "Add_PInRate": 0.0,
            "Rate": 245.0,
            "Net_Rate": 0.0
          }
        ]
      }
    ]
  },
  "Status": true,
  "Message": "",
  "LastGlobalModifyCode": 0,
  "resultSize": "1 KB"
}
```

### **Messages you may see**

On failure `Status` is `false` and `GetData` is `null`. The message is one of the reasons below. In the table, `…` stands for the value named in brackets.

| Message                                                                                     | Meaning                                                                                                                                                                                                                             | What to do                                                      |
| ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| `Unable to found Branch + Party + Item Defaults against Branch Code :…` (the branch number) | The branch has no single-item defaults, or the number is wrong.                                                                                                                                                                     | Check `BranchCode`.                                             |
| `Unable to found Customer for Customer Code : …` (the code you sent)                        | No party has this code.                                                                                                                                                                                                             | Check `CustomerCode`.                                           |
| `Unable to found Item Code : … againts Party Code : …` (item code, party code)              | No item has this code (or barcode, when `UseEANItemCodeAsItemCode` is `true`).                                                                                                                                                      | Check the item code, or the `UseEANItemCodeAsItemCode` setting. |
| `Unable to found Record in Database for Party Code : …` (the party code)                    | The party has no default at this branch for the items asked. With nothing after the colon: `ListCustomers` was empty and one of the parties found has no default left that can be returned (for example its items no longer exist). | Check the party and items, and send the parties you want.       |


---

# 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/masters/pull/get-branch-+-party-+-item-defaults.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.
