Attaching assets to products

API reference for attaching and detaching assets to Shopify products and variants.

Beka Rice Avatar

Written by

Last updated


Attach an asset to one or more Shopify products (or specific variants), or detach an asset from a product. The product IDs you reference here are Shopify product / variant IDs.

Requires Bearer authentication with your Fileflare key. Rate-limited to 60 requests per minute.

Endpoint

POST https://app.digital-downloads.com/api/v1/assets/{asset}/attach

Or, detach assets using the following:

POST https://app.digital-downloads.com/api/v1/assets/{asset}/detach

Parameters

Path

  • {asset} — UUID of the Fileflare asset

Body (JSON)

  • product_ids (array of integers) — Shopify product IDs to attach to or detach from
  • variant_ids (array of integers, optional) — specific Shopify variant IDs (otherwise applies to all variants)

Example request

# Attach an asset to a product
curl -X POST https://app.digital-downloads.com/api/v1/assets/82664d96-6dfd-4343-96b0-05c46f412a5b/attach \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"product_ids": [123456789], "variant_ids": [987654321]}'

# Detach (returns 200 OK)
curl -X POST https://app.digital-downloads.com/api/v1/assets/82664d96-6dfd-4343-96b0-05c46f412a5b/detach \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"product_ids": [123456789]}'

Example response — 201 Created

{
  "attached": true,
  "product_ids": [123456789],
  "variant_ids": [987654321]
}

Notes

  • Attach returns 201 Created; detach returns 200 OK.
  • Attaching is idempotent — re-attaching an already-attached asset is a no-op.
  • For attaching by SKU rather than product ID, use the CSV import instead.

Common errors

  • 404 — asset doesn’t exist, or product ID isn’t a Shopify product on your store.
  • 422 — missing or malformed product_ids.

Keep learning