---
title: "Change a order (JSON Merge Patch)"
method: PATCH
path: "/orders/{id}"
tags: ["Shop"]
---

# Change a order (JSON Merge Patch)

`PATCH /orders/{id}`

## Request

- Base URL: `https://gorest.co.in/public/v3`
- URL: `https://gorest.co.in/public/v3/orders/{id}`
- Auth: HTTP bearer

## Headers

- `If-Match` string
- `Prefer` 'return=minimal' | 'return=representation'

## Request body

- OrderPatch
  - `status` 'paid' | 'fulfilled' | 'cancelled' | 'refunded', required

## Response `200`

The changed order.

- Order: Every field is present unless `fields[orders]` asks for fewer. `user` and `items` are there only with `include`.
  - `cart_id` string, uuid, nullable: The cart it was placed from; null once that cart is deleted.
  - `created_at` string, date-time
  - `currency` string
  - `id` string, uuid, required
  - `items` OrderItem[]: The lines, oldest first.
    - `created_at` string, date-time
    - `currency` string
    - `id` string, uuid, required
    - `line_total_minor` integer
    - `name` string
    - `order_id` string, uuid
    - `product_id` string, uuid, nullable: Null once the product is deleted.
    - `quantity` integer
    - `read_only` boolean: True for sample data (the seed); it cannot be changed.
    - `sku` string
    - `unit_price_minor` integer
  - `read_only` boolean: True for sample data (the seed); it cannot be changed.
  - `status` 'pending' | 'paid' | 'fulfilled' | 'cancelled' | 'refunded': pending to paid or cancelled; paid to fulfilled or refunded; fulfilled to refunded. A cancel puts the stock back.
  - `total_minor` integer: The sum of the lines.
  - `updated_at` string, date-time
  - `user` NullableUser: Every field is present unless `fields[users]` asks for fewer.
    - `created_at` string, date-time
    - `email` string, email
    - `id` string, uuid, required
    - `name` string
    - `read_only` boolean: True for sample data (the seed); it cannot be changed.
    - `status` 'active' | 'inactive'
    - `updated_at` string, date-time
  - `user_id` string, uuid, nullable: The cart's user; null once that user is deleted.

## Other responses

- `204`: Done; no body, because the request sent `Prefer: return=minimal`.
- `400`: A parameter is wrong, unknown or out of range.
- `401`: No token, or the token is wrong, expired or revoked.
- `403`: The token lacks the scope this operation needs.
- `404`: No such item, or not one this token may see.
- `409`: The change clashes with another row, such as an email you already use.
- `412`: The item changed since the ETag in `If-Match`.
- `413`: The body is over 64 KiB.
- `415`: The body is not `application/json` (or `application/merge-patch+json` on PATCH).
- `422`: The body has fields that fail their rules (`validation_failed`, with `errors`), or a cap is reached (`cap_reached`).
- `429`: Over the rate limit; wait `Retry-After` seconds.
- `500`: Something failed on the server.

---

[API](https://skmtc.dev/gorest/apis/gorest-api-v3.md) - [All operations](https://skmtc.dev/gorest/apis/gorest-api-v3/llms.txt) - [OpenAPI document](https://skmtc.dev/gorest/apis/gorest-api-v3/revisions/89aa429755a6?raw)
