Managing products
A product is one item of your catalogue. You can keep yours in step with your own system through the API:
POST /products(upsertProduct) — create a product, or update the one that already has this SKU.POST /products/{productId}/archive(archiveProduct) andPOST /products/{productId}/unarchive(unarchiveProduct) — retire a product, and bring it back.GET /products(listProducts) andGET /products/{id}(getProductById) — read them back. Add?expand=detailsto see everything you pushed.
None of these spends credits. Every write returns the product with all its ?expand=details keys and an
ETag header.
1. Mint a key
In the Mocart dashboard, go to Settings → API keys and create a key with the products:write
permission. Like every write key it must expire, within 365 days. products:write implies read, so the
same key can read back what it pushed. See Authentication.
export API_KEY="mcf_74b5dd1e6a29150ab5ab6081d0b30ac043aadf7d2c948e80d330775d0b6382e8"
2. Push a product — POST /products (upsertProduct)
Your SKU is the product's identity. Mocart looks for a product with that sku inside the brandId you
name:
| What Mocart finds | What happens |
|---|---|
| no product with the SKU | the product is created — 201 Created, with a Location header |
| exactly one | it is updated — 200 OK (also 200 when nothing changed) |
| more than one | nothing is written — 409 PRODUCT_SKU_AMBIGUOUS, listing the product ids |
Products are matched by SKU only, never by title. The SKU is case-sensitive (Tr-200 and TR-200 are two
products) and cannot be changed afterwards. Find the brand id with GET /products or in the dashboard.
curl -s -X POST https://api.mocart.io/api/public/v1/products \
-H "Authorization: Bearer $API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"sku": "TR-200",
"brandId": "brd_4c1e9a7b2d30",
"name": "Trento dining chair",
"productUrl": "https://shop.example.com/trento-dining-chair",
"categories": [
{ "path": [ { "id": "c-furniture", "name": "Furniture" }, { "id": "c-chairs", "name": "Chairs" } ] }
],
"parent": { "sku": "TR", "name": "Trento" },
"photos": [
{ "url": "https://cdn.example.com/tr-200/front.jpg", "alt": "Front view" }
],
"metadata": { "erpId": "88421" }
}'
201 Created, with Location: /api/public/v1/products/prd_8f2a1c9b4d6e, an ETag header and the product:
{
"object": "product",
"productId": "prd_8f2a1c9b4d6e",
"sku": "TR-200",
"title": "Trento dining chair",
"brandId": "brd_4c1e9a7b2d30",
"productUrl": "https://shop.example.com/trento-dining-chair",
"image": null,
"createdAt": "2026-10-05T09:12:44.000Z",
"status": "active",
"updatedAt": "2026-10-05T09:12:44.000Z",
"categories": [
{
"path": [
{ "id": "c-furniture", "name": "Furniture" },
{ "id": "c-chairs", "name": "Chairs" }
]
}
],
"parent": { "sku": "TR", "name": "Trento" },
"photos": [
{
"url": "https://cdn.example.com/tr-200/front.jpg",
"alt": "Front view",
"state": "pending",
"assetId": null,
"error": null
}
],
"metadata": { "erpId": "88421" }
}
The fields
The body is strict: a field that isn't listed is a 422. Only sku and brandId are always required, and
name is required when the push creates the product.
| Field | What it does |
|---|---|
sku | Your SKU, 1–200 characters after trimming, no control characters. |
brandId | One of your brands. A brand that isn't yours is a 422. |
name | The product name, a plain string of 1–200 characters. Stored in the product's own language — see below. |
productUrl | The product page, an https:// URL up to 2000 characters. null clears it. |
categories | Up to 10 category paths, each 1–10 levels from the top down. Replaces the product's categories; [] clears them. |
parent | The parent product this one is a variant of: { "sku", "name"? }. null takes the product out of its group. |
photos | Up to 10 photos, each { "url", "alt"? }, every URL once. Replaces the photo list; [] clears it. |
metadata | Your own string labels, merged into the stored map: a string sets a key, null deletes one. At most 50 keys remain; a key is letters, digits, _ and - (up to 40), a value up to 500 characters. |
A push is partial. A field you leave out is untouched, null clears a single value, [] clears a list.
Sending the same push again changes nothing and sends no event.
Language. name is one string. A new product is stored in the language the name is written in (Hebrew
or English). An existing product keeps its language: pushing an English name to a product that was imported in
Hebrew sets the name you sent and does not switch the product to English. Category and parent names follow
the product's language the same way.
Categories
A category is a path of levels, from the top down. Give each level an id — your own stable key for it, up to
200 characters, never starting with path: — and Mocart keeps that category when you rename it. Without an
id a level is identified by its names, so renaming it creates a new category. Ids are per level: the same
id always means the same category in your brand.
{ "categories": [{ "path": [{ "id": "c-furniture", "name": "Furniture" }, { "name": "Chairs" }] }] }
If you connected a store to Mocart, use that store's own category ids as the ids, and your pushes land on
the same categories.
Parent product
Variants that share a parent.sku share one group, shown together in Mocart. name is the group's name;
without it the group is named after the product you pushed.
Photos
Photos are fetched in the background, usually within a minute: the push answers right away with every
photo pending, and the product's image fills in once the first one is stored. Mocart accepts JPEG, PNG
and WebP images up to 25 MB, fetched from a public https:// URL. Read each photo's progress with
GET /products/{id}?expand=details:
state | Meaning |
|---|---|
pending | Waiting to be fetched. |
stored | A copy is in your library; assetId names it. |
failed | Not stored; error says why. |
error.code | Meaning |
|---|---|
PHOTO_URL_REFUSED | The URL, or a redirect it led to, is not publicly reachable. |
PHOTO_ORIGIN_BLOCKED | The image host served a challenge page. Allow Mocart's egress IP on that host. |
PHOTO_NOT_AN_IMAGE | The URL did not serve a JPEG, PNG or WebP image. |
PHOTO_TOO_LARGE | The image is larger than 25 MB. |
PHOTO_FETCH_FAILED | The image could not be fetched. |
A photo URL that is already stored for the product is not fetched again. Mocart cannot see that the image behind a URL changed: send a new URL. A URL you drop from the list leaves its copy in your library.
If a store owns the product
A SKU whose product is still linked to a connected store is refused with 409 PRODUCT_OWNED_BY_STORE (the
store keeps the product up to date). If the store has been disconnected, your push takes the product over in
place: its id, assets and creatives are kept.
Idempotency and If-Match
Idempotency-Key is required. Retry a request that timed out with the same key and body and you get the
original answer — the same status and body, never a second product. The same key with a different body is
409 IDEMPOTENCY_KEY_REUSED. See Idempotency.
On an update you may send If-Match with the ETag you last read from GET /products/{id}: if the product
has changed since, nothing is done and the answer is 412. On a push that would create the product, any
If-Match is a 412.
3. Archive and unarchive
curl -s -X POST https://api.mocart.io/api/public/v1/products/prd_8f2a1c9b4d6e/archive \
-H "Authorization: Bearer $API_KEY" \
-H "Idempotency-Key: $(uuidgen)"
200 OK, with the product and "status": "archived". Archiving an archived product (or unarchiving one that
isn't archived) is a 200 that changes nothing. Both are addressed by the Mocart productId; find it in a
push's answer or with GET /products?sku=TR-200.
An archived product does not count toward your plan's product limit, and archiving always works. Unarchiving
takes a slot back, so at the limit it is refused with 403 LIMIT_EXCEEDED and the product stays archived.
4. Products are archived, never deleted
DELETE /products/{id} always answers 405 PRODUCT_DELETE_NOT_SUPPORTED, with an Allow: GET header, for any
key. An API key never deletes a product: archive it, or delete it for good in the Mocart dashboard.
Pacing a large first load
A key may make 300 write requests a minute. When you load a whole catalogue for the first time, pace your
pushes (a few per second is plenty), keep each Idempotency-Key stable across its retries, and honour
Retry-After on a 429 or 503. Photos are fetched in the background and take a little longer on a big load;
poll ?expand=details rather than waiting on the push.
Errors
| Status | Code | When | What to do |
|---|---|---|---|
400 | IDEMPOTENCY_KEY_REQUIRED | A write without an Idempotency-Key. | Send one. |
403 | API_TOKEN_SCOPE_DENIED | The key doesn't carry products:write. | Mint a key with products:write. |
403 | LIMIT_EXCEEDED | A create or an unarchive would pass your plan's product limit (limitKey, limit, current say by how much). | Archive a product or raise the plan; archived products don't count. |
404 | PRODUCT_NOT_FOUND | Archive or unarchive of a product that isn't yours, or doesn't exist. | Check the productId. |
405 | PRODUCT_DELETE_NOT_SUPPORTED | DELETE /products/{id}. | Archive instead. |
409 | PRODUCT_SKU_AMBIGUOUS | More than one product in the brand has the SKU. The body lists sku, brandId, productIds. | Fix the duplicates in the dashboard. |
409 | PRODUCT_OWNED_BY_STORE | The product is linked to a connected store. The body names sku, brandId, productId. | Change it in the store, or disconnect the store. |
409 | IDEMPOTENCY_KEY_REUSED | The key was used for a different request. | Use a new key. |
412 | PRECONDITION_FAILED | If-Match no longer matches, or was sent on a create. | Read the product again. |
422 | VALIDATION_ERROR | Unknown field, http:// photo, more than 10 photos or a repeated URL, a category id starting path:, no name on a create, a brand that isn't yours. | Fix the fields listed in errors[]. |
429 | RATE_LIMITED | More than 300 write requests a minute on one key. | Wait for Retry-After. |
503 | WRITES_PAUSED, SERVICE_UNAVAILABLE | Writes are paused for the account, or a create or an unarchive lost a race with other writes. | Retry the same request after Retry-After; nothing was written. |
See Errors for the shape of every error.
Webhooks
A push that creates or changes a product, archiving, unarchiving, and a photo that finishes fetching can notify
your own endpoint: product.created, product.updated, product.archived and product.unarchived. For
now these are sent for changes made through the API only — a change made in the dashboard, by an import or by
a store sync sends none. See Webhooks.