> 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-conversion-factors.md).

# Update Item Conversion Factors

Changes the **conversion factors** of one item code in Logic ERP – up to three alternate units for the item (for example a BOX of 12 pieces), each with a factor (**units per pack**) and the name of the unit. These are the values [Get Item Master](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/pull/get-item-master.md) returns as `CF_1` … `CF_3` and `CF_Desc_1` … `CF_Desc_3`. Use it when your system changes how an item is packed.

### **Endpoint**

| Name          | Detail                                 |
| ------------- | -------------------------------------- |
| Address       | `https://your-server/api/UpdateItemCF` |
| 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). Matched without regard to capitals.                                                              |
| `EANCode`                             | text   | No       | `""`    | The item's barcode (`AddlItemCode` in Get Item Master). Used only when no item has the code in `LogicUserCode`. Send `""`, `null` or leave it out when you have none. |
| `Cf_1`, `Cf_2`, `Cf_3`                | number | No       | `0`     | Conversion factor 1, 2, 3: how many units make one of the alternate unit, for example `12`. Kept to 4 decimal places. Only a value **above 0** changes the item.      |
| `Cf_1_Desc`, `Cf_2_Desc`, `Cf_3_Desc` | text   | No       | `""`    | Name of alternate unit 1, 2, 3, for example `BOX`. Up to 15 characters. Only a non-empty value changes the item.                                                      |

`ItemDetCode` is accepted but ignored.

### **Rules Logic ERP applies**

* At least one of the six `Cf_…` fields must be filled (a factor above 0 or a unit name), otherwise the request is refused with `Data Not Found...`.
* Only the fields you fill are changed; the others keep their values. A factor of `0` or less, or an empty unit name, never changes anything, so you **cannot clear** a conversion factor or a unit name with this endpoint.
* The change applies to **this item code only** – one size or pack – not to the other sizes of the same item.
* **Finding the item:** first by `LogicUserCode`; if no item has that code and `EANCode` is filled, by the barcode. If neither is found, nothing is saved.
* The factor and the unit name are not checked against each other: you can send a factor without a unit name or the reverse.
* The item code 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**

Item `KR1045-M` is also sold in boxes of 12 and cartons of 48:

```json
{
  "LogicUserCode": "KR1045-M",
  "EANCode": "",
  "Cf_1": 12,
  "Cf_1_Desc": "BOX",
  "Cf_2": 48,
  "Cf_2_Desc": "CTN"
}
```

### **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 sets the pack units of the test item `APITEST0001`.

## Update Item Conversion Factors

> Changes the conversion factors of one item code in Logic ERP – up to three alternate units for the item (for example a BOX of 12 pieces), each with a factor (units per pack) and the name of the unit. These are the values Get Item Master returns as \`CF\_1\` … \`CF\_3\` and \`CF\_Desc\_1\` … \`CF\_Desc\_3\`. Use it when your system changes how an item is packed.

```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":{"/UpdateItemCF":{"post":{"tags":["Masters - Push"],"operationId":"UpdateItemCF","summary":"Update Item Conversion Factors","description":"Changes the conversion factors of one item code in Logic ERP – up to three alternate units for the item (for example a BOX of 12 pieces), each with a factor (units per pack) and the name of the unit. These are the values Get Item Master returns as `CF_1` … `CF_3` and `CF_Desc_1` … `CF_Desc_3`. Use it when your system changes how an item is packed.","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."},"EANCode":{"type":"string","description":"The item's barcode (`AddlItemCode` in Get Item Master). Used only when no item has the code in `LogicUserCode`. Send `\"\"`, `null` or leave it out when you have none."},"Cf_1":{"type":"integer","description":"Conversion factor 1, 2, 3: how many units make one of the alternate unit, for example `12`. Kept to 4 decimal places. Only a value above 0 changes the item."},"Cf_1_Desc":{"type":"string","description":"Name of alternate unit 1, 2, 3, for example `BOX`. Up to 15 characters. Only a non-empty value changes the item."},"Cf_2":{"type":"integer","description":"Conversion factor 1, 2, 3: how many units make one of the alternate unit, for example `12`. Kept to 4 decimal places. Only a value above 0 changes the item."},"Cf_2_Desc":{"type":"string","description":"Name of alternate unit 1, 2, 3, for example `BOX`. Up to 15 characters. Only a non-empty value changes the item."}}}}}},"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 was 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 on the first two checks (no item code, nothing to change)."}}}}}},"401":{"description":"No login was sent."}}}}}}
```

### **Response**

| Field           | What it holds for this endpoint                                                                                   |
| --------------- | ----------------------------------------------------------------------------------------------------------------- |
| `Status`        | `true` when the item was saved.                                                                                   |
| `Message`       | Empty when saved; otherwise the reason.                                                                           |
| `LastSavedCode` | Always `0`.                                                                                                       |
| `request_ID`    | The ID of this request. `null` when the request failed on the first two checks (no item code, nothing to change). |

### **Example response**

```json
{
  "Status": true,
  "Message": "",
  "LastSavedCode": 0,
  "request_ID": "a7d41f0e-2c6b-4e8a-9f35-0b1c7e6d2a48"
}
```

### **Messages you may see**

| Message                                                      | Meaning                                                                                                                                         | What to do                                       |
| ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
| `LogicUserCode Is Missing...`                                | `LogicUserCode` was empty or left out.                                                                                                          | Send the item code.                              |
| `Data Not Found...`                                          | None of the six `Cf_…` fields was filled with a factor above 0 or a unit name.                                                                  | Send at least one factor above 0 or a unit name. |
| `Invalid LogicUserCode / EANCode : …` (with `Status: false`) | No item has that item code or barcode. The code shown (in capitals) is the barcode if you sent one, otherwise the item code. Nothing was saved. | Check the item code and barcode.                 |
| A database error (with `Status: false`)                      | A unit name was longer than 15 characters. Nothing was saved.                                                                                   | Shorten the unit name.                           |


---

# 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-conversion-factors.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.
