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

# Update an Order

> Updates an Order



## OpenAPI

````yaml /api-reference/platform.yaml patch /api/v2/platform/orders/{id}
openapi: 3.0.3
info:
  title: Platform API
  contact:
    name: Vendo Connect Inc.
    url: https://getvendo.com
    email: sales@getvendo.com
  description: Spree Platform API
  version: v2
servers:
  - url: http://{defaultHost}
    variables:
      defaultHost:
        default: localhost:3000
security: []
tags:
  - name: Addresses
  - name: Adjustments
  - name: Classifications
  - name: Countries
  - name: CMS Pages
  - name: CMS Sections
  - name: Digital Assets
  - name: Digital Links
  - name: Line Items
  - name: Menus
  - name: Menu Items
  - name: Option Types
  - name: Option Values
  - name: Orders
  - name: Payments
  - name: Payment Methods
  - name: Products
  - name: Promotions
  - name: Promotion Actions
  - name: Promotion Categories
  - name: Promotion Rules
  - name: Roles
  - name: Shipments
  - name: Shipping Categories
  - name: Shipping Methods
  - name: States
  - name: Stock Items
  - name: Stock Locations
  - name: Store Credit Categories
  - name: Store Credit Types
  - name: Store Credits
  - name: Tax Categories
  - name: Tax Rates
  - name: Taxons
  - name: Taxonomies
  - name: Users
  - name: Variants
  - name: Vendors
  - name: Webhook Events
  - name: Webhook Subscribers
  - name: Wishlists
  - name: Wished Items
  - name: Zones
paths:
  /api/v2/platform/orders/{id}:
    patch:
      tags:
        - Orders
      summary: Update an Order
      description: Updates an Order
      operationId: update-order
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: include
          in: query
          description: >-
            Select which associated resources you would like to fetch, see: <a
            href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>
          example: line_items,variants,product
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/update_order_params'
      responses:
        '200':
          description: Record updated
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    data:
                      id: '47'
                      type: order
                      attributes:
                        number: R484277352
                        item_total: '10.0'
                        total: '110.0'
                        state: delivery
                        adjustment_total: '0.0'
                        completed_at: null
                        payment_total: '0.0'
                        shipment_state: null
                        payment_state: null
                        email: new@example.com
                        special_instructions: null
                        created_at: '2022-11-08T19:34:38.200Z'
                        updated_at: '2022-11-08T19:34:38.599Z'
                        currency: USD
                        last_ip_address: null
                        shipment_total: '100.0'
                        additional_tax_total: '0.0'
                        promo_total: '0.0'
                        channel: spree
                        included_tax_total: '0.0'
                        item_count: 1
                        approved_at: null
                        confirmation_delivered: false
                        canceled_at: null
                        state_lock_version: 0
                        taxable_adjustment_total: '0.0'
                        non_taxable_adjustment_total: '0.0'
                        store_owner_notification_delivered: null
                        public_metadata: {}
                        private_metadata: {}
                        internal_note: null
                        display_ship_total: $100.00
                        display_shipment_total: $100.00
                        display_outstanding_balance: $110.00
                        display_item_total: $10.00
                        display_adjustment_total: $0.00
                        display_included_tax_total: $0.00
                        display_additional_tax_total: $0.00
                        display_tax_total: $0.00
                        display_promo_total: $0.00
                        display_total: $110.00
                        display_cart_promo_total: $0.00
                        display_pre_tax_item_amount: $10.00
                        display_pre_tax_total: $10.00
                        display_total_applicable_store_credit: $0.00
                        display_total_applied_store_credit: $0.00
                        display_order_total_after_store_credit: $110.00
                        display_total_available_store_credit: $0.00
                        display_store_credit_remaining_after_capture: $0.00
                      relationships:
                        user:
                          data:
                            id: '47'
                            type: user
                        created_by:
                          data: null
                        approver:
                          data: null
                        canceler:
                          data: null
                        bill_address:
                          data:
                            id: '61'
                            type: address
                        ship_address:
                          data:
                            id: '62'
                            type: address
                        line_items:
                          data:
                            - id: '38'
                              type: line_item
                        payments:
                          data: []
                        shipments:
                          data:
                            - id: '3'
                              type: shipment
                        state_changes:
                          data: []
                        return_authorizations:
                          data: []
                        reimbursements:
                          data: []
                        adjustments:
                          data: []
                        all_adjustments:
                          data: []
                        order_promotions:
                          data: []
              schema:
                $ref: '#/components/schemas/resource'
        '401':
          description: Authentication Failed
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    error: The access token is invalid
              schema:
                $ref: '#/components/schemas/error'
        '404':
          description: Record not found
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    error: The resource you were looking for could not be found.
              schema:
                $ref: '#/components/schemas/error'
        '422':
          description: Invalid request
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    error: Email is invalid
                    errors:
                      email:
                        - is invalid
              schema:
                $ref: '#/components/schemas/validation_errors'
      security:
        - bearer_auth: []
