> 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/update-item-groups.md).

# Update Item Groups

Changes the **item groups** of one item in Logic ERP – the groups at each of the **30 group levels** (what each level means, for example department, category or brand, depends on your company's setup). You name the group at each level; a group that does not exist yet at that level is **created automatically**. Use it when your system re-classifies an item that already exists in Logic ERP.

### **Endpoint**

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

The response and the common messages 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 names are matched without regard to capitals.

| Field                          | Type | Required | Default | Meaning                                                                                                                                                                                                                                                                                                   |
| ------------------------------ | ---- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `LogicUserCode`                | text | Yes      | `""`    | The item code as 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)). Matched without regard to capitals; spaces at the end are ignored. The barcode cannot be used here. |
| `GroupName1` … `GroupName30`   | text | No       | `""`    | The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below.                                                                                                                                               |
| `GroupShort1` … `GroupShort30` | text | No       | `""`    | Short name for the group at that level; up to 60 characters. Used when the group is created by this request, and to **find** the group when `GroupName…` of that level is empty (see the rules). It does not change the short name of a group that already exists.                                        |

### **Rules Logic ERP applies**

* **Finding the group.** At each level, Logic ERP looks for a **main group** (not a sub-group) at that level whose name equals the name you sent – without regard to capitals, ignoring spaces at the end but not at the start. Groups with the same name at other levels do not count. When `GroupName…` is empty and `GroupShort…` is filled (not `(NIL)`), Logic ERP looks instead for the main group at that level with that short name.
* **Creating the group.** If no such group exists, a new main group is created at that level with the name you sent and your short name (or a blank short name). A group is never created without a name: when `GroupName…` is empty and no main group at that level has the short name you sent, the request is refused with `Group name required` and nothing is saved.
* **The whole item changes.** Groups belong to the item (item and shade), so the change applies to **every item code** of that item – all its sizes and packs – not only the code you sent.
* A level whose `GroupName…` and `GroupShort…` are both left out, empty or `(NIL)` keeps the item's current group. There is no way to clear a level to "no group" with this endpoint.
* Everything is saved in one go: if an error occurs (for example a database error), no group is created and the item is not changed. An unknown item code is refused before anything is written.
* Every item code of the item gets today's date as its modified date, and the change is recorded in Logic ERP's change log, so the item comes back in Get Item Master – by bookmark, or for a period that includes today.
* This endpoint is covered by the same licence as creating items through the API.

### **Example request**

Moves item `KR1045` to the groups KURTA / ETHNIC / LADIES at levels 1 to 3. The other levels are left out, so they keep their current groups.

```json
{
  "LogicUserCode": "KR1045",
  "GroupName1": "KURTA",
  "GroupName2": "ETHNIC",
  "GroupName3": "LADIES",
  "GroupShort1": "KUR",
  "GroupShort2": "ETH",
  "GroupShort3": "LAD"
}
```

### **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 example sends all 30 levels for the test item `APITEST0001`, with `(NIL)` for the levels it does not use.

## Update Item Groups

> Changes the item groups of one item in Logic ERP – the groups at each of the 30 group levels (what each level means, for example department, category or brand, depends on your company's setup). You name the group at each level; a group that does not exist yet at that level is created automatically. Use it when your system re-classifies an item that already exists in Logic ERP.

```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":{"/UpdateItemGroups":{"post":{"tags":["Masters - Push"],"operationId":"UpdateItemGroups","summary":"Update Item Groups","description":"Changes the item groups of one item in Logic ERP – the groups at each of the 30 group levels (what each level means, for example department, category or brand, depends on your company's setup). You name the group at each level; a group that does not exist yet at that level is created automatically. Use it when your system re-classifies an item that already exists in Logic ERP.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"LogicUserCode":{"type":"string","description":"The item code as shown in Logic ERP (`UserCode` in Get Item Master). Matched without regard to capitals; spaces at the end are ignored. The barcode cannot be used here."},"GroupName1":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName2":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName3":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName4":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName5":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName6":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName7":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName8":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName9":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName10":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName11":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName12":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName13":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName14":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName15":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName16":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName17":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName18":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName19":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName20":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName21":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName22":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName23":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName24":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName25":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName26":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName27":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName28":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName29":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."},"GroupName30":{"type":"string","description":"The name of the group at level 1 … 30, as shown in Logic ERP (`Group_Name1` … `Group_Name30` in Get Item Master). Up to 80 characters. See the rules below."}}}}}},"responses":{"200":{"description":"Always HTTP 200. Check Status and Message.","content":{"application/json":{"schema":{"type":"object","properties":{"Status":{"type":"boolean","description":"`true` when the item's groups were saved."},"Message":{"type":"string","description":"Empty when saved; otherwise the reason."},"LastSavedCode":{"type":"integer","description":"Always `0`."},"request_ID":{"type":"string","description":"The ID of this request. `null` when the request failed because `LogicUserCode` was empty."}}}}}},"401":{"description":"No login was sent."}}}}}}
```

### **Response**

| Field           | What it holds for this endpoint                                                           |
| --------------- | ----------------------------------------------------------------------------------------- |
| `Status`        | `true` when the item's groups were saved.                                                 |
| `Message`       | Empty when saved; otherwise the reason.                                                   |
| `LastSavedCode` | Always `0`.                                                                               |
| `request_ID`    | The ID of this request. `null` when the request failed because `LogicUserCode` was empty. |

### **Example response**

```json
{
  "Status": true,
  "Message": "",
  "LastSavedCode": 0,
  "request_ID": "3b0e7c52-91d4-4f0a-a6c1-5d2e8f7a9b10"
}
```

### **Messages you may see**

| Message                                      | Meaning                                                                                                   | What to do                                                   |
| -------------------------------------------- | --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| `LogicUserCode Is Missing...`                | `LogicUserCode` was empty or left out. Nothing was saved.                                                 | Send the item code.                                          |
| `Invalid LogicUserCode : …`                  | No item has the code you sent in `LogicUserCode`. Nothing was saved.                                      | Check the item code.                                         |
| `Group name required` (with `Status: false`) | At a level where `GroupName…` was empty, no main group has the `GroupShort…` you sent. Nothing was saved. | Send the group name, or the short name of an existing group. |
| A database error (with `Status: false`)      | A name was longer than the limits above. Nothing was saved.                                               | Correct the name and send 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/update-item-groups.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.
