Upload Customizable File
A file-type customizable option (e.g. "upload your design") needs a binary file. A file cannot travel over GraphQL, so the upload itself is a REST call — but the rest of the flow stays in GraphQL. You upload once over REST to get a token, then reference the token in the GraphQL Add to Cart mutation.
The flow
- Read the option from the product's
customizableOptions(Single Product) — afile-type option carries its_idand the allowed extensions. - Upload the file over REST —
POST /api/shop/customizable-option-files(multipart) withproduct_id,option_id,file. It returns a short-livedtoken. This is REST-only; see the REST upload endpoint for the full request/response. - Add to cart over GraphQL — pass the token as that option's value:
customizableOptions: { "11": ["<token>"] }. The mutation carries only the token string. - Core owns the rest — the file is stored with the cart, then moved to the order automatically at place-order.
Which file formats are allowed?
There is no fixed API list — the admin sets the allowed extensions per option (the option's "Supported File Extensions", e.g. pdf or jpg,png,pdf). Read them from the product's customizableOptions; a mismatched extension is rejected at upload.
Related
- Add to Cart — reference the token here
- Single Product — read the customizable options
- REST upload endpoint — the actual multipart upload