components:
  schemas:
    update_order_params:
      type: object
      properties:
        order:
          type: object
          properties:
            item_total:
              type: number
              example: 170.9
            total:
              type: number
              example: 190.9
            state:
              type: string
              example: complete
              enum:
                - cart
                - address
                - delivery
                - payment
                - confirm
                - complete
                - canceled
            adjustment_total:
              type: number
              example: 20
            user_id:
              type: string
              example: '1'
            completed_at:
              type: string
              format: date_time
              example: 2022-11-08 19:33:50 UTC
            bill_address_id:
              type: string
              example: '1'
            ship_address_id:
              type: string
              example: '1'
            payment_total:
              type: number
              example: 190.9
            shipment_state:
              type: string
              example: shipped
              enum:
                - backorder
                - canceled
                - partial
                - pending
                - ready
                - shipped
            payment_state:
              type: string
              example: paid
              enum:
                - balance_due
                - credit_owed
                - failed
                - paid
                - void
            email:
              type: string
              format: email
              example: hi@getvendo.com
            special_instructions:
              type: string
              example: I need it ASAP!
            currency:
              type: string
              example: USD
            last_ip_address:
              type: string
              example: 127.0.0.1
            created_by_id:
              type: string
              example: '1'
            shipment_total:
              type: number
              example: 10
            additional_tax_total:
              type: number
              example: 10
            promo_total:
              type: number
              example: 0
            channel:
              type: string
              example: online
            included_tax_total:
              type: number
              example: 0
            item_count:
              type: integer
              example: 2
            approver_id:
              type: string
            approved_at:
              type: string
              format: date_time
              example: 2022-11-08 19:33:50 UTC
            confirmation_delivered:
              type: boolean
              example: true
              default: false
            considered_risky:
              type: boolean
              example: true
              default: false
            canceled_at:
              type: string
              format: date_time
            canceler_id:
              type: string
            taxable_adjustment_total:
              type: number
              example: 170.9
            non_taxable_adjustment_total:
              type: number
              example: 10
            store_owner_notification_delivered:
              type: boolean
              example: true
              default: false
            bill_address_attributes:
              $ref: '#/components/schemas/update_address_params'
            ship_address_attributes:
              $ref: '#/components/schemas/update_address_params'
            line_items_attributes:
              type: array
              items:
                $ref: '#/components/schemas/update_line_item_params'
            public_metadata:
              type: object
            private_metadata:
              type: object
      required:
        - order
      x-internal: false
    resource:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/resource_properties'
      required:
        - data
      x-internal: false
    error:
      type: object
      properties:
        error:
          type: string
      required:
        - error
      x-internal: false
    validation_errors:
      type: object
      properties:
        error:
          type: string
        errors:
          type: object
      required:
        - error
        - errors
      x-internal: false
    update_address_params:
      type: object
      properties:
        address:
          type: object
          properties:
            country_id:
              type: string
              example: '224'
            state_id:
              type: string
              example: '516'
            state_name:
              type: string
              example: New York
            address1:
              type: string
              example: 5th ave
            address2:
              type: string
              example: 1st suite
            city:
              type: string
              example: NY
            zipcode:
              type: string
              example: '10001'
            phone:
              type: string
              example: +1 123 456 789
            alternative_phone:
              type: string
            firstname:
              type: string
              example: John
            lastname:
              type: string
              example: Snow
            label:
              type: string
              example: My home address
            company:
              type: string
              example: Vendo Connect Inc
            user_id:
              type: string
            public_metadata:
              type: object
              example:
                distance_from_city_in_km: 10
                location_type: building
            private_metadata:
              type: object
              example:
                close_to_shop: true
      required:
        - address
      x-internal: false
    update_line_item_params:
      type: object
      properties:
        line_item:
          type: object
          properties:
            variant_id:
              type: string
              example: '1'
            quantity:
              type: integer
              example: 2
      required:
        - line_item
      x-internal: false
    resource_properties:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
        attributes:
          type: object
        relationships:
          type: object
      required:
        - id
        - type
        - attributes
      x-internal: false
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer

````