> For the complete documentation index, see [llms.txt](https://docs.p4.software/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.p4.software/p4-warehouse-spanish/api-rest/product-master/update-or-edit-existing-products.md).

# Update or edit existing products

## End Point

'CreateOrUpdate' API end point is used to update/edit existing products.

## Update/Edit existing product

<mark style="color:green;">`POST`</mark> `https://{tenant_name}.p4warehouse.com/api/ProductApi/CreateOrUpdate`

#### Headers

| Name                                     | Type   | Description    |
| ---------------------------------------- | ------ | -------------- |
| ApiKey<mark style="color:red;">\*</mark> | String | System API key |

#### Request Body

| Name                                   | Type  | Description                               |
| -------------------------------------- | ----- | ----------------------------------------- |
| "Id"<mark style="color:red;">\*</mark> | Sting | Product Id number generated by the system |

{% tabs %}
{% tab title="200: OK Product is updated" %}

```json
{
    "$id": "1",
    "Sku": "1234",
    "Upc": "12345678",
    "BarcodeValue": null,
    "BarcodeTypeEnum": null,
    "BarcodeType": null,
    "Category": null,
    "Description": "Demo",
    "SubstituteGroup": null,
    "HtsCode": null,
    "CountryOfOrigin": null,
    "ReferenceNumber": null,
    "Reference1": null,
    "Reference2": null,
    "Reference3": null,
    "Components": [],
    "Packsizes": [],
    "ComponentOf": [],
    "InventoryLocations": [],
    "PurchaseOrderLines": [],
    "CustomerReturnLines": [],
    "PickTicketLines": [],
    "ProductionOrderInLines": [],
    "InProductionOrders": [],
    "ProductionOrderOutLines": [],
    "OutProductionOrders": [],
    "MinMax": [],
    "CartonizationResultContents": [],
    "ClientId": null,
    "Client": null,
    "BomWorkflowId": null,
    "BomWorkflow": null,
    "Height": null,
    "Width": null,
    "Length": null,
    "DimsLengthUnitOfMeasureEnum": 10,
    "DimsLengthUnitOfMeasure": "M",
    "Weight": null,
    "FreightClassEnum": null,
    "FreightClass": null,
    "IsHazMat": false,
    "Nmfc": null,
    "CommodityDescription": null,
    "DimsWeightUnitOfMeasureEnum": 1,
    "DimsWeightUnitOfMeasure": "Kg",
    "Cube": null,
    "IsBillOfMaterial": false,
    "IsLotControlled": false,
    "LotPattern": null,
    "IsSerialControlled": false,
    "SerialPattern": null,
    "IsExpiryControlled": false,
    "IsDecimalControlled": false,
    "IsPacksizeControlled": false,
    "IsDiscontinued": false,
    "UnitOfMeasureEnum": null,
    "UnitOfMeasure": null,
    "CartonizationBehaviourEnum": 0,
    "CartonizationBehaviour": "Inherit",
    "IsDetailsControlled": false,
    "IsDetailsAllocatedControlled": false,
    "Info1": null,
    "Info2": null,
    "Info3": null,
    "Info4": null,
    "Info5": null,
    "Info6": null,
    "Info7": null,
    "Info8": null,
    "Info9": null,
    "Info10": null,
    "Id": "adf4902d-f395-409a-b994-10e57478df28",
    "DateCreated": "2023-08-15T14:54:54.2181627+00:00",
    "TypeName": "Pro4Soft.TenantData.Entities.Business.Product",
    "TypeNameShort": "Product"
}
```

{% endtab %}

{% tab title="401: Unauthorized Incorrect ApiKey" %}

{% endtab %}

{% tab title="404: Not Found Incorrect URL" %}

{% endtab %}

{% tab title="406: Not Acceptable Missing fields" %}
\[Sku]: The Sku field is required.
{% endtab %}
{% endtabs %}

If payload (JSON) contains 'Id' number, system will update corresponding product. If 'Id' is missing or incorrect, system will automatically create new product.

## Available Fields

```json
    "Upc": String
    "BarcodeValue": String
    "BarcodeType": String
    "Category": String
    "Description": String
    "SubstituteGroup": String
    "HtsCode": String
    "CountryOfOrigin": String
    "ReferenceNumber": String
    "Reference1": String
    "Reference2": String
    "Reference3": String
    "ClientId": String
    "Client": String
    "Height": Decimal
    "Width": Decimal
    "Length": Decimal
    "DimsLengthUnitOfMeasure": Sting
    "Weight": Decimal
    "FreightClass": String
    "IsHazMat": Boolean
    "Nmfc": String
    "CommodityDescription": String
    "DimsWeightUnitOfMeasure": String
    "Cube": Deciaml
    "IsBillOfMaterial": Boolean
    "IsLotControlled": Boolean
    "LotPattern": String
    "IsSerialControlled": Boolean
    "SerialPattern": String
    "IsExpiryControlled": Boolean
    "IsDecimalControlled": Boolean
    "IsPacksizeControlled": Boolean
    "IsDiscontinued": Boolean
    "UnitOfMeasure": String
    "Info1": String
    "Info2": String
    "Info3": String
    "Info4": String
    "Info5": String
    "Info6": String
    "Info7": String
    "Info8": String
    "Info9": String
    "Info10": String
```

{% hint style="info" %}
Notice: Product 'Id' and 'Sku' cannot be changed after the initial creation.
{% endhint %}


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.p4.software/p4-warehouse-spanish/api-rest/product-master/update-or-edit-existing-products.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
