> ## Documentation Index
> Fetch the complete documentation index at: https://docs.salesive.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update an order

> Update shopper-editable fields on the authenticated shopper's own order.

## Request

```http theme={null}
PATCH /orders/{id}
Authorization: Bearer {{token}}
x-shop-id: {{shopId}}
Content-Type: application/json

{
  "additionalInfo": [
    { "label": "Gift message", "value": "Happy birthday!" }
  ]
}
```

## Headers

| Header          | Type   | Description                                   |
| --------------- | ------ | --------------------------------------------- |
| `Authorization` | string | Provide the customer token as `Bearer <jwt>`. |
| `x-shop-id`     | string | Identify the shop that owns the order.        |
| `Content-Type`  | string | Always set to `application/json`.             |

## Path parameters

| Parameter | Type   | Required | Description           |
| --------- | ------ | -------- | --------------------- |
| `id`      | string | Yes      | The order's ObjectId. |

## Body parameters

At least one field must be provided. Only the shopper who placed the order can
update it.

| Field            | Type   | Required | Description                                                                           |
| ---------------- | ------ | -------- | ------------------------------------------------------------------------------------- |
| `additionalInfo` | array  | No       | Replaces the order's additional info. Each entry has `label` and `value` — see below. |
| `notes`          | string | No       | Free-text notes on the order (max 5000 characters).                                   |

### `additionalInfo` entries

| Field   | Type   | Required | Description                            |
| ------- | ------ | -------- | -------------------------------------- |
| `label` | string | Yes      | The field name (max 100 characters).   |
| `value` | string | No       | The field value (max 2000 characters). |

<Note>
  `additionalInfo` is replaced wholesale, not merged. Send the full list you want
  the order to end up with. Entries without a label are dropped and the list is
  capped at 50 entries.
</Note>

## Successful response

```json theme={null}
{
    "status": 200,
    "success": true,
    "message": "Order updated",
    "data": {
        "_id": "6a27d632289b87893fcbde35",
        "orderId": 17,
        "status": "pending",
        "additionalInfo": [
            { "label": "Gift message", "value": "Happy birthday!" }
        ],
        "notes": null,
        "subtotal": 45000,
        "shippingCost": 0,
        "total": 45675
    }
}
```

## Error response

```json theme={null}
{
    "status": 404,
    "success": false,
    "message": "Order not found",
    "data": {}
}
```


## OpenAPI

````yaml PATCH /orders/{id}
openapi: 3.1.0
info:
  title: Salesive Store API
  description: >-
    REST interface for querying products, categories, and merchandising banners
    exposed by Salesive storefronts.
  version: 1.0.0
servers:
  - description: Production
    url: https://store.salesive.com/api/v1
security:
  - BearerAuth: []
    ShopIdHeader: []
paths:
  /orders/{id}:
    patch:
      summary: Update order
      description: >-
        Update shopper-editable fields (additionalInfo, notes) on the
        authenticated shopper's own order.
      parameters:
        - $ref: '#/components/parameters/XShopIdHeader'
        - name: id
          in: path
          required: true
          description: The ID of the order to update
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateOrderRequest'
      responses:
        '200':
          description: Order updated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponse'
        '400':
          description: Invalid request body.
        '401':
          description: Unauthorized.
        '404':
          description: Order not found.
components:
  parameters:
    XShopIdHeader:
      name: x-shop-id
      in: header
      description: >-
        Optional identifier that scopes responses to a specific storefront when
        the referer cannot be inferred.
      required: false
      schema:
        type: string
  schemas:
    UpdateOrderRequest:
      type: object
      minProperties: 1
      properties:
        additionalInfo:
          type: array
          maxItems: 50
          items:
            $ref: '#/components/schemas/AdditionalInfoItem'
          description: >-
            Replaces the order's additional info with this list of labelled
            key/value entries.
        notes:
          type: string
          maxLength: 5000
          description: Free-text notes on the order.
      description: At least one field must be provided.
    OrderResponse:
      type: object
      required:
        - status
        - success
        - message
        - data
      properties:
        status:
          type: integer
        success:
          type: boolean
        message:
          type: string
        data:
          $ref: '#/components/schemas/Order'
    AdditionalInfoItem:
      type: object
      required:
        - label
      properties:
        label:
          type: string
          maxLength: 100
          description: The name of the field (e.g. "Gift message").
        value:
          type: string
          maxLength: 2000
          description: The field value.
    Order:
      type: object
      required:
        - _id
        - orderId
        - user
        - shop
        - items
        - status
        - subtotal
        - shippingCost
        - total
      properties:
        _id:
          type: string
          description: Order identifier.
        orderId:
          type: integer
          description: Human-readable order number.
        user:
          type: string
          description: Identifier of the shopper who placed the order.
        shop:
          type: string
          description: Identifier of the shop associated with the order.
        items:
          type: array
          items:
            $ref: '#/components/schemas/OrderItem'
        status:
          type: string
          enum:
            - pending
            - processing
            - paid
            - cancelled
            - refunded
          description: Current status of the order.
        subtotal:
          type: number
          description: Subtotal before shipping costs.
        shippingCost:
          type: number
          description: Shipping cost for the order.
        total:
          type: number
          description: Total order amount (subtotal + shippingCost).
        shippingAddress:
          $ref: '#/components/schemas/OrderAddress'
        payment:
          type: string
          description: Payment identifier.
        shipment:
          type: string
          description: Shipment identifier.
        notes:
          type: string
          description: Additional order notes.
        additionalInfo:
          type: array
          items:
            $ref: '#/components/schemas/AdditionalInfoItem'
          description: Custom labelled key/value info attached to the order.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    OrderItem:
      type: object
      required:
        - product
        - name
        - price
        - quantity
      properties:
        product:
          type: string
          description: Product identifier.
        variant:
          type: string
          description: Variant identifier if applicable.
        name:
          type: string
          description: Product name.
        sku:
          type: string
          description: Product SKU.
        price:
          type: number
          description: Unit price at time of order.
        quantity:
          type: integer
          minimum: 1
          description: Quantity ordered.
        variantAttributes:
          type: object
          additionalProperties:
            type: string
        imageUrl:
          type: string
          format: uri
    OrderAddress:
      type: object
      required:
        - fullName
        - addressLine1
        - city
        - state
        - zipCode
        - country
        - phoneNumber
      properties:
        fullName:
          type: string
        addressLine1:
          type: string
        addressLine2:
          type: string
        city:
          type: string
        state:
          type: string
        zipCode:
          type: string
        country:
          type: string
        phoneNumber:
          type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT issued by the Salesive Store API for authenticated shoppers.
    ShopIdHeader:
      type: apiKey
      in: header
      name: x-shop-id
      description: >-
        Optional storefront identifier sent as a header to scope responses to a
        specific shop. Try It requests remember this value once provided.

````