Running the per-product loop
Send a product, get it back enriched, and correct what Fabric wrote.
The per-product loop is four steps your system repeats for each product: send it, hear when enrichment finishes, read what Fabric wrote, and send back your reviewers' verdicts.
Your system Fabric
| |
|-- 1. PUT /products/by-sku/{sku} --------->| writes the product now
|<---------- 201 product + bucket ----------|
|-- POST /enrichment-runs ----------------->| 1 credit per product
| | ... the run enriches it ...
|<-------- 2. webhook product_enriched -----|
|-- 3. GET /products/{id}?include=... ----->|
|<---------- product + every section -------|
| |
| your reviewers check the values |
| |
|-- 4. POST /products/{id}/feedback ------->| approve / reject / correct
|<---------- 200, and a run if reenrich ----|
|<-------- product_enriched again ----------| back to step 3Paths are relative to https://fabric.inc/api/v1/brands/{brandId}.
Before you start
You need an API key with these scopes:
| Scope | For |
|---|---|
catalog:read | Reading products, runs, credits and guidelines |
catalog:write | Sending products, reviewer feedback, archiving |
enrichment:write | Starting a run, reenrich: true on feedback, and enrich: true on an import |
org:write | Registering, enabling and removing a webhook endpoint |
org:read | Listing webhook endpoints and reading their deliveries |
Check the key, find the brand, and check its credit balance before the first run:
curl "https://fabric.inc/api/v1/me" \
-H "Authorization: Bearer $FABRIC_API_KEY"
curl "https://fabric.inc/api/v1/brands/$BRAND/credits" \
-H "Authorization: Bearer $FABRIC_API_KEY"GET /me lists the brands the key reaches, with each one's id and mainDomain. Either works as
{brandId} in a path. Two brands in one organization can have similar domains, such as a live brand
on northwind-outdoors.com and a test copy on sandbox.northwind-outdoors.com, so use the id once
you have it.
Then register a webhook endpoint subscribed to product_enriched. Without one, the
event is not sent.
curl -X POST "https://fabric.inc/api/v1/brands/$BRAND/webhooks" \
-H "Authorization: Bearer $FABRIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://hooks.northwind-outdoors.com/fabric","events":["product_enriched"]}'The answer carries the endpoint's signing secret, shown only once. Each environment you run, such
as a laptop tunnel, staging and production, registers its own endpoint and gets its own secret.
Every active endpoint on the brand receives every event it subscribes to.
1. Send the product
Write one product by its SKU. The answer is the product as it now stands, 201 when the SKU was new
and 200 when it updated one.
curl -X PUT "https://fabric.inc/api/v1/brands/$BRAND/products/by-sku/RDG-3S-JKT-M" \
-H "Authorization: Bearer $FABRIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Ridgeline 3-Season Down Jacket",
"description": "A packable down jacket for cold, dry days.",
"breadcrumb": "Men > Outerwear > Jackets",
"attributes": { "material": "700-fill duck down", "color": "Spruce" }
}'A PUT never starts enrichment. Start a run with the id from the answer. A run costs 1 credit per
product and answers 202 at once; the work happens in the background.
curl -X POST "https://fabric.inc/api/v1/brands/$BRAND/enrichment-runs" \
-H "Authorization: Bearer $FABRIC_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"productIds":["cmx1prod"]}'When a run call times out, send it again with the same Idempotency-Key. Fabric returns the
first answer and starts nothing new. A new key starts a second run and spends a second credit. See
Retrying safely.
What the PUT needs and refuses:
- A new SKU needs a
title. Without one the answer is422and nothing is written. An update can leave the title out. - Up to 60 attributes per product. A new attribute key is mapped and a category is proposed before the answer, so the call can take up to about 30 seconds.
- URL-encode the SKU.
RDG/3S-JKTgoes in the path asRDG%2F3S-JKT. 503means the mapping step failed and nothing was written. Send the same call again.409with two ids means two products share the SKU. Nothing was written.409on a Shopify brand. A brand whose catalog syncs from Shopify gets its products from the sync, not from this call.
For many products at once, send them inline to POST /imports with
"enrich": true instead. The import needs a mapping that names your keys, runs in the background,
and starts its run on its own when it completes. Each product still reports through
product_enriched.
When the product has no category
Fabric enriches a product against its category. When you send no categoryId, Fabric proposes one
in suggestedCategoryId, using the breadcrumb, title and description. A proposal is never applied
on its own: the answer's bucket is needs_mapping until the product has a category. A run skips
such a product with skipReason: "no_category" and charges nothing for it.
List what is waiting, then accept Fabric's proposals:
curl "https://fabric.inc/api/v1/brands/$BRAND/products?bucket=needs_mapping" \
-H "Authorization: Bearer $FABRIC_API_KEY"
curl -X POST "https://fabric.inc/api/v1/brands/$BRAND/products/accept-category-suggestions" \
-H "Authorization: Bearer $FABRIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"productIds":["cmx1prod"]}'To choose the category yourself, send the PUT again with a categoryId.
2. Hear when it is enriched
product_enriched arrives once per product and run, as each product finishes:
{
"id": "evt_01J8...",
"type": "product_enriched",
"createdAt": "2026-11-17T18:00:00.000Z",
"data": {
"productId": "cmx1prod",
"sku": "RDG-3S-JKT-M",
"runId": "cmx9run",
"outcome": "succeeded"
}
}succeeded and degraded mean values were written. skipped and failed mean nothing was. The
webhook reference lists every outcome and skip reason, and shows
how to verify the signature. Answer 2xx first and process the event afterwards. Delivery is
at-least-once, so ignore a Fabric-Event-Id you have already handled.
Polling instead
A script or a test without a public URL can poll the run:
curl "https://fabric.inc/api/v1/brands/$BRAND/enrichment-runs/cmx9run" \
-H "Authorization: Bearer $FABRIC_API_KEY"status moves from pending to running and ends at completed, failed or cancelled. The
counts succeededProducts, degradedProducts, skippedProducts and failedProducts say how its
products ended. Poll every 10 seconds or slower, since reads count against the
rate limit. A production integration should use the webhook.
GET /webhooks/{webhookId}/deliveries shows what Fabric sent your endpoint and what it answered.
3. Read what Fabric wrote
Read the product with every section in one call:
curl "https://fabric.inc/api/v1/brands/$BRAND/products/cmx1prod?include=attributes,faqs,images,variants" \
-H "Authorization: Bearer $FABRIC_API_KEY"Every attribute value and FAQ entry says where it came from in provenance. An image says the same
for its alt text in altTextProvenance.
provenance | The value came from |
|---|---|
imported | Your catalog: a PUT, an import or a sync |
edited | A person: a correct verdict, or an edit in Fabric |
ai | Fabric's enrichment |
supplier | A supplier's page, accepted by a person in Fabric |
A value Fabric wrote also carries an enrichment object with the model's reasoning, sources and
confidence, and the judge's verdict. The judge sets enrichment.flagged: true on a value it
doubted, with the reason in enrichment.judgeReason. Your reviewers should check those first.
enrichment is null on a value Fabric did not write, such as a field your catalog sends
(short_description, care_instructions). There is nothing to approve or reject on it, so leave it
out of your feedback. To change it, send the new value in your next PUT.
4. Send your reviewers' verdicts
Send every verdict for the product in one call. Each item names a value and approves, rejects or corrects it:
curl -X POST "https://fabric.inc/api/v1/brands/$BRAND/products/cmx1prod/feedback" \
-H "Authorization: Bearer $FABRIC_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"items": [
{ "attributeId": "cmx1fill", "verdict": "reject", "note": "The fill is 700, not 800; the title says so." },
{ "attributeId": "cmx1color", "verdict": "approve" },
{
"attributeId": "cmx1weight",
"verdict": "correct",
"value": "1 lb 2 oz",
"scope": "attribute",
"note": "Always give jacket weights in pounds and ounces."
}
],
"reenrich": true
}'- A rejected value is removed, and the next run never writes it again for this product.
- An item with a wider
scopealso proposes a rule from its note for every product it covers. Rules are created not applied: send"apply": trueto apply them in the same call. Managing guidelines covers what you can do with a rule afterwards. "reenrich": truestarts a run for the product once the verdicts apply, at 1 credit. Send it once, with the last of the product's feedback. Itsproduct_enrichedbrings you back to step 3.
Every item applies or none do. A call takes at most 100 items, 10 of them with a wider scope.
Reviewer feedback covers each verdict, the rule outcomes and the 422
that names a failing item.
What a re-run keeps
A second run on a product does not start over, whether it comes from reenrich, from a guideline or
from a new POST /enrichment-runs. What it does with each value depends on where the value came
from:
| Value | On a re-run |
|---|---|
edited, from a correct verdict or a person's edit | Kept. Nothing overwrites it. |
supplier | Kept. |
| A value you rejected | Never written again for this product and target. |
An attribute value, imported or ai | Kept, unless the judge finds it contradicted by the product's other data, breaking an applied guideline, or the wrong kind of value. Then it is replaced. |
| The description, meta title and meta description Fabric wrote | Written again on every run. |
| FAQ entries Fabric wrote | Generated again as a set, so a question can come back worded differently. FAQ entries from your catalog are never removed or changed. |
Approving a value does not lock it. approve clears the judge's flag and teaches the judge, but
the value keeps provenance: "ai", and a re-run treats it like any other value Fabric wrote. To keep
a value exactly as it is, including a FAQ entry, send a correct with its current text:
{ "faqId": "cmx1faq3", "verdict": "correct", "value": "Yes. It packs into its own chest pocket." }The value becomes your team's: no later run or import replaces it, and the rest of the FAQ is
generated around it. A correct costs no credits.
Updating a product later
Send the same PUT whenever the product changes in your system. Only the fields you send change,
and a field you leave out or send empty is kept. Sending the same body twice changes nothing.
Note
A PUT or an import writes your catalog's values. It never replaces a value Fabric wrote or a
value a person edited. To change one of those, send a correct verdict in
step 4.
An update does not start a run. Start one when the change should reach the enriched content.
Cleaning up
Archive products you no longer want enriched, such as test products, up to 500 per call:
curl -X POST "https://fabric.inc/api/v1/brands/$BRAND/products/archive" \
-H "Authorization: Bearer $FABRIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"productIds":["cmx1prod","cmx1prod2"]}'An archived product leaves the catalog and is not enriched. The answer lists the archived ids in
productIds, and each id it skipped in skipped with a reason such as already_archived or
not_found. The API has no unarchive: restore a product from the archived list in Fabric.
DELETE /webhooks/{webhookId} removes an endpoint you no longer need, with its delivery log.
When a call fails
Every error answers application/problem+json. Branch on code; the full set is on
Errors. These are the ones this loop meets:
| Status | code | In this loop |
|---|---|---|
400 | invalid_request | The body is not a product, or a field has the wrong type. errors names each field. |
401 | unauthorized | The key is missing, mistyped or revoked. |
403 | insufficient_scope | The key lacks the scope the call needs. detail names it. |
404 | not_found | No such product, run or brand in your organization. |
409 | conflict | Two products share the SKU, or the brand syncs from Shopify. |
422 | unprocessable | A new SKU without a title, or a verdict that cannot apply, such as rejecting a value your catalog sent. Nothing was written. |
429 | rate_limited | Wait Retry-After seconds. See Handling rate limits. |
503 | service_unavailable | The PUT's mapping step failed. Send the same call again. |
{
"type": "https://fabric.inc/docs/api/errors#unprocessable",
"title": "Cannot be applied",
"status": 422,
"code": "unprocessable",
"detail": "No product has this SKU yet, and creating one needs a `title`.",
"instance": "/api/v1/brands/brd_7f3a9c21/products/by-sku/RDG-3S-JKT-L"
}