Receiving webhooks
Get a signed request when a job finishes, and verify its signature.
A webhook endpoint receives a signed POST when a job reaches a terminal state. With an endpoint
registered, Fabric tells you an import completed, so you do not have to poll for it every thirty
seconds.
Register an endpoint
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://example.com/hooks/fabric","events":["import_completed"]}'{
"id": "whe_...",
"url": "https://example.com/hooks/fabric",
"secret": "whsec_...",
"secretHint": "9fQ2"
}The secret appears once
The secret is returned only in this response, and no endpoint reads it back. If you lose it,
call POST /v1/brands/{brandId}/webhooks/{webhookId}/rotate-secret to issue a new one. The old
secret stops verifying immediately, so have your receiver ready for the new secret before you
rotate.
Omit events to receive every type, including product_enriched, which arrives once per product
in every enrichment run. To hear only when whole jobs finish, list the types you want. The URL must
be public HTTPS. Loopback and private addresses are refused, so a receiver on your laptop needs a
public tunnel URL.
Registering, updating, enabling, rotating and deleting an endpoint need the org:write scope.
Listing endpoints, reading one and reading its deliveries need org:read.
Several endpoints on one brand
A brand can have as many endpoints as you register, and every active one receives every event it subscribes to. Register one per environment, such as a laptop tunnel, staging and production:
- Each endpoint has its own secret. Each environment verifies signatures with the secret it got when it registered.
- Each endpoint is delivered to on its own. One that is down is retried and, after 20 failures in a row by default, disabled, while the others keep receiving.
- Endpoints belong to one brand. An endpoint on a test brand never receives the live brand's events, and the other way round.
GET /v1/brands/{brandId}/webhooks lists a brand's endpoints with their events, their status and,
for a disabled one, disabledReason. Remove one you no longer need with
DELETE /v1/brands/{brandId}/webhooks/{webhookId}, which deletes its delivery log too.
PATCH /v1/brands/{brandId}/webhooks/{webhookId} changes an endpoint's url, description or
events. It does not re-enable a disabled endpoint; …/enable does.
Events
| Event | Sent when |
|---|---|
import_completed · import_failed | An import finished, or gave up |
enrichment_run_completed · enrichment_run_failed | An enrichment run finished, or gave up |
product_enriched | One product finished in an enrichment run. Sent per product, as each one finishes |
export_ready | An export's artifact is ready to fetch |
publish_run_completed · publish_run_failed | A publish finished, or gave up |
Request format
POST /hooks/fabric
Content-Type: application/json
Fabric-Event-Id: evt_01J8...
Fabric-Event-Type: import_completed
Fabric-Signature: t=1757260800,v1=5257a869...{
"id": "evt_01J8...",
"type": "import_completed",
"createdAt": "2026-09-07T18:00:00.000Z",
"data": { "importJobId": "imp_...", "productCount": 2431 }
}product_enriched
{
"productId": "cmx1...",
"sku": "SHOE-1",
"runId": "cmx9...",
"outcome": "succeeded",
"skipReason": "no_category"
}outcome is one of:
succeeded: the product's values were written;degraded: values were written, but some could not be generated, so the next run may add more;skipped: nothing was written, andskipReasonsays why;failed: nothing was written, and the product can be enriched again.
skipReason is present only when the product was skipped. A skipped product is not charged.
skipReason | Why | What to do |
|---|---|---|
no_category | The product has no category yet | Accept the suggested category, or send a categoryId |
not_specific | Its category has subcategories | Move it to the most specific category that fits |
conflict | Its title, description and attributes disagree, and it is held until someone settles it | Settle the product from the Pending page in Fabric |
no_gold_match · no_golden | Fabric has no attribute list for this category yet | Nothing. The fix is Fabric's, and a later run enriches it. |
unpriced | It became enrichable after the run started, so the run did not charge for it | Start another run |
stopped | The run was cancelled, or failed, before it reached the product | Start another run |
sku is null for a product with no SKU. Read the product with GET /v1/brands/{brandId}/products/{productId}?include=attributes,faqs,images,variants
to see what was written. The event is sent once per product and run, and only while you have an
endpoint subscribed to it.
import_completed and enrichment_run_failed with enrich
An import sent with enrich: true adds enrichmentRunId to import_completed when its run
started. When the run could not start, enrichment_run_failed arrives with runId: null, the
importJobId and the reason in error. See Importing products.
Verify the signature
Compute HMAC-SHA256 over "<t>.<raw body>" with your secret and compare it to v1. Use the raw
body, before any JSON parsing. Re-serializing changes the bytes, and the signature will not match.
import { createHmac, timingSafeEqual } from "node:crypto";
const verify = (rawBody: string, header: string, secret: string): boolean => {
const parts = Object.fromEntries(
header.split(",").map((p) => p.split("=") as [string, string])
);
// Reject a stale delivery before spending a hash on it.
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) {
return false;
}
const expected = createHmac("sha256", secret)
.update(`${parts.t}.${rawBody}`)
.digest("hex");
const a = Buffer.from(expected);
const b = Buffer.from(parts.v1);
return a.length === b.length && timingSafeEqual(a, b);
};Compare in constant time and reject anything older than 300 seconds. The timestamp is part of the signed material, so a captured delivery cannot be replayed later without breaking the signature.
Delivery
Delivery is at-least-once, so the same event can arrive twice. Deduplicate on
Fabric-Event-Id.
Return a 2xx to accept a delivery. Any other response is retried eight times over about an
hour, with a longer wait each time. Respond first and process the event afterwards: a delivery
that takes longer than 10 seconds is abandoned and retried.
An endpoint that fails 20 deliveries in a row is disabled. Any success resets the count, so an
endpoint that fails now and then stays enabled, and only one that has stopped responding is
disabled. A disabled endpoint is not deleted. It keeps the reason it was disabled, and
POST /v1/brands/{brandId}/webhooks/{webhookId}/enable restarts delivery once you have fixed it.
Check delivery attempts
GET /v1/brands/{brandId}/webhooks/{webhookId}/deliveries returns every attempt, with the status
code and reply your endpoint returned and how long it took. Check it to confirm Fabric sent the
event before you search your own logs.