Ask for an invitation
Menu

Endpoint

Create a product

POST/v1/products

Creates a product and returns the product object. Send an Idempotency-Key: a retry with the same key and body gets the first answer again, so it never creates a second product.

Scope a restricted key needs
products:write
Publishable key
Not allowed: secret or restricted key only
Idempotency-Key
Recommended. It makes a retry safe.

Parameters

Parameters of Create a product
ParameterType and placeMeaning
Orrerie-VersionstringheaderAPI version date. Default: the version the key was created with. Example 2026-10-11.
Idempotency-KeystringheaderMakes a retry safe. Kept 24 hours. 1 to 255 characters.

Request body

A JSON object. The body is required. A field the call does not list is refused with parameter_unknown.

Request body of Create a product
FieldTypeMeaning
namerequiredstringUp to 200 characters.
descriptionstringUp to 2,000 characters.
imagestringA file_ id with purpose product_image.
metadataobjectYour own key-value data (rules in Metadata).

Example request

curl

curl https://api.orrerie.com/v1/products \
  -H "Authorization: Bearer $ORRERIE_SECRET_KEY" \
  -H "Idempotency-Key: 8f14e45f-ceea-467f-a9d2-6f1c2b3d4e5a" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Ethiopia Yirgacheffe, 1 kg",
  "description": "Washed, light roast.",
  "metadata": {
    "sku": "ETH-YIR-1KG"
  }
}'

JavaScript

const response = await fetch("https://api.orrerie.com/v1/products", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ORRERIE_SECRET_KEY}`,
    "Idempotency-Key": "8f14e45f-ceea-467f-a9d2-6f1c2b3d4e5a",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "name": "Ethiopia Yirgacheffe, 1 kg",
    "description": "Washed, light roast.",
    "metadata": {
      "sku": "ETH-YIR-1KG"
    }
  }),
});
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.post(
    "https://api.orrerie.com/v1/products",
    headers={"Authorization": f"Bearer {os.environ['ORRERIE_SECRET_KEY']}", "Idempotency-Key": "8f14e45f-ceea-467f-a9d2-6f1c2b3d4e5a"},
    json={
        "name": "Ethiopia Yirgacheffe, 1 kg",
        "description": "Washed, light roast.",
        "metadata": {
            "sku": "ETH-YIR-1KG",
        },
    },
    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');
curl_setopt_array($request, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('ORRERIE_SECRET_KEY'),
        'Idempotency-Key: 8f14e45f-ceea-467f-a9d2-6f1c2b3d4e5a',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'name' => 'Ethiopia Yirgacheffe, 1 kg',
        'description' => 'Washed, light roast.',
        'metadata' => [
            'sku' => 'ETH-YIR-1KG',
        ],
    ]),
]);
$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

201 Created

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

Example response, 201

{
  "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": null,
  "active": true,
  "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

Beside the errors every call can answer with (a bad key, a missing scope, the rate limit), this call answers with:

Errors of Create a product
CodeHTTPMeaning
product_limit_reached403The account has 500 products that are not archived, or this product has 20 prices that are not archived; see reason and limit. Archive one first.