Ask for an invitation
Menu

Endpoint

Update a product

PATCH/v1/products/{id}

Changes the fields you send of a product and leaves the others as they are; sending null clears an optional field. Returns the product object as it is after the change.

Scope a restricted key needs
products:write
Publishable key
Not allowed: secret or restricted key only
Idempotency-Key
Not used. A PATCH is already safe to repeat.

Parameters

Parameters of Update a product
ParameterType and placeMeaning
idrequiredstringpathThe id of the product.
Orrerie-VersionstringheaderAPI version date. Default: the version the key was created with. Example 2026-10-11.

Request body

A JSON object. The body may be left out. A field the call does not list is refused with parameter_unknown.

Request body of Update a product
FieldTypeMeaning
namestringThe product's name.
descriptionstringA longer description; null clears it.
imagestringA file_ id of a product picture; null clears it.
activebooleanfalse archives it.
metadataobjectYour own key-value data (rules in Metadata).

Example request

curl

curl -X PATCH https://api.orrerie.com/v1/products/prod_9cct573e5ewmrj7f6hyjsqap \
  -H "Authorization: Bearer $ORRERIE_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "active": false
}'

JavaScript

const response = await fetch("https://api.orrerie.com/v1/products/prod_9cct573e5ewmrj7f6hyjsqap", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.ORRERIE_SECRET_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "active": false
  }),
});
const result = await response.json();
if (!response.ok) throw new Error(`${result.error.code}: ${result.error.message}`);
console.log(result);

Python

import os
import requests

response = requests.patch(
    "https://api.orrerie.com/v1/products/prod_9cct573e5ewmrj7f6hyjsqap",
    headers={"Authorization": f"Bearer {os.environ['ORRERIE_SECRET_KEY']}"},
    json={
        "active": False,
    },
    timeout=30,
)
result = response.json()
if not response.ok:
    raise RuntimeError(f"{result['error']['code']}: {result['error']['message']}")
print(result)

PHP

<?php
$request = curl_init('https://api.orrerie.com/v1/products/prod_9cct573e5ewmrj7f6hyjsqap');
curl_setopt_array($request, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'PATCH',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('ORRERIE_SECRET_KEY'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'active' => false,
    ]),
]);
$body = curl_exec($request);
if ($body === false) {
    throw new RuntimeException(curl_error($request));
}
$result = json_decode($body, true);
if (curl_getinfo($request, CURLINFO_HTTP_CODE) >= 400) {
    throw new RuntimeException($result['error']['code'] . ': ' . $result['error']['message']);
}
print_r($result);

Responses

200 OK

The answer is the product object. Headers: Orrerie-Request-Id.

Example response, 200

{
  "id": "prod_9cct573e5ewmrj7f6hyjsqap",
  "object": "product",
  "livemode": true,
  "created": "2026-09-10T10:00:00.000Z",
  "updated": "2026-09-10T10:00:00.000Z",
  "name": "Ethiopia Yirgacheffe, 1 kg",
  "description": "Washed, light roast.",
  "image": "file_3mg14w9wm9h26h2v61wzxhek",
  "active": false,
  "metadata": {
    "sku": "ETH-YIR-1KG"
  }
}

Any other status: an error

A status of 400 or above answers with the error object. Branch on its code, never on its message.

Errors

This call has no error of its own. It answers with the errors every call can answer with: a bad key, a missing scope, an object that does not exist, the rate limit. Every error code has its own entry.