> For the complete documentation index, see [llms.txt](https://help.orderdesk.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.orderdesk.com/api-documentation/v2-api-reference/order-items/update-order-item.md).

# Update Order Item

Replaces a single line item and recalculates the order totals.

{% hint style="warning" %}
As with other update operations, the complete item must be passed. Any fields left out will be updated as blank.
{% endhint %}

```json
{"openapi":"3.0.3","info":{"title":"Order Desk API","version":"2.0"},"tags":[{"name":"Order Items"}],"servers":[{"url":"https://app.orderdesk.me/api/v2","description":"Production"}],"security":[{"OrderDeskStoreId":[],"OrderDeskApiKey":[]}],"components":{"securitySchemes":{"OrderDeskStoreId":{"type":"apiKey","in":"header","name":"ORDERDESK-STORE-ID","description":"Your store ID, found under Store Settings on the API tab."}},"schemas":{"OrderItemWrite":{"allOf":[{"type":"object","properties":{"id":{"type":"integer","description":"If an `id` field is passed the item will be updated. Otherwise it will be added.\n"}}},{"$ref":"#/components/schemas/OrderItemFields"}]},"OrderItemFields":{"type":"object","properties":{"name":{"type":"string"},"price":{"type":"number","format":"double","default":0},"quantity":{"type":"integer","default":1},"weight":{"type":"number","format":"double"},"code":{"type":"string","description":"Item SKU or product code."},"delivery_type":{"$ref":"#/components/schemas/DeliveryType"},"category_code":{"type":"string","description":"Further details about the type of item. Freeform text."},"fulfillment_method":{"type":"string","description":"Fulfillment method responsible for this item, when one applies."},"variation_list":{"allOf":[{"$ref":"#/components/schemas/KeyValue"}],"description":"Collection of variations in key/value format, such as `{\"Size\": \"Large\", \"Color\":\n\"Red\"}`. Maximum total size is 5,000 characters when JSON-encoded.\n"},"metadata":{"allOf":[{"$ref":"#/components/schemas/KeyValue"}],"description":"Collection of extra (hidden) item details in key/value format. Maximum total size is\n15,000 characters when JSON-encoded.\n"}}},"DeliveryType":{"type":"string","default":"ship","description":"Available options are `ship`, `noship`, `download`, or `future`. Defaults to `ship`.\n","enum":["ship","noship","download","future"]},"KeyValue":{"type":"object","additionalProperties":true,"description":"A collection in key/value format. Must be flat, with no nested arrays. Keys must be\nstrings, and values must be strings, numbers, booleans, or null.\n\nWhen the collection is empty, the API returns an empty array (`[]`) rather than an\nempty object. Treat both as \"no entries\" when parsing.\n"},"ResponseEnvelope":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["success","error"],"description":"Either `success` or `error`."},"message":{"type":"string","description":"Describes the result. Always present when an error occurs."},"execution_time":{"type":"string","description":"Time taken to process the request."}}}},"responses":{"BadRequest":{"description":"The request was rejected. `message` names the problem.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseEnvelope"}}}},"Unauthorized":{"description":"Authentication failed. See the Authentication guide, and\nnote that an invalid store ID blocks your store rather than simply\nfailing the request.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseEnvelope"}}}},"NotFound":{"description":"No record matches that ID in your store.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseEnvelope"}}}},"PayloadTooLarge":{"description":"An item's `metadata` or `variation_list` is over the limit. See\nthe Errors guide for the sizes.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseEnvelope"}}}},"RateLimited":{"description":"You are sending too fast. Wait `X-Retry-After` seconds. See\nthe Rate Limits guide.\n","headers":{"X-Tokens-Remaining":{"description":"Number of request tokens currently available.","schema":{"type":"integer"}},"X-Retry-After":{"description":"Seconds to wait before requests can resume.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseEnvelope"}}}},"Error":{"description":"The request could not be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseEnvelope"}}}}}},"paths":{"/orders/{order_id}/order-items/{item_id}":{"put":{"tags":["Order Items"],"summary":"Update Order Item","description":"Replaces a single line item and recalculates the order totals.\n\n{% hint style=\"warning\" %}\nAs with other update operations, the complete item must be passed. Any fields\nleft out will be updated as blank.\n{% endhint %}\n","operationId":"updateOrderItem","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderItemWrite"}}}},"responses":{"200":{"description":"The item was updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseEnvelope"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"429":{"$ref":"#/components/responses/RateLimited"},"default":{"$ref":"#/components/responses/Error"}}}}}}
```


---

# 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://help.orderdesk.com/api-documentation/v2-api-reference/order-items/update-order-item.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.
