Uploads API Routes
Use these API routes to upload files to your MedusaGo application using the installed file module provider.
You can upload public files, such as product images, or private files, such as CSV files used to import products.
POST /admin/uploads#
Upload Files
Upload files to the configured File Module Provider.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Request body (application/json)
(body)object | object[]The files to upload.
(body)object | object[]Request examples
Responses
200 OK
filesobject[]The list of uploaded files.
filesobject[]400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/uploads/presigned-urls#
Get Presigned Upload URL
Get a presigned URL for uploading a file to the configured File Module Provider. The presigned URL can be used to upload files directly to the third-party provider. This only works if your configured provider supports presigned URLs, such as the S3 provider.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Request body (application/json)
originalnamestringsizenumbermime_typestringtext/csvaccess"public" | "private"Optionalprivate, the file will not be publicly accessible. The default value depends on the configured File Module Provider.Request examples
Responses
200 OK
urlstringfilenamestringoriginalnamestringmime_typestringtext/csvextensionstringcsvsizenumber400, 401, 404, 409, 422, 500: an error response is returned.
GET /admin/uploads/{id}#
Get a File
Retrieve an uploaded file by its ID. You can expand the file's relations or select the fields that should be returned.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringQuery parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.Request examples
Responses
200 OK
fileobjectA file's details.
fileobject400, 401, 404, 409, 422, 500: an error response is returned.
DELETE /admin/uploads/{id}#
Delete a File
Delete a file. Uses the installed file module provider to delete the file.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringRequest examples
Responses
200 OK
idstringobjectstringDefault: "file"
deletedboolean400, 401, 404, 409, 422, 500: an error response is returned.