Upload product media
Attach a file to a product. Uploading is three steps: get a signed upload URL, upload the file to it, then create the media record.
Endpoint
POST/products-media
Step 1: Get a signed upload URL
| Name | Type | Required | Description |
|---|---|---|---|
type | string | Yes | product-media. |
filename | string | Yes | Original file name. |
product_id | integer | Yes | Product that owns the file. |
contentType | string | No | MIME type of the file. |
json
Step 2: Upload the file
Step 3: Create the media record
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
organization_id | integer | Yes | Your organization ID (the API key's organization). The stored value is always the product's organization. |
product_id | integer | Yes | Product to attach the file to. |
file_name | string | Yes | Original file name. |
file_type | string | Yes | MIME type. |
file_path | string | Yes | s3PathWithoutBucket from step 1. |
s3_key | string | Yes | s3PathWithoutBucket from step 1 (same as file_path). |
s3_path | string | Yes | s3Path from step 1. |
file_size | integer | No | Size in bytes. |
position | integer | No | Display order, lowest first. Default 0. |
Request
Response
json
Errors
| Status | Cause |
|---|---|
400 Bad Request | product_id is required, or schema validation failed. |
403 Forbidden | organization_id is missing or is not the API key's organization. |
500 | The product does not exist (Could not fetch product details: …). |
Report an issue with this documentation
Please log in to report issues with our documentation.