Skip to Content
Fabric documentation

Managing guidelines

Write the brand rules enrichment follows, see what they change, and re-enrich.

A guideline is a brand rule that enrichment follows every time it writes the content the rule covers, such as "Give jacket weights in pounds and ounces" or "Never call a lustre finish glossy". Writing, applying and editing a guideline is free and changes no product. Re-enriching the products a rule leaves out of date is a separate step, at 1 credit per product.

Paths are relative to https://fabric.inc/api/v1/brands/{brandId}.

CallScopeCosts
POST /guidelinescatalog:writeNothing. Counts against the job rate limit.
GET /guidelines, GET /guidelines/{id}, GET /guidelines/{id}/impactcatalog:readNothing
PATCH /guidelines/{id}, PATCH /guidelines/{id}/status, DELETE /guidelines/{id}catalog:writeNothing
POST /guidelines/{id}/reenrichenrichment:write1 credit per product it re-enriches

Scopes

A guideline's scope says what content it shapes:

scopeShapes
brandEverything enrichment writes for the brand
descriptionProduct descriptions
meta_title · meta_descriptionThe SEO title and description
faq_questionWhich questions a product's FAQ asks, and which it avoids
faqHow FAQ answers are written
image_altImage alt text
attributeOne attribute's values. Needs attributeId; "__all__" means every attribute.
titleNothing yet: enrichment does not write product titles

categoryId narrows a guideline to that category and every category under it. Without it, the guideline covers the whole brand.

Create a guideline

curl -X POST "https://fabric.inc/api/v1/brands/$BRAND/guidelines" \
  -H "Authorization: Bearer $FABRIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "scope": "attribute",
    "attributeId": "cmx1weight",
    "categoryId": "cmx1jackets",
    "instruction": "Give jacket weights in pounds and ounces, e.g. 1 lb 2 oz."
  }'

Before it creates anything, Fabric compares the rule with the brand's rules on the same scope and target, and the answer's outcome says what it found:

outcomeWhat happenedstatus
newNothing like it exists. The rule is created as asked.applied unless you sent "status": "not_applied"
deduplicatedAn existing rule already says this. Nothing is created, and id is the existing rule.The existing rule's
mergedIt adds to an existing rule. A draft combining both is created, and supersedes names the rule it replaces.not_applied
contradictsIt clashes with an existing rule. A draft is created, and contradicts names that rule and explains the clash.not_applied
{
  "id": "cmx1rule",
  "instruction": "Give jacket weights in pounds and ounces, e.g. 1 lb 2 oz.",
  "outcome": "new",
  "status": "applied",
  "conflicts": []
}

conflicts lists the applied rules that already cover the same scope and target, for you to check. They do not stop the rule being created.

A rule proposed by a reviewer's note through feedback goes through the same comparison, and is always created not_applied.

Note

An instruction is at most 5,000 characters. A brand holds at most 100 guidelines, applied or not. One more answers 400 refused before Fabric compares it: delete a rule you no longer need to add another.

{
  "type": "https://fabric.inc/docs/api/errors#refused",
  "title": "Request was understood and declined",
  "status": 400,
  "code": "refused",
  "detail": "You've reached the 100-guideline limit. Delete one to add another.",
  "instance": "/api/v1/brands/brd_7f3a9c21/guidelines"
}

See what a guideline changes

An applied guideline marks the already-enriched products it no longer describes as stale. Read how many before you spend credits on them:

curl "https://fabric.inc/api/v1/brands/$BRAND/guidelines/cmx1rule/impact" \
  -H "Authorization: Bearer $FABRIC_API_KEY"
{ "total": 214, "productIds": ["cmx1prod", "cmx1prod2", "cmx1prod3"] }

total is the number of stale products, which is what re-enriching them costs in credits. productIds is a sample, not the full list. Archived products are never counted. A guideline that is not applied leaves nothing stale, and neither does a title or faq_question one: a faq_question guideline reaches each product at its next enrichment.

Apply or unapply a guideline

curl -X PATCH "https://fabric.inc/api/v1/brands/$BRAND/guidelines/cmx1rule/status" \
  -H "Authorization: Bearer $FABRIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"status":"applied"}'

Applying a guideline makes every later run follow it and recounts what it leaves stale. Unapplying it clears that count. Neither enriches a product or spends a credit.

Applying a merged draft unapplies the rule it supersedes in the same step, and keeps the old rule for reference. Apply a contradicts draft only after you have settled the clash, for example by editing or deleting the rule it contradicts.

Edit a guideline

PATCH /guidelines/{id} takes scope, instruction, and attributeId or categoryId where they apply. To change whether it is applied, use PATCH …/status. The guideline keeps its id. An applied one recounts the products it leaves stale, since a new text describes a different set. Editing does not run the comparison with other guidelines.

Re-enrich what a guideline left stale

This spends credits

One credit per stale product, from the same balance as POST /enrichment-runs. One run takes at most 1,000 products unless your brand's limit was changed. Check GET …/impact first.

curl -X POST "https://fabric.inc/api/v1/brands/$BRAND/guidelines/cmx1rule/reenrich" \
  -H "Authorization: Bearer $FABRIC_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
{ "id": "cmx9run", "productCount": 214, "status": "pending" }

The answer is 202 with the run's id. The run reports through the same webhooks as any other, including product_enriched for each product. When the guideline leaves nothing stale, the answer is 200 with "status": "noop" and no run.

When no run starts:

StatuscodeWhy
400refusedThe brand has fewer credits than the guideline leaves stale products. detail says how many are missing.
413too_largeThe guideline leaves more products stale than one run may take. detail gives both numbers. Narrow the guideline, or re-enrich a subset through POST /enrichment-runs.
422unprocessableNone of the stale products can still be enriched.
503busyFabric is busy. Try again after Retry-After.
503paused · service_unavailableFabric cannot start runs now. Try again later; see Errors.

The run follows what a re-run keeps: a value a person corrected is never overwritten, even by a guideline.

List and delete

GET /guidelines lists the brand's rules, newest first. Each carries its status, its scope and target, its source (manual for one written as a rule, feedback for one proposed by a reviewer's note) and, for a merged draft, supersedesId.

DELETE /guidelines/{id} removes a rule. No product changes: what the rule already led enrichment to write stays written, and the next run no longer follows it.