> 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-group-defaults.md).

# Get Branch + Party + Item Group Defaults

Returns the **party + item group wise defaults** set up in Logic ERP for one **branch**. These are the same kind of terms as party + item defaults – discounts, taxes, labour, adjustment and add % in rate agreed with a particular customer (party) – but set once for a whole **item group** instead of item by item. For example *"at the Ludhiana branch, Shree Ganesh Traders gets 3% cash discount on everything in the TEA group"*. When that party is billed at that branch for an item of the group, Logic ERP fills these values into the bill (a default set for the single item can take priority). Use this endpoint to give your ordering or billing system the same terms.

### **Endpoint**

| Name          | Detail                                                    |
| ------------- | --------------------------------------------------------- |
| Address       | `https://your-server/api/GetBranchPartyItemGroupDefaults` |
| 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   | Yes      | —       | The parties you want, each with the item groups you want. An empty list returns no parties.       |

**`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.                                                                                                                                         |
| `ItemGroupNames`                        | text | Yes      | —       | Item group names separated by commas, for example `"TEA,COFFEE"`. Spaces around a name, and empty entries (such as a comma at the end), are ignored. Each name must match a group name in Logic ERP; capitals and small letters are treated alike. |
| `ListItems`, `UseEANItemCodeAsItemCode` | —    | No       | —       | Not used by this endpoint.                                                                                                                                                                                                                         |

### **Rules Logic ERP applies**

* Only defaults set for a **named party and an item group** are returned. Defaults that Logic ERP keeps for **all parties** or for a **party group** at the branch are not returned, although they also affect the bill.
* The branch must have at least one default of any kind, otherwise the call fails (see Messages).
* Each party and each group name you list must exist. One wrong code or name makes the **whole call fail** – nothing is returned for the other parties.
* Each party must have a default for at least one of the groups you listed at this branch; otherwise the whole call fails. A group that exists but has no default for that party is simply left out.
* When two item groups share a name, the defaults of both are looked up and come back as separate entries.
* Listing the same group twice returns it once. Listing the same party twice returns its groups twice, inside the same party entry.
* Parties and groups come in no particular order.
* `Rate` is not part of an item-group default and is not returned.
* The call has succeeded when `GetData` is not `null`.

### **Known limitations**

* **An empty or `null`** **`ListCustomers` returns nothing useful.** The answer has `BranchCode` `0`, `BranchName` `null` and an empty `Customers` list, with no message. Always 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.

### **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 group).
* **Ignore Zero** – the zero means "not set here", and Logic ERP takes the value from its next setting.

### **Example request**

```json
{
  "BranchCode": 2,
  "ListCustomers": [
    {
      "CustomerCode": "C1045",
      "ItemGroupNames": "TEA,COFFEE"
    }
  ]
}
```

### **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`.

## Get Branch + Party + Item Group Defaults

> Returns the party + item group wise defaults set up in Logic ERP for one branch. These are the same kind of terms as party + item defaults – discounts, taxes, labour, adjustment and add % in rate agreed with a particular customer (party) – but set once for a whole item group instead of item by item. For example "at the Ludhiana branch, Shree Ganesh Traders gets 3% cash discount on everything in the TEA group". When that party is billed at that branch for an item of the group, Logic ERP fills these values into the bill (a default set for the single item can take priority). Use this endpoint to give your ordering or billing system the same terms.

```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":{"/GetBranchPartyItemGroupDefaults":{"post":{"tags":["Masters - Pull"],"operationId":"GetBranchPartyItemGroupDefaults","summary":"Get Branch + Party + Item Group Defaults","description":"Returns the party + item group wise defaults set up in Logic ERP for one branch. These are the same kind of terms as party + item defaults – discounts, taxes, labour, adjustment and add % in rate agreed with a particular customer (party) – but set once for a whole item group instead of item by item. For example \"at the Ludhiana branch, Shree Ganesh Traders gets 3% cash discount on everything in the TEA group\". When that party is billed at that branch for an item of the group, Logic ERP fills these values into the bill (a default set for the single item can take priority). Use this endpoint to give your ordering or billing system the same terms.","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."},"ItemGroupNames":{"type":"string","description":"Item group names separated by commas, for example `\"TEA,COFFEE\"`. Spaces around a name, and empty entries (such as a comma at the end), are ignored. Each name must match a group name in Logic ERP; capitals and small letters are treated alike."}}},"description":"The parties you want, each with the item groups you want. An empty list returns no parties."},"CustomerCode":{"type":"string","description":"The party code as shown in Logic ERP, for example `\"C1045\"`. Capitals and small letters are treated alike."},"ItemGroupNames":{"type":"string","description":"Item group names separated by commas, for example `\"TEA,COFFEE\"`. Spaces around a name, and empty entries (such as a comma at the end), are ignored. Each name must match a group name in Logic ERP; capitals and small letters are treated alike."},"ListItems":{"type":"string","description":"Not used by this endpoint."},"UseEANItemCodeAsItemCode":{"type":"string","description":"Not used by this endpoint."}},"required":["BranchCode","ListCustomers","CustomerCode","ItemGroupNames"]}}}},"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."},"ItemGroups":{"type":"array","items":{"type":"object","properties":{"GroupName":{"type":"string","description":"The item group name."},"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."}}},"description":"One entry per item group 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.                                                        |
| `ItemGroups` | list | One entry per item group that has a default for this party. See below. |

**`ItemGroups`**:

| Field           | Type   | Meaning                                                                                                                |
| --------------- | ------ | ---------------------------------------------------------------------------------------------------------------------- |
| `GroupName`     | text   | The item group name.                                                                                                   |
| `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.                                                                                                  |

### **Example response**

```json
{
  "GetData": {
    "BranchCode": 2,
    "BranchName": "LUDHIANA MAIN",
    "Customers": [
      {
        "PartyCode": "C1045",
        "PartyName": "SHREE GANESH TRADERS",
        "ItemGroups": [
          {
            "GroupName": "TEA",
            "CD_P": 3.0,
            "CD_Type": "Ignore Zero",
            "SPCD_P": 0.0,
            "SPCD_Type": "Ignore Zero",
            "TD_P": 0.0,
            "TD_Type": "Use 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
          }
        ]
      }
    ]
  },
  "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 Code :…` (the branch number)                                                                                  | The branch has no defaults at all, 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 Groups for Customer Code : …` (the party code)                                                                  | `ItemGroupNames` is empty (or holds only commas and spaces) for this party. | Send at least one group name.   |
| `Unable to found Group Name : … againts Customer Code : …` (group name, party code)                                                   | No item group has this name.                                                | Check the spelling.             |
| `Unable to found Record in Database for Item Groups : … and Customer Code : …` (the group names as you sent them, and the party code) | The party has no default at this branch for any of the groups listed.       | Check the party and the groups. |


---

# 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-group-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.
