Download a generated try-on image as a file. This endpoint proxies downloads from S3 to avoid CORS issues when downloading images in iframes or cross-origin contexts.
Rate limit: 100 downloads per minute.
Query Parameters
The URL of the image to download. Must be from the Genlook S3 bucket.
Optional filename for the download. If not provided, defaults to "Genlook - Your Try On.jpg". If a product name is available, format: "Genlook - Your Try On - {Product Name}.jpg".
curl "https://your-store.myshopify.com/apps/proxy_genlook-x/public/download-image?url=https://s3.amazonaws.com/bucket/image.jpg&filename=My%20Try%20On.jpg" \
--output downloaded-image.jpg
Response
The response is a binary image file with appropriate headers:
Content-Type : image/jpeg or image/png (based on image format)
Content-Disposition : attachment; filename="..." (triggers download)
Content-Length : Size of the image file in bytes
HTTP / 1.1 200 OK
Content-Type : image/jpeg
Content-Disposition : attachment; filename="Genlook - Your Try On - T-Shirt.jpg"
Content-Length : 245678
[ binary image data ]
Security
The URL must be from the Genlook S3 bucket. Invalid URLs will return HTTP 400 Bad Request.
The endpoint validates that:
The URL points to the Genlook S3 bucket
The URL is properly formatted
The image exists and is accessible
This endpoint proxies downloads to avoid CORS issues. Direct S3 downloads may be blocked by browser CORS policies, especially in iframe contexts.
If you don’t provide a filename, the system generates one:
Default: "Genlook - Your Try On.jpg"
With product: "Genlook - Your Try On - {Product Name}.jpg"
The product name is sanitized:
Special characters removed (except spaces and hyphens)
Length limited to 50 characters
Spaces normalized
Include the product name in the filename for better organization when customers download multiple try-on images.
Error Responses
400 Bad Request
400 Bad Request
404 Not Found
429 Too Many Requests
500 Internal Server Error
{
"message" : "Image URL is required"
}
Usage Examples
Trigger Browser Download
function downloadImage ( imageUrl , productName ) {
const filename = productName
? `Genlook - Your Try On - ${ productName } .jpg`
: 'Genlook - Your Try On.jpg' ;
const downloadUrl = `/apps/proxy_genlook-x/public/download-image?` +
`url= ${ encodeURIComponent ( imageUrl ) } &` +
`filename= ${ encodeURIComponent ( filename ) } ` ;
// Create temporary link and click it
const link = document . createElement ( 'a' );
link . href = downloadUrl ;
link . download = filename ;
document . body . appendChild ( link );
link . click ();
document . body . removeChild ( link );
}
Download with Fetch API
async function downloadImageAsBlob ( imageUrl , filename ) {
const response = await fetch (
`/apps/proxy_genlook-x/public/download-image?` +
`url= ${ encodeURIComponent ( imageUrl ) } &` +
`filename= ${ encodeURIComponent ( filename ) } `
);
if ( ! response . ok ) {
throw new Error ( 'Download failed' );
}
const blob = await response . blob ();
const url = window . URL . createObjectURL ( blob );
const link = document . createElement ( 'a' );
link . href = url ;
link . download = filename ;
link . click ();
window . URL . revokeObjectURL ( url );
}
The download endpoint is particularly useful in iframe contexts where direct S3 downloads may be blocked by browser security policies.