Skip to Content
Fabric documentation

Importing products

Send a catalog file, or the products themselves as JSON, and optionally enrich them when the import completes.

An import adds or updates a brand's products under the same rules whatever carries them: a value a person edited, or one Fabric wrote, is never replaced, and an empty field displaces nothing.

From a file

Ask for an upload URL, upload the file, then start the import with the key you got back:

curl -X POST "https://fabric.inc/api/v1/brands/$BRAND/imports" \
  -H "Authorization: Bearer $FABRIC_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"fileKey":"...","fileName":"catalog.csv","mapping":{"SKU":"sku","Title":"title"}}'

Products inline

Send products instead of fileKey and fileName: one JSON object per product. The mapping names the objects' keys, nested keys as dot paths. A key the mapping leaves out becomes a product attribute.

curl -X POST "https://fabric.inc/api/v1/brands/$BRAND/imports" \
  -H "Authorization: Bearer $FABRIC_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "mapping": { "sku": "sku", "name": "title", "specs.color": "attribute" },
    "products": [
      { "sku": "PRINT-8X10", "name": "Lustre print 8x10", "specs": { "color": "Full colour" } }
    ],
    "enrich": true
  }'

A request body is limited to 5 MB, about 2,500 products with HTML descriptions. Send a larger catalog as a file.

Enriching what the import wrote

enrich: true starts an enrichment run for exactly the products the import wrote, once it completes. It needs the enrichment:write scope, costs 1 credit per product, and the per-run product limit applies.

  • When the run starts, the import_completed event names it in enrichmentRunId, and each product then reports through product_enriched.
  • When it cannot start (too few credits, over the limit), the import still completes. enrichment_run_failed arrives with runId: null, importJobId and the reason in error.

Retries

Every import needs an Idempotency-Key, so a retry after a timeout never imports twice. See Retrying safely.