Skip to content

Downloadable Products — Upload Link / Sample File

Uploads the binary file for a file-type downloadable link or sample and returns its stored path.

How the two-step flow works

This endpoint only stores the file and returns its path. You then attach that path to the link/sample on the product update: set downloadable_links[link_x][file] = <path> and type = file (or downloadable_samples[sample_x][file]). URL-type links/samples don't need this — set their url directly on the update.

REST only

Binary file parts are not transportable over JSON GraphQL — these endpoints are REST-only.

Endpoints

EndpointMethod
/api/admin/catalog/products/{productId}/downloadable-links/uploadPOST
/api/admin/catalog/products/{productId}/downloadable-samples/uploadPOST

Content type

multipart/form-data — required.

Form fields

FieldTypeRequiredNotes
filefileyesThe binary file to store (max 128 MB).

Response

201 Created

FieldTypeNotes
typestringlink or sample.
pathstringStorage-relative file path — use this on the product update.
namestringOriginal file name.
urlstring | nullURL if the storage disk exposes one, otherwise null.

Errors

HTTPCause
401 UnauthorizedMissing or invalid admin Bearer token.
403 ForbiddenAdmin role lacks catalog.products.edit.
404 Not FoundProduct not found.
422 Unprocessable EntityMissing file, or file too large.

Released under the MIT License.