> 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/link-a-supplier-to-an-item-for-a-branch.md).

# Link a Supplier to an Item for a Branch

Records that a **supplier** supplies an **item** to a **branch** – one branch + supplier + item link per call. Use it to build the branch-wise supplier list for items in Logic ERP from your system.

### **Endpoint**

| Name          | Detail                                            |
| ------------- | ------------------------------------------------- |
| Address       | `https://your-server/api/SaveBranchSuppItemLinks` |
| 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**

One link per request – the body is a single object, not a list.

| Field           | Type   | Required | Default | Meaning                                                                                                                                                                                                                                                                                             |
| --------------- | ------ | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `BranchCode`    | number | Yes      | `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)).                                                                                                        |
| `SuppUserCode`  | text   | Yes      | empty   | The supplier's code as shown in Logic ERP (`User_Code` in [Get Party Master](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/pull/get-party-master.md)). Spaces before and after are ignored.                                                 |
| `LogicUserCode` | text   | Yes      | 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)). Send the item code, not a barcode – a barcode is not found. Spaces before and after are ignored. |
| `DisplayError`  | text   | No       | `"0"`   | `"1"` = when the request fails, `Message` holds the full technical detail. Use only while testing.                                                                                                                                                                                                  |

### **Rules Logic ERP applies**

* The branch, the supplier and the item must already exist in Logic ERP. Nothing is created except the link.
* Only the link itself is saved. Remarks for the link – and, where your Logic ERP has them, a supplier rate, lead days and quotation date – cannot be sent and stay empty.
* **No duplicates.** If the same branch + supplier + item link already exists, nothing is saved and the call answers `Status: false` with `Branch + Supplier + Item Linking Already Exists!!`. When you re-send links, treat this message as "already done".
* The code in `SuppUserCode` is matched against **any** account in Logic ERP, not only suppliers. Make sure you send a supplier's code: a customer's code is accepted too.
* The item code is matched with capital and small letters not distinguished.
* To link several items, send one request per item.

### **Example request**

```json
{
  "BranchCode": 4,
  "SuppUserCode": "S2031",
  "LogicUserCode": "KRT1045-M"
}
```

### **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**. This really saves in the sandbox, so use test values like the example. The link in the example already exists, so sending it again answers that the link already exists; change the supplier or item to create a new one.

## Link a Supplier to an Item for a Branch

> Records that a supplier supplies an item to a branch – one branch + supplier + item link per call. Use it to build the branch-wise supplier list for items in Logic ERP from your system.

```json
{"openapi":"3.0.3","info":{"title":"Logic ERP API","version":"1.0"},"tags":[{"name":"Masters - Push"}],"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":{"/SaveBranchSuppItemLinks":{"post":{"tags":["Masters - Push"],"operationId":"SaveBranchSuppItemLinks","summary":"Link a Supplier to an Item for a Branch","description":"Records that a supplier supplies an item to a branch – one branch + supplier + item link per call. Use it to build the branch-wise supplier list for items in Logic ERP from your system.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"BranchCode":{"type":"integer","description":"Logic ERP's branch code (`Branch_Code` in Get Branch Info)."},"SuppUserCode":{"type":"string","description":"The supplier's code as shown in Logic ERP (`User_Code` in Get Party Master). Spaces before and after are ignored."},"LogicUserCode":{"type":"string","description":"The item code shown in Logic ERP (`UserCode` in Get Item Master). Send the item code, not a barcode – a barcode is not found. Spaces before and after are ignored."}}}}}},"responses":{"200":{"description":"Always HTTP 200. Check Status and Message.","content":{"application/json":{"schema":{"type":"object","properties":{"Status":{"type":"boolean","description":"See the Status rules on this page."},"Message":{"type":"string","description":"Why the call failed, or a note. The reason may be followed by technical detail - read the first line."},"LastSavedCode":{"type":"integer","description":"See this page."},"request_ID":{"type":"string","description":"Logic ERP request number of this call."}}}}}},"401":{"description":"No login was sent."}}}}}}
```

### **Response**

* `Status` – `true` when the link was saved; `false` when it already existed or the request was refused.
* `Message` – empty when saved; otherwise the reason (see below).
* `LastSavedCode` – Logic ERP's internal number of the new link. `0` when nothing was saved.
* `request_ID` – filled once the branch, supplier and item have been found (also when the link already existed). When the request is refused earlier it is `null`.

### **Example response**

```json
{
  "Status": true,
  "Message": "",
  "LastSavedCode": 1187,
  "request_ID": "e41a7c3d-92b5-4f08-a6c1-5d3e8b0f9a27"
}
```

### **Messages you may see**

| Message                                                                    | Meaning                                            | What to do                                |
| -------------------------------------------------------------------------- | -------------------------------------------------- | ----------------------------------------- |
| `Branch Code Is Missing!!`                                                 | `BranchCode` is missing or `0`.                    | Send the branch code.                     |
| `Supplier User Code Is Missing!!`                                          | `SuppUserCode` is empty.                           | Send the supplier code.                   |
| `Logic User Code Is Missing!!`                                             | `LogicUserCode` is empty.                          | Send the item code.                       |
| `Invalid Branch Code!!`                                                    | No branch has this code.                           | Check the code with Get Branch Info.      |
| `Invalid Supplier User Code!!`                                             | No account has this code.                          | Check the code with Get Party Master.     |
| `Invalid Logic User Code!!`                                                | No item has this item code.                        | Check the item code with Get Item Master. |
| `Branch + Supplier + Item Linking Already Exists!!` (with `Status: false`) | The link is already in Logic ERP. Nothing changed. | Nothing to do.                            |
| 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/link-a-supplier-to-an-item-for-a-branch.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.
