> For the complete documentation index, see [llms.txt](https://apidocs.akinon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.akinon.com/commerce-openapis/admin/orders/order-items/create-an-order-item.md).

# Create an order item

Creates a new order item on an existing order. One order item represents one unit of the product, so an add of three units is three separate requests.

Creation runs through the order service, which applies the following on top of the submitted payload:

* **`extra_field` is overwritten.** Whatever is sent is discarded and replaced with `{"price_extra_field": …, "stock_extra_field": …}` — a snapshot of the `extra_field` values of the price and stock records the item is sold from (the `extra_product_price` / `extra_product_stock` records when given, otherwise the product's own price and stock records).
* **The status may be forced.** If the parent order is in status `300` (`payment_waiting`), the new item is stored with status `300` regardless of the submitted `status`.
* The item's sold quantity is **not** reported at creation; that happens on the first status change away from `waiting` / `payment_waiting`.

The product must already have a price record **and** a stock record, because both are read to build the `extra_field` snapshot. This is **not validated**, so make sure the records exist before posting. Supplying `extra_product_price` / `extra_product_stock` covers the corresponding record, exactly as it does when the snapshot is built.

The response is the `OrderItemCreated` shape, which differs from the shape returned by the list and retrieve endpoints: the identifier is `id` rather than `pk`, `order`, `created_date`, `modified_date` and the `localized_attributes` pair are present, and there are no nested detail objects, no `product_sku` and no `discounted_price`.

`image` can be uploaded by sending the request as `multipart/form-data`.

```json
{"openapi":"3.1.0","info":{"title":"Admin API","version":"1.0.0"},"tags":[{"name":"Order Items","description":"Administrative endpoints for **order items** — the individual line items of an order. An order item represents a single unit of one product within an order and carries its own status, price, tax rate, invoice data, shipping and tracking details, and free-form EAV attributes.\n\nOrder items are created by the checkout flow together with their parent order. These endpoints exist so that Omnitron and integration systems can read line items and push per-item fulfilment updates back into Commerce — status transitions, invoice numbers, tracking numbers, shipping companies, and shipped / delivered dates.\n\nBecause one order item represents exactly one unit, an order for three of the same product is stored as three separate order items. An item that was added to the basket as a child of another item — an add-on or bundled product, or a trade-in attached to a purchase — points at the order item it belongs to through `parent`, which is always another item of the same order.\n\n## Core Capabilities\n\n**1. Order Item Listing & Filtering**\n* Retrieve a paginated list of order items, ordered by ascending identifier.\n* Filter on almost every order-item field, and on the parent order's fields through `order__` traversal.\n* Change the ordering with the `sort` parameter.\n\n**2. Order Item Retrieval**\n* Retrieve a single order item by its identifier.\n\n**3. Order Item Creation**\n* Create an order item on an existing order. Creation runs through the order service, which overwrites `extra_field` with a snapshot of the price-list and stock-list `extra_field` values and forces the item status to `300` (`payment_waiting`) when the parent order is in that status.\n\n**4. Order Item Update**\n* Partially update an order item — primarily to advance `status` and to write invoice, tracking, shipping and delivery data.\n* Every successful update runs a set of per-item post-update actions (notifications, e-mail, SMS, subscription dispatch, basket-offer revocation) whose behaviour is controlled by the dynamic settings listed at the end of this section.\n\n**5. Deletion is not allowed**\n* `DELETE /order_items/{id}/` always fails with `406 Not Acceptable` and the error code `method_100`. Order items are never removed; cancel or refund an item by moving its `status` to `100` (`cancelled`) or `600` (`refunded`) instead.\n\n## Request and Response Shapes\n\nThe read, create and update shapes are different objects and are **not** interchangeable:\n\n| Operation | Request schema | Response schema |\n|-----------|----------------|-----------------|\n| `GET /order_items/` | — | `PaginatedOrderItemList` (items are `OrderItem`) |\n| `GET /order_items/{id}/` | — | `OrderItem` |\n| `POST /order_items/` | `OrderItemCreateRequest` | `OrderItemCreated` |\n| `PUT /order_items/{id}/` | `OrderItemUpdateRequest` | `OrderItem` |\n| `PATCH /order_items/{id}/` | `OrderItemPatchRequest` | `OrderItem` |\n\nThe read shape (`OrderItem`) identifies the record with `pk` and adds the parent product's `product_sku`, the nested `extra_product_price_detailed` / `extra_product_stock_detailed` / `datasource_detailed` objects, and the computed `discounted_price`. The create response (`OrderItemCreated`) identifies the record with `id` instead and exposes `order`, `created_date`, `modified_date` and the `localized_attributes` pair, but carries none of the nested detail objects and no `product_sku` or `discounted_price`. Do not assume that a field present in one shape exists in the other.\n\n## Order Item Statuses\n\nAn order item's `status` moves independently of its parent order's status, which is what makes partial shipment and partial cancellation possible. Values are numeric strings from the same set the order uses.\n\n| Value | Name | Description |\n|-------|------|-------------|\n| `50` | `cancellation_waiting` | Cancellation has been requested for this item and is pending. |\n| `100` | `cancelled` | The item has been cancelled. |\n| `200` | `waiting` | The item has been created but payment has not yet been confirmed. |\n| `300` | `payment_waiting` | Payment has been initiated and is waiting for confirmation. |\n| `350` | `confirmation_waiting` | The item is awaiting manual confirmation. |\n| `400` | `approved` | Payment confirmed; the item is approved for fulfilment. |\n| `430` | `waiting_for_substitute` | Waiting for a substitute product. |\n| `450` | `preparing` | The item is being prepared / packed. |\n| `500` | `shipped` | The item has been dispatched to the carrier. |\n| `510` | `shipped_and_informed` | The item has been shipped and the customer has been notified. |\n| `520` | `ready_for_pickup` | The item is ready for in-store collection. |\n| `540` | `attempted_delivery` | A delivery attempt was made but the recipient was unavailable. |\n| `544` | `review_started` | A trade-in review has been started for the item. |\n| `545` | `review_waiting` | A trade-in review is waiting. |\n| `546` | `waiting_for_payment` | Waiting for trade-in payment. |\n| `547` | `paid` | Trade-in payment received. |\n| `550` | `delivered` | The item has been delivered to the customer. |\n| `600` | `refunded` | The item has been refunded. |\n| `700` | `merged` | Order-level value carried over from the shared status enum — it marks an add-on *order* that was merged into a main order. The platform does not set it on order items; it is accepted here only because items reuse the order status enum. |\n\n## Update Semantics\n\n* `PATCH` writes only the fields present in the request body; every other field keeps its current value. `modified_date` is always refreshed. Leaving `status` out means \"do not change the status\", and none of the status-gated post-update actions run.\n* **`attributes` is merged, not replaced.** The submitted object is merged key by key into the stored one, so existing keys that are not mentioned survive and a key sent again is overwritten. There is no way to delete an attribute key through this endpoint.\n* `attributes_kwargs` and `extra_field` are **replaced** with whatever is submitted. `localized_attributes` and `localized_attributes_kwargs` are not part of the update shape at all — they can be set at creation but are silently ignored on `PATCH`.\n* `order` cannot be changed after creation — it is not part of the update shapes and is ignored if sent.\n* **Status transition side effects.** When `status` changes while the item is still in `200` (`waiting`) or `300` (`payment_waiting`), the **unreported** sold-quantity counter (`sold_quantity_unreported`) on the item's stock record — its `extra_product_stock` when set, otherwise the product's own stock record — is decremented, marking the sale as reported. It is reduced by one for an ordinary item; for a product sold by weight it is reduced by the item's unit amount rounded up to whole units, and for a quantity-mergeable product by the unit amount stored on the item. It never goes below zero. After the item is saved, the post-update actions run — see **Post-Update Actions** below.\n* **`PUT` and `PATCH` behave the same way, apart from which fields are required.** Both write only the fields present in the body — `PUT` does not reset the fields you leave out. `PUT` requires `product`, `status`, `price_currency`, `price` and `tax_rate`; `PATCH` requires nothing. Use `PATCH` unless you have a reason to send the full record.\n* **`product_sku` is read-only** and is ignored on write, so a body read from `GET` can be sent straight back without stripping it. To point an item at a different product, send `product`; `product_sku` in the response then reflects the new product.\n* `discount_amount` is validated against the item's `price`: it must be greater than or equal to `0` and less than or equal to `price`. `discounted_price` in the response is `price - discount_amount` and is computed, never stored.\n\n## Post-Update Actions\n\nThe item is saved in its own transaction, and the post-update actions then run **synchronously, outside that transaction, before the response is returned**. Two consequences matter in practice: a slow gateway makes the request slow, and a failing action fails the request even though the item has already been saved and committed. Only the ready-for-pickup action swallows its own errors; the rest do not.\n\nWhich actions run depends on whether `status` actually changed — the handler compares the submitted `status` with the stored one:\n\n| Action | Runs when |\n|--------|-----------|\n| Partial shipping e-mail, SMS and push notification | `status` changed to `500` (`shipped`) **and** `tracking_number` is set **and** `SEND_SHIPPING_NOTIFICATIONS_PARTIALLY` is `true`. |\n| Partial delivery e-mail and push notification | `status` changed to `550` (`delivered`) **and** `SEND_SHIPPING_DELIVERED_NOTIFICATIONS_PARTIALLY` is `true`. |\n| Per-item cancellation push notification | `status` changed to `100` (`cancelled`) **and** `SEND_ORDER_CANCELLED_NOTIFICATIONS_PARTIALLY` is `true`. |\n| Ready-for-pickup e-mail | `status` moved from `400` (`approved`) or `450` (`preparing`) to `520` (`ready_for_pickup`) **and** the order ships to a retail-store address. Errors are logged and swallowed. |\n| Subscription (marketing) dispatch | `status` changed **and** `SUBSCRIPTION_ACTIVE` is `true`. |\n| Trade-in e-mail | Every update while the item sits in `544` / `545` with an unresolved `inquiry` and `SEND_TRADEIN_MAIL_CASE` is `true` — **not** limited to status changes. |\n| Post-order basket-offer revocation | Every update while the item's `status` is `100` (`cancelled`) or `600` (`refunded`) and it is tied to a completed post-order action — **not** limited to status changes. Re-running it is a no-op once the offer has been revoked. |\n\nLeaving `status` out of a `PATCH`, or re-sending the item's current value, both count as \"unchanged\": the status-gated actions in the table above are then skipped, while the last two still run.\n\n## Filtering\n\nA filter is available for every order-item field. Text fields match on a **case-insensitive partial match**, and the remaining fields match exactly:\n\n| Parameters | Match |\n|-----------|-------|\n| `status`, `price_currency`, `shipping_company`, `defined_shipping_company`, `invoice_number`, `tracking_number`, `defined_tracking_url`, `e_archive_url`, `shipping_tracking_url` | Case-insensitive partial match. On the nullable ones, `NULL_VALUE` returns only records where the field is empty and `NOT_NULL_VALUE` only records where it is set. `status` and `price_currency` are never null, so `NULL_VALUE` returns an empty page for them. |\n| `price`, `retail_price`, `tax_rate`, `discount_amount` | Exact numeric match. |\n| `product`, `parent`, `order`, `extra_product_price`, `extra_product_stock`, `datasource`, `shipping_option_group` | Exact identifier match. An identifier that does not exist is rejected with `400`. |\n| `created_date`, `modified_date`, `invoice_date`, `shipped_date`, `delivered_date` | Exact ISO 8601 date-time match. |\n| `estimated_delivery_date` | Exact date match. |\n| `image` | Exact match on the stored file path. |\n| `attributes` | Filtered by JSON path — see **Filtering on `attributes`** below. |\n| `attributes_kwargs`, `localized_attributes`, `localized_attributes_kwargs`, `extra_field` | **Not usable** — see the note below `attributes`. |\n\n**There is no `id` or `pk` filter.** To read a single item by its identifier use `GET /order_items/{id}/`.\n\n**`status` is a substring match, not an exact one.** Because the status column stores numeric strings and the filter matches partially, `?status=50` also returns items whose status is `500` or `550`, and `?status=0` returns almost everything. Prefer a value that is not a prefix or infix of another status, or filter on the parent order instead.\n\n**Parent order filters.** The parent order is traversable with a double underscore: `order__id`, `order__status` (exact), `order__number`, `order__user_email`, `order__is_payable`, `order__easy_return_code`, and `order__created_date` with the `__gt`, `__gte`, `__lt`, `__lte`, `__date__gt`, `__date__gte`, `__date__lt` and `__date__lte` lookups. `order=<id>` filters by the parent order's identifier directly.\n\n**Negation.** Appending `!` to any filter parameter excludes the matching records instead of selecting them — `?status!=400` returns every item that is *not* approved.\n\n**Filtering on `attributes`.** Address a key inside the item's EAV attributes with a double underscore — `?attributes__color=red`, or `?attributes__tax__total=12.00` for a nested key. The value is matched as a **case-insensitive substring** of the stored value's text form, so `?attributes__color=re` matches `red`.\n\n| Form | Meaning |\n|------|---------|\n| `?attributes__<key>=<value>` | Case-insensitive substring match on that key. |\n| `?attributes__<key>=<a>,<b>` | Several values for one key are **OR**-ed. |\n| `?attributes__<k1>=<a>&attributes__<k2>=<b>` | Different keys are **AND**-ed. |\n| `?attributes__<key>__exact=<value>` | Exact match instead of a substring. |\n| `?attributes__<key>__isnull=true` | Selects items where the key is absent; `false` selects items that have it. |\n\nThree forms are **not supported** and must be avoided by the caller:\n\n* **A value with no key path** (`?attributes=red`) — always address a key inside the field.\n* **A path segment named after a query lookup** (`?attributes__color__gt=a`, `?attributes__color__icontains=red`) — the segment is resolved as that lookup rather than as a key. Only the `__exact` and `__isnull` suffixes are recognised; every other segment must be an actual key name.\n* **The `!` exclusion suffix on a path** (`?attributes__color!=red`) — negation is resolved against filter names, not JSON paths, so `color!` is looked up as a key that does not exist and the page comes back empty. Do not read that as \"no item matches\".\n\nThe same applies to the other endpoints that filter on a JSON field, such as `/users/`.\n\n**`attributes` is the only usable JSON filter.** `attributes_kwargs`, `localized_attributes`, `localized_attributes_kwargs` and `extra_field` are not wired up for path traversal, so do not send those parameters at all: their path form (`?extra_field__foo=x`) is not a filter name and is ignored like any unknown parameter, and the bare form (`?extra_field=x`) is not usable either.\n\n**Unknown query parameters are ignored** rather than rejected.\n\n## Sorting\n\nWithout a `sort` parameter, results come back ordered by ascending identifier. `sort` accepts a comma-separated list of fields; prefix a field with a hyphen for descending order.\n\nSortable fields: `pk`, `product`, `product__sku`, `status`, `price_currency`, `price`, `tax_rate`, `retail_price`, `discount_amount`, `invoice_number`, `invoice_date`, `e_archive_url`, `tracking_number`, `defined_tracking_url`, `shipping_company`, `defined_shipping_company`, `shipping_tracking_url`, `estimated_delivery_date`, `shipped_date`, `delivered_date`, `parent`, `extra_product_price`, `extra_product_stock`, `datasource`, `shipping_option_group`, `image`, `attributes`, `attributes_kwargs`, `extra_field`.\n\n`discounted_price` is computed and cannot be sorted on; `created_date` and `modified_date` are not part of the read shape and are not sortable either. Unrecognised `sort` values are silently ignored rather than rejected.\n\n## Dynamic Settings & Environment Variables\n\nNone of the settings below affect `GET` responses. They all take effect on the post-update actions that run after a successful `PATCH` (or `PUT`) of an order item; `POST` triggers none of them.\n\n| Key | Type | Default | Effect on `PATCH`/`PUT` |\n|-----|------|---------|-------------------------|\n| `SEND_SHIPPING_NOTIFICATIONS_PARTIALLY` | boolean | `false` | When `true`, moving an item's `status` to `500` (`shipped`) while its `tracking_number` is set schedules a partial-shipment e-mail, SMS and push notification for the parent order, debounced per order + shipping company + tracking number. When `false`, nothing is sent per item and the notification is instead sent once by `PUT`/`PATCH /orders/{id}/` when the whole order reaches `shipped`. |\n| `SEND_SHIPPING_DELIVERED_NOTIFICATIONS_PARTIALLY` | boolean | `false` | When `true`, moving an item's `status` to `550` (`delivered`) schedules a partial-delivery e-mail and push notification. When `false`, delivery is announced once at order level. |\n| `SEND_ORDER_CANCELLED_NOTIFICATIONS_PARTIALLY` | boolean | `false` | When `true`, moving an item's `status` to `100` (`cancelled`) schedules a cancellation notification for the parent order, debounced per order so items cancelled together collapse into a single message. When `false`, the notification is sent once when the whole order is cancelled. |\n| `SEND_TRADEIN_MAIL_CASE` | boolean | `false` | When `true` and the item carries an `inquiry` entry in `attributes` that has not yet been confirmed or rejected, an update leaves the item in `544` (`review_started`) or `545` (`review_waiting`) sends the matching trade-in e-mail. This action is **not** gated on the status actually changing, so a later update that only touches another field re-sends the e-mail while the item is still in one of those two statuses. |\n| `SUBSCRIPTION_ACTIVE` | boolean | `false` | When `true`, every `status` change dispatches the updated item to the configured subscription (marketing) gateway. When `false`, no dispatch happens. |\n| `SUBSCRIPTION_GATEWAY` | string / `null` | `null` | Name of the subscription gateway the item update is dispatched to. Must match a key in `SUBSCRIPTION_GATEWAYS`. |\n| `SUBSCRIPTION_GATEWAYS` | object | `{}` | Configuration map of the available subscription gateways. Keys are gateway names; values are gateway-specific config objects. |\n| `ACTIVE_SUBSCRIPTION_GATEWAYS` | array of strings | `[]` | The subscription gateway names that actually receive the dispatch. |\n| `NOTIFICATION_GATEWAY` | string | `\"\"` | Name of the active push-notification gateway. While it is empty, every push notification triggered by an item update is silently skipped. Must match a key in `NOTIFICATION_GATEWAYS`. |\n| `NOTIFICATION_GATEWAYS` | object | `{\"console\": {\"conf\": {}}}` | Configuration map for the available push-notification gateways. Keys are gateway names; values are gateway-specific config objects. |\n| `SMS_GATEWAY` | string | `\"console\"` | Name of the active SMS gateway used by the partial-shipment SMS. `\"console\"` logs to stdout without sending. Must match a key in `SMS_GATEWAYS`. |\n| `SMS_GATEWAYS` | object | `{\"console\": {\"conf\": {\"verify_message\": \"Verification code: {}\"}}}` | Configuration map for the available SMS gateways. Keys are gateway names; values are gateway-specific config objects. |\n| `EMAIL_BCC_AND_CC` | object | every e-mail template mapped to `{\"bcc\": [], \"cc\": []}` | Per-template BCC and CC addresses for the e-mails sent by these actions. Keys are e-mail template names (`orders_partial_cargo`, `orders_partial_delivered_cargo`, `order_ready_for_pickup`); values are `{\"bcc\": [...], \"cc\": [...]}`. |\n| `DISABLED_EMAIL_TEMPLATES` | object | every template `false`, except `orders_preparing` which is `true` | Per-template kill switch for outbound e-mail. When the template used by one of the actions above is set to `true`, that e-mail is skipped at send time while the SMS and push notification still go out. |\n| `ORDERS_REFUNDABLE_DAYS` | integer / `null` | `null` | The number of days after ordering within which an item may be returned. Read by the order-item model but **not** exposed by these endpoints; it changes no request or response field here. |\n\nEvery dynamic setting above falls back to the Django setting of the same name as its initial default, so a value set in the deployment's settings acts as the default until it is overridden in the dynamic-settings store.\n\n**Environment variables:** No environment variables are read directly by these endpoints."}],"servers":[{"description":"Omnitron Remote Proxy (external access — recommended)","url":"https://{omnitron_url}/api/v1/remote/{channel_id}","variables":{"omnitron_url":{"default":"sandbox.akinon.com","description":"Omnitron server URL (e.g., {omnitron.akinon.com})"},"channel_id":{"default":"1","description":"The channel identifier the remote request is routed through"}}},{"description":"Commerce API Server (internal / direct access only)","url":"https://{commerce_url}/api/v1","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Internal commerce server URL, reachable only from within the Omnitron network"}}}],"security":[{"tokenAuth":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token credential sent in the Authorization header, in the form: `Token <your-token>`. Requires a staff (admin) account."}},"schemas":{"OrderItemCreateRequest":{"type":"object","description":"The payload accepted by `POST /order_items/`.\n\n`extra_field` is accepted but discarded — the service overwrites it with the price-list and stock-list snapshot. `product_sku` is not part of this shape and is ignored if sent.","required":["order","product","status","price_currency","price","tax_rate"],"properties":{"order":{"type":"integer","description":"The identifier of the order the item belongs to. Cannot be changed afterwards."},"product":{"type":"integer","description":"The identifier of the ordered product. The product must have a price record and a stock record, since both are read to build the `extra_field` snapshot; supplying `extra_product_price` / `extra_product_stock` covers the corresponding record instead. This is not validated, so make sure the records exist."},"status":{"$ref":"#/components/schemas/OrderStatus"},"price_currency":{"$ref":"#/components/schemas/OrderItemCurrency"},"price":{"type":"string","format":"decimal","description":"The unit price charged for this item, tax included."},"tax_rate":{"type":"string","format":"decimal","description":"The VAT rate applied to `price`, as a percentage."},"retail_price":{"type":["string","null"],"format":"decimal","description":"The recommended retail price."},"discount_amount":{"type":["string","null"],"format":"decimal","default":"0","description":"The discount applied to this item. Must be between `0` and `price`, inclusive."},"parent":{"type":["integer","null"],"description":"The identifier of the order item this one is derived from."},"invoice_number":{"type":["string","null"],"maxLength":32},"invoice_date":{"type":["string","null"],"format":"date-time"},"e_archive_url":{"type":["string","null"],"format":"uri","maxLength":1024},"tracking_number":{"type":["string","null"],"maxLength":256},"shipping_company":{"description":"The carrier shipping this item.","oneOf":[{"$ref":"#/components/schemas/OrderShippingCompany"},{"type":"null"}]},"defined_shipping_company":{"type":["string","null"],"maxLength":32},"defined_tracking_url":{"type":["string","null"],"format":"uri","maxLength":512},"shipping_tracking_url":{"type":["string","null"],"format":"uri","maxLength":500},"estimated_delivery_date":{"type":["string","null"],"format":"date"},"shipped_date":{"type":["string","null"],"format":"date-time"},"delivered_date":{"type":["string","null"],"format":"date-time"},"image":{"type":["string","null"],"format":"binary","description":"The item's product image. Send the request as `multipart/form-data` to upload a file."},"attributes":{"type":["object","null"],"description":"Free-form EAV attributes of the item."},"attributes_kwargs":{"type":["object","null"]},"localized_attributes":{"type":["object","null"],"description":"Per-language attribute values, keyed by language code."},"localized_attributes_kwargs":{"type":["object","null"]},"extra_field":{"type":["object","null"],"description":"Accepted but ignored — the service replaces it with the price-list and stock-list snapshot."},"extra_product_price":{"type":["integer","null"],"description":"The extra product-price record to sell the item at instead of the product's primary price."},"extra_product_stock":{"type":["integer","null"],"description":"The extra product-stock record to reserve the item from instead of the product's primary stock."},"datasource":{"type":["integer","null"],"description":"The seller / data source fulfilling the item."},"shipping_option_group":{"type":["integer","null"],"description":"The shipping option group the item is shipped under."}}},"OrderStatus":{"type":"string","description":"The lifecycle status of an order. Values are numeric strings that increase as the order progresses through its lifecycle.\n\n| Value | Name | Description |\n|-------|------|-------------|\n| `50` | `cancellation_waiting` | Cancellation requested, pending. |\n| `100` | `cancelled` | Order cancelled. |\n| `200` | `waiting` | Order created; payment not yet confirmed. |\n| `300` | `payment_waiting` | Payment initiated, awaiting confirmation. |\n| `350` | `confirmation_waiting` | Awaiting manual confirmation. |\n| `400` | `approved` | Payment confirmed; order approved for fulfilment. |\n| `430` | `waiting_for_substitute` | Waiting for a substitute product. |\n| `450` | `preparing` | Order being prepared / packed. |\n| `500` | `shipped` | Order dispatched to carrier. |\n| `510` | `shipped_and_informed` | Order shipped and customer notified. |\n| `520` | `ready_for_pickup` | Ready for in-store collection. |\n| `540` | `attempted_delivery` | Delivery attempted; recipient unavailable. |\n| `544` | `review_started` | Trade-in review started. |\n| `545` | `review_waiting` | Trade-in review waiting. |\n| `546` | `waiting_for_payment` | Waiting for trade-in payment. |\n| `547` | `paid` | Trade-in payment received. |\n| `550` | `delivered` | Order delivered to customer. |\n| `600` | `refunded` | Order refunded. |\n| `700` | `merged` | Add-on order merged into main order. |","enum":["50","100","200","300","350","400","430","450","500","510","520","540","544","545","546","547","550","600","700"]},"OrderItemCurrency":{"type":"string","description":"ISO 4217 currency code the order item's price is expressed in.","enum":["try","eur","usd","egp","gbp","mad","pln","sar","ron","uah","czk","huf","rub","bgn","iqd","kwd","bhd","omr","qar","aed","ngn","inr","lei","kzt","jod","rsd","amd","cfa","lyd"]},"OrderShippingCompany":{"type":"string","description":"Carrier company used to ship the order.","enum":["acs","apiship","aramex","aramex_express","aras","arvato","asil","ay_cargo","b2c_direct","birgunde","bolt","boomex","bovo","boxaty","bpost_24_7","bpost_athome","bpost_international","bpost_pickup","bringo","bringo_express","cainiao","cargus","carriyo","carrtell","cathedis","cdek","ceva_cargo","chrono","city_express","clickpost","deliverigo","dhlexpress","dincer","dpd","droplight","evdemo_lojistik","extension","falcon_flex","fancourier","fareye","fast_cargo","fero_ai","gelal","giz","gkn","gls","hbexpress","hjetxl","hoopkapida","horoz","iMile","in_post","ismail","jetizz","jetizz_v7","jetlogi","k_gelsin","k_sende","kargo_ist","loomis","mng","monist","murat_lgc","mylerz","mylerzsdd","netkargo","novaposhta","octovan_express","other","packupp","pakettaxi","pinkpost","pony_express","porter_express","pts_express","ptt","r2s","rupost","sameday","scotty","sendeo","shipx","sky_express","speedy","speeta","surat","svuum","tmmexpress","tnt_cargo","tyexpress","ups","ups_intl","yurtici"]},"OrderItemCreated":{"type":"object","description":"The order item as returned by `POST /order_items/`.\n\nThis shape identifies the record with `id` (not `pk`), includes `order`, `created_date`, `modified_date` and the `localized_attributes` pair, and has no nested detail objects, no `product_sku` and no `discounted_price`. Re-read the item through `GET /order_items/{id}/` to get the full read shape.","properties":{"id":{"type":"integer","readOnly":true,"description":"The unique identifier of the created order item."},"order":{"type":"integer","description":"The identifier of the order the item belongs to."},"product":{"type":"integer","description":"The identifier of the ordered product."},"parent":{"type":["integer","null"]},"status":{"$ref":"#/components/schemas/OrderStatus"},"price_currency":{"$ref":"#/components/schemas/OrderItemCurrency"},"price":{"type":"string","format":"decimal"},"tax_rate":{"type":"string","format":"decimal"},"retail_price":{"type":["string","null"],"format":"decimal"},"discount_amount":{"type":["string","null"],"format":"decimal"},"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"When the order item was created."},"modified_date":{"type":"string","format":"date-time","readOnly":true,"description":"When the order item was last modified."},"attributes":{"type":["object","null"]},"attributes_kwargs":{"type":["object","null"]},"localized_attributes":{"type":["object","null"],"description":"Per-language attribute values, keyed by language code."},"localized_attributes_kwargs":{"type":["object","null"]},"invoice_number":{"type":["string","null"]},"invoice_date":{"type":["string","null"],"format":"date-time"},"e_archive_url":{"type":["string","null"],"format":"uri"},"tracking_number":{"type":["string","null"]},"defined_tracking_url":{"type":["string","null"],"format":"uri"},"shipping_tracking_url":{"type":["string","null"],"format":"uri"},"shipping_company":{"oneOf":[{"$ref":"#/components/schemas/OrderShippingCompany"},{"type":"null"}]},"defined_shipping_company":{"type":["string","null"]},"image":{"type":["string","null"],"format":"uri"},"extra_field":{"type":["object","null"],"description":"The price-list and stock-list snapshot written by the service, in the form `{\"price_extra_field\": …, \"stock_extra_field\": …}`."},"estimated_delivery_date":{"type":["string","null"],"format":"date"},"shipped_date":{"type":["string","null"],"format":"date-time"},"delivered_date":{"type":["string","null"],"format":"date-time"},"extra_product_price":{"type":["integer","null"]},"extra_product_stock":{"type":["integer","null"]},"datasource":{"type":["integer","null"]},"shipping_option_group":{"type":["integer","null"]}}},"ValidationError":{"type":"object","description":"Returned when the request contains invalid or missing data. Errors are grouped by the field they apply to: each key is the name of a field from the request and its value is a list of one or more messages describing what is wrong with that field. Messages that do not belong to any single field are grouped under `non_field_errors`.","properties":{"non_field_errors":{"type":"array","description":"Error messages that apply to the request as a whole rather than to a specific field.","items":{"type":"string"}}},"additionalProperties":{"type":"array","description":"The list of error messages for the field named by the key.","items":{"type":"string"}}},"Error":{"type":"object","description":"An error response.","properties":{"detail":{"type":"string","description":"A human-readable description of the error."}},"additionalProperties":true}},"responses":{"ValidationError":{"description":"The request contains invalid or missing data.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}},"Unauthorized":{"description":"Authentication credentials were not provided or are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"The authenticated user does not have administrator privileges.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/order_items/":{"post":{"tags":["Order Items"],"operationId":"createOrderItem","summary":"Create an order item","description":"Creates a new order item on an existing order. One order item represents one unit of the product, so an add of three units is three separate requests.\n\nCreation runs through the order service, which applies the following on top of the submitted payload:\n\n* **`extra_field` is overwritten.** Whatever is sent is discarded and replaced with `{\"price_extra_field\": …, \"stock_extra_field\": …}` — a snapshot of the `extra_field` values of the price and stock records the item is sold from (the `extra_product_price` / `extra_product_stock` records when given, otherwise the product's own price and stock records).\n* **The status may be forced.** If the parent order is in status `300` (`payment_waiting`), the new item is stored with status `300` regardless of the submitted `status`.\n* The item's sold quantity is **not** reported at creation; that happens on the first status change away from `waiting` / `payment_waiting`.\n\nThe product must already have a price record **and** a stock record, because both are read to build the `extra_field` snapshot. This is **not validated**, so make sure the records exist before posting. Supplying `extra_product_price` / `extra_product_stock` covers the corresponding record, exactly as it does when the snapshot is built.\n\nThe response is the `OrderItemCreated` shape, which differs from the shape returned by the list and retrieve endpoints: the identifier is `id` rather than `pk`, `order`, `created_date`, `modified_date` and the `localized_attributes` pair are present, and there are no nested detail objects, no `product_sku` and no `discounted_price`.\n\n`image` can be uploaded by sending the request as `multipart/form-data`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderItemCreateRequest"}},"multipart/form-data":{"schema":{"$ref":"#/components/schemas/OrderItemCreateRequest"}}}},"responses":{"201":{"description":"The created order item.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderItemCreated"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}}}}
```


---

# 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://apidocs.akinon.com/commerce-openapis/admin/orders/order-items/create-an-order-item.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.
