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

# Update order

> Updates the values of an order. Requires permission `edit/order`.
Only `values`, `externalRef`, `hubId` and `expectedUpdatedTime` are accepted; any other key is refused. Values are merged (send only the fields you change). The hub cannot change (sending the current one is allowed). Changing the first field changes the order number, which must stay unique.
Pass `expectedUpdatedTime` to refuse the update with 409 if the order changed since you read it. Final orders cannot be edited. Open tasks that use a changed value are listed in `warnings` (`ord-093`).



## OpenAPI

````yaml /openapi/public/openapi-order.json put /order/{id}
openapi: 3.0.0
info:
  title: API - Order
  version: 3.0.0
  description: API Documentation - RESTful API for field operations management.
servers:
  - url: https://apiweb.mile.app/api/v3
security:
  - bearerAuth: []
tags:
  - name: Order
    description: >-
      An order is a customer request that moves through the steps of its order
      type, for example receive, pick, deliver. Each step can create tasks, wait
      for a status, or call another system. These endpoints are served under
      `/api/v4` and need the Order Management add-on.
paths:
  /order/{id}:
    servers:
      - url: https://apiweb.mile.app/api/v4
    put:
      tags:
        - Order
      summary: Update order
      description: >-
        Updates the values of an order. Requires permission `edit/order`.

        Only `values`, `externalRef`, `hubId` and `expectedUpdatedTime` are
        accepted; any other key is refused. Values are merged (send only the
        fields you change). The hub cannot change (sending the current one is
        allowed). Changing the first field changes the order number, which must
        stay unique.

        Pass `expectedUpdatedTime` to refuse the update with 409 if the order
        changed since you read it. Final orders cannot be edited. Open tasks
        that use a changed value are listed in `warnings` (`ord-093`).
      operationId: updateOrder
      parameters:
        - name: id
          in: path
          required: true
          description: |-
            Unique identifier for the order that generated by system.
            **Example**: `6710c3d4e5f6a7b8c9d0e1f2`
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderUpdateRequest'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Status of response.
                  message:
                    description: Message of API response.
                    type: string
                  data:
                    description: Detail of the order.
                    type: object
                    additionalProperties: true
                example:
                  status: true
                  message: Order updated
                  data:
                    _id: 6710c3d4e5f6a7b8c9d0e1f2
                    orderTypeId: 6710a2f4c1d2e3f4a5b6c7d8
                    orderTypeName: Express Delivery
                    orderTypeVersion: 2
                    orderRefNumber: EXP-0001
                    externalRef: SO-2026-1001
                    hubId: 64d9932e2beb9037735ff022
                    hubName: Jakarta Hub
                    status: onDelivery
                    statusLabel: On delivery
                    statusCategory: inProgress
                    isFinal: false
                    values:
                      orderNo: EXP-0001
                      customerName: Rina
                      weight: 3
                    createdFrom: API
                    sourceTaskId: null
                    attention: null
                    activeSteps:
                      - stepId: pickup
                        title: Pickup
                        type: string
                        state: waitingTask
                        since: '2026-10-16T02:01:00.000+00:00'
                        taskIds:
                          - 6710d1e2f3a4b5c6d7e8f901
                    taskSummary:
                      total: 1
                      open: 1
                      done: 0
                    createdTime: '2026-10-16T02:00:00.000+00:00'
                    createdBy: admin@example.com
                    updatedTime: '2026-10-16T02:01:00.000+00:00'
                    statusUpdatedTime: '2026-10-16T02:01:00.000+00:00'
                  warnings:
                    - code: ord-093
                      params:
                        taskId: 6710d1e2f3a4b5c6d7e8f901
                        stepId: pickup
                        fields:
                          - values.weight
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Bad request - invalid parameters provided.
        '404':
          description: Data not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Data not found
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Bad request - invalid parameters provided.
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Internal server error, please contact support@mile.app.
      deprecated: false
      security:
        - bearerAuth: []
components:
  schemas:
    OrderUpdateRequest:
      example:
        values:
          weight: 3
        expectedUpdatedTime: '2026-10-16T02:01:00.000+00:00'
      type: object
      properties:
        values:
          type: object
          description: >-
            Values to change, keyed by field id of the latest published version;
            merged into the current values. Same formats as **Create order**.
          additionalProperties: true
        externalRef:
          type: string
          description: Your own reference. Max 200 characters.
        hubId:
          type: string
          description: Must equal the current hub; the hub of an order cannot change.
        expectedUpdatedTime:
          type: string
          description: >-
            The `updatedTime` you read. When given and the order changed since,
            the update is refused with 409.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Use a valid Bearer token to authenticate.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.