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

# Change a product (JSON Merge Patch)

`PATCH /products/{id}`

## Request

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

## Headers

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

## Request body

- ProductPatch: `currency` cannot change, as cart lines carry it.
  - `category_id` string, uuid
  - `description` string
  - `name` string: Not blank; spaces at the ends are dropped.
  - `price_minor` integer: A new price; orders already placed keep theirs.
  - `sku` string: Your code for the product, unique in your account.
  - `stock` integer, nullable: Units in stock, or null to stop tracking.

## Response `200`

The changed product.

- Product: Every field is present unless `fields[products]` asks for fewer. `category` is there only with `include`.
  - `category` Category: A product category. Platform data, the same for everyone. Every field is present unless `fields[categories]` asks for fewer.
    - `description` string
    - `id` string, uuid, required
    - `name` string
    - `slug` string
  - `category_id` string, uuid
  - `created_at` string, date-time
  - `currency` string: An ISO 4217 code (see /currencies). Fixed once the product is made.
  - `description` string
  - `id` string, uuid, required
  - `name` string
  - `price_minor` integer: The price in minor units of `currency`: 249900 with INR is ₹2,499.00.
  - `read_only` boolean: True for sample data (the seed); it cannot be changed.
  - `sku` string: Your code for the product, unique in your account.
  - `stock` integer, nullable: Units left; null when stock is not tracked (sample products). An order takes from it and a cancel puts it back.
  - `updated_at` string, date-time

## 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)
