printful-design-attacher
Attach an existing design file to an already-listed Printful product variant using only the Printful REST API (api.printful.com). Use when a design is already listed in the shop but the print file is missing, needs replacing, or needs embroidery thread colours set. Covers Ecommerce Platform Sync API variant updates (PUT /sync/variant/{id}), file library validation, thread colour detection, and read-only inspection of a synced variant.
Latest: v1.0.0
- Added a skill for attaching or replacing design files on existing Printful product variants through the Printful REST API.
- Added workflows for variant selection, file validation, embroidery thread colours, and verifying the updated variant.
- Documented a dry-run option and approval, token-handling, and failure guardrails.
Printful Design Attacher
Attach a validated design file to an EXISTING Printful Sync Product variant using only the Printful REST API (https://api.printful.com). No Etsy API calls.
Use this when the listing already exists in the shop and Printful mirrors it as a
Sync Product, but the print file still has to be attached or changed. To CREATE a
new product instead, use printful-product-builder. For general account work
(orders, webhooks, tax, shipping, warehouse, reports) use printful-management.
Companion script
scripts/attach_printful_design.py
Requirements
- Python 3.9+ (standard library only).
- Environment:
PRINTFUL_API_TOKEN(required) - scopes:sync_products,file_libraryPRINTFUL_STORE_ID(optional) - sent as theX-PF-Store-Idheader
Workflow
1. Authentication & store context
- Load
PRINTFUL_API_TOKENand optionalPRINTFUL_STORE_IDfrom the environment. - Verify the store via
GET /stores. Anativestore means the product does not exist yet - switch toprintful-product-builder. An integration store (etsy,shopify, ...) means the listing exists and this skill is the right tool.
2. Resolve the target product and variant
GET /sync/products/{id}returnssync_productplussync_variants.- Pick the variant by
--variant-id,--external-id,--sizeand/or--color. Report every available variant when nothing matches, so the choice is not guessed.
3. Register and validate the design
POST /fileswith{type, url, filename, visible}registers the design.- Poll
GET /files/{id}untilstatus == "ok"so dimensions and DPI are validated before the variant is modified. Afailedstatus means Printful could not process the image - stop rather than attach a broken file. - Append a cache-busting query parameter with
--cache-bustwhen the file at a reused URL may have changed.
4. Prepare embroidery thread colours
For EMBROIDERY, pick the placement (for example embroidery_chest_left) and
choose one of three modes:
- detect -
POST /files/thread-colorsreturns up to 6 hex colours; map them to the placement's option id (thread_colors_chest_left,thread_colors, ...). - auto - set
{"id": "auto_thread_color", "value": true}in the file options. - full_color - set
{"id": "full_color", "value": true}in the file options for Unlimited Color embroidery. - Always set
embroidery_typetoflat,3d, orboth.
5. Attach
PUT /sync/variant/{id}with the file entry ({type, id}), optionalretail_price,sku,is_ignoredand variantoptions.- Print the resulting variant state so the change is verifiable.
Usage
# Attach a design to an existing variant
python scripts/attach_printful_design.py --product-id 501345091 --size M --color Black \
--file-url https://example.com/design.png --price 29.99
# Embroidery with detected thread colours
python scripts/attach_printful_design.py --variant-id 5680191910 \
--file-url https://example.com/logo.png --price 32.00 \
--technique EMBROIDERY --placement embroidery_chest_left --thread-mode detect
# Rehearse without writing to the store
python scripts/attach_printful_design.py --product-id 501345091 --size M \
--file-url https://example.com/design.png --price 29.99 --dry-run
--dry-run resolves the variant, registers and validates the file, builds the exact
PUT payload, prints it, and stops before the write.
Guardrails
- Never attach a design to a live listing without the owner's approval for that specific listing. The owner's standing rule is that design work is shown for approval before a listing is created or published.
- Prefer
--dry-runfirst, then apply the same command without it. - Keep the token in the environment; never print it or write it into artifacts.
