> 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/push/edit-branch-rate-group-rates.md).

# Edit Branch Rate Group Rates

Sets **item rates for a branch rate group**: the basic, purchase, sale and special rates and the MRP that apply to an item in every branch linked to that rate group. Name the rate group directly, or name a branch and Logic ERP uses the rate group that branch is linked to. Use it to push branch-wise price changes from your system into Logic ERP.

### **Endpoint**

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

The response and the messages every endpoint can return 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).

### **Request fields**

| Field                 | Type   | Required                             | Default | Meaning                                                                                                                                                                                                                                                                                                       |
| --------------------- | ------ | ------------------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `BranchRateGroupName` | text   | Either this or `BranchCode`          | empty   | Name of the branch rate group, exactly as set up in Logic ERP, for example `"NORTH ZONE RATES"`. When filled, `BranchCode` is ignored.                                                                                                                                                                        |
| `BranchCode`          | number | Either this or `BranchRateGroupName` | `0`     | Logic ERP's branch code (`Branch_Code` in [Get Branch Info](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/pull/get-branch-info.md)). Used only when `BranchRateGroupName` is empty: the rates are written to the rate group that branch is linked to. |
| `ListItems`           | list   | **Yes**                              | –       | The items and their rates. See below.                                                                                                                                                                                                                                                                         |

`BranchShortName` is accepted but **ignored** – a branch can only be named by `BranchCode` here.

**`ListItems`** – one entry per item:

| Field                   | Type   | Required                  | Default | Meaning                                                                                                                                                                                                                                     |
| ----------------------- | ------ | ------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ItemCode`              | text   | Either this or `EANCode`  | empty   | The item code shown in Logic ERP (`UserCode` in [Get Item Master](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/pull/get-item-master.md)). When filled, `EANCode` is not looked at. |
| `EANCode`               | text   | Either this or `ItemCode` | empty   | The item's main additional code / barcode (`AddlItemCode` in Get Item Master). Other barcodes of the item (`ListEANCode`) are not searched.                                                                                                 |
| `MRP`                   | number | No                        | `0`     | MRP in ₹.                                                                                                                                                                                                                                   |
| `Sale_Rate`             | number | No                        | `0`     | Sale rate in ₹.                                                                                                                                                                                                                             |
| `Basic_Rate`            | number | No                        | `0`     | Basic rate in ₹.                                                                                                                                                                                                                            |
| `Pur_Rate`              | number | No                        | `0`     | Purchase rate in ₹.                                                                                                                                                                                                                         |
| `SP_Rate1` … `SP_Rate5` | number | No                        | `0`     | Special rates 1 to 5 in ₹.                                                                                                                                                                                                                  |

A rate is changed only when you send a value **greater than 0**. A rate you leave out, or send as `0`, keeps its current value.

### **Rules Logic ERP applies**

* **A rate group is shared.** The rates belong to the rate group, not to one branch: every branch linked to the group gets the new rates. Naming a branch only tells Logic ERP which group to change.
* With `BranchCode`, the branch must exist and must be linked to a rate group. With `BranchRateGroupName`, the name must match a branch rate group in Logic ERP; capital and small letters are not distinguished on a standard installation.
* `ItemCode` and `EANCode` are matched exactly as sent – spaces are not removed; capital and small letters are not distinguished on a standard installation.
* **Items are checked first.** Every line is looked up before anything is written. If one item is not found, the request stops with `Status: false` and nothing is saved.
* **All or nothing.** The lines are then saved together: if anything fails while saving, none of them are kept.
* An item that has no rates in the group yet is **added** to the group; rates you do not send start at `0`. An item already in the group is **updated**.
* A rate cannot be cleared to `0` through this endpoint – `0` means "leave unchanged".
* If the same item appears twice in `ListItems`, both lines are applied in order, so the later line wins for the rates it sends.
* Logic ERP also keeps a **day-wise history** of rate changes for the group: one history line per item per day, updated by later calls on the same day.
* An empty or missing `ListItems` is refused with `EAN Codes not defined...`.
* Branch and financial year play no other part: the rates are not tied to a date.

> **Known issue – wrong `ItemCode` gives a misleading message.** When `ItemCode` is not found, the message is `Invalid EAN Code :` followed by the `EANCode` you sent – usually nothing. Read it as "this item was not found" and check the item code.

### **Example request**

By branch, two items:

```json
{
  "BranchCode": 4,
  "ListItems": [
    { "ItemCode": "KRT1045-M", "MRP": 1299, "Sale_Rate": 1199 },
    { "EANCode": "8901234567892", "Sale_Rate": 649, "SP_Rate1": 599 }
  ]
}
```

By rate group name:

```json
{
  "BranchRateGroupName": "NORTH ZONE RATES",
  "ListItems": [
    { "ItemCode": "KRT1045-M", "Pur_Rate": 610, "Basic_Rate": 620 }
  ]
}
```

### **Response**

* `Status` – `true` when all lines were saved.
* `Message` – empty when saved; otherwise the reason (see below).
* `LastSavedCode` – always `0`; this endpoint does not return a record number.
* `request_ID` – filled once the items have been checked. When the request is refused earlier (branch, rate group or item not found, or no `ListItems`) it is `null`.

### **Example response**

```json
{
  "Status": true,
  "Message": "",
  "LastSavedCode": 0,
  "request_ID": "3f2b8c1e-6a4d-4e2f-9b7a-0c5d1e8f2a64"
}
```

### **Messages you may see**

| Message                                         | Meaning                                                                                                                                          | What to do                                                                                 |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
| `Branch Code Is Missing...`                     | Neither `BranchRateGroupName` nor `BranchCode` was sent.                                                                                         | Send one of them.                                                                          |
| `Invalid Branch Code...`                        | No branch has this `BranchCode`.                                                                                                                 | Check the code with Get Branch Info.                                                       |
| `Branch Rate Group Not Defined...`              | The branch exists but is not linked to a rate group.                                                                                             | Ask your Logic ERP team to link the branch to a rate group, or send `BranchRateGroupName`. |
| `Branch Rate Group not Defined...`              | No branch rate group has the name you sent.                                                                                                      | Check the name in Logic ERP.                                                               |
| `Invalid EAN Code : …` (the `EANCode` you sent) | An item in `ListItems` was not found – by `ItemCode` when it was filled, otherwise by `EANCode` – or a line has neither code. Nothing was saved. | Check the code. See the known issue above.                                                 |
| `EAN Codes not defined...`                      | `ListItems` was empty or left out.                                                                                                               | Send at least one item.                                                                    |
| A technical error (with `Status: false`)        | Something failed while saving. Nothing was saved.                                                                                                | Correct the request and send it again.                                                     |


---

# 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/push/edit-branch-rate-group-rates.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.
