curl -X POST "https://api.genlook.app/storefront/v1/uploads" \
-H "Authorization: Bearer pk_your_key_here" \
-H "X-Genlook-Anonymous-Id: anon_..."
const response = await fetch('https://api.genlook.app/storefront/v1/uploads', {
method: 'POST',
headers: {
'Authorization': `Bearer ${PUBLISHABLE_KEY}`,
'X-Genlook-Anonymous-Id': anonymousId,
},
});
const { uploadUrl, uploadKey } = await response.json();
{
"uploadUrl": "https://storage.googleapis.com/bucket-name/tmp/abc123?X-Goog-Signature=...",
"uploadKey": "tmp/abc123"
}
Widget API Reference
Upload Image
Upload a customer photo for virtual try-on using the signed-URL flow
POST
/
storefront
/
v1
/
uploads
curl -X POST "https://api.genlook.app/storefront/v1/uploads" \
-H "Authorization: Bearer pk_your_key_here" \
-H "X-Genlook-Anonymous-Id: anon_..."
const response = await fetch('https://api.genlook.app/storefront/v1/uploads', {
method: 'POST',
headers: {
'Authorization': `Bearer ${PUBLISHABLE_KEY}`,
'X-Genlook-Anonymous-Id': anonymousId,
},
});
const { uploadUrl, uploadKey } = await response.json();
{
"uploadUrl": "https://storage.googleapis.com/bucket-name/tmp/abc123?X-Goog-Signature=...",
"uploadKey": "tmp/abc123"
}
Upload a customer photo using a 3-step signed-URL flow. Returns a
With the SDK, one call runs the whole 3-step flow below, validating the photo first:
No body required.
Send raw bytes with
Notify the backend to validate and process the image. Processing includes HEIC-to-JPEG conversion, HDR-to-SDR, and auto-crop to 4:5 aspect ratio centered on the detected person.
fileId used when creating try-ons.
On JavaScript, the
@genlook/storefront SDK is the recommended integration: it calls this endpoint for you, along with the rest of the try-on flow.SDK
const { fileId } = await genlook.uploadPhoto(file, {
fileSize: file.size,
mimeType: file.type,
fileName: file.name,
uploadSource: "gallery",
skipClientDimensionCheck: false,
});
Overview
Step 1: Prepare Upload
POST /storefront/v1/uploads
curl -X POST "https://api.genlook.app/storefront/v1/uploads" \
-H "Authorization: Bearer pk_your_key_here" \
-H "X-Genlook-Anonymous-Id: anon_..."
const response = await fetch('https://api.genlook.app/storefront/v1/uploads', {
method: 'POST',
headers: {
'Authorization': `Bearer ${PUBLISHABLE_KEY}`,
'X-Genlook-Anonymous-Id': anonymousId,
},
});
const { uploadUrl, uploadKey } = await response.json();
Response
string
required
Short-lived signed URL for uploading directly to cloud storage.
string
required
Opaque key identifying this upload. Pass it in the path of the complete step.
{
"uploadUrl": "https://storage.googleapis.com/bucket-name/tmp/abc123?X-Goog-Signature=...",
"uploadKey": "tmp/abc123"
}
Step 2: Upload to Storage
PUT the raw file directly to the signed URL. This goes to cloud storage, not through the Genlook API.PUT {uploadUrl}
Content-Type: application/octet-stream.
Supported formats: JPEG, PNG, WebP, HEIC/HEIF. Max size: 20 MB.
curl -X PUT "${UPLOAD_URL}" \
-H "Content-Type: application/octet-stream" \
--data-binary @customer-photo.jpg
await fetch(uploadUrl, {
method: 'PUT',
headers: { 'Content-Type': 'application/octet-stream' },
body: file,
});
Step 3: Complete Upload
POST /storefront/v1/uploads/{uploadKey}/complete
string
required
The
uploadKey from Step 1. It can contain slashes, so URL-encode it before putting it in the path.curl -X POST "https://api.genlook.app/storefront/v1/uploads/tmp/abc123/complete" \
-H "Authorization: Bearer pk_your_key_here" \
-H "X-Genlook-Anonymous-Id: anon_..." \
-H "Content-Type: application/json"
const response = await fetch(
`https://api.genlook.app/storefront/v1/uploads/${encodeURIComponent(uploadKey)}/complete`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${PUBLISHABLE_KEY}`,
'X-Genlook-Anonymous-Id': anonymousId,
'Content-Type': 'application/json',
},
},
);
const { fileId, fileUrl } = await response.json();
Response
string
required
Unique identifier for the processed file. Use this when creating try-ons. Treat it as an opaque string and pass it back exactly as received.
string
required
Signed URL for previewing the processed image.
string
required
Status message.
{
"fileId": "customer-media/acc_123/file_abc123xyz.jpg",
"fileUrl": "https://storage.googleapis.com/bucket-name/customer-media/acc_123/file_abc123xyz.jpg?X-Goog-Signature=...",
"message": "Image processed successfully"
}
Was this page helpful?

