This is an optional upload service provided by Social Print Studio to make integration easier. It gives you a simple way to upload images and receive publicly accessible URLs — which is exactly what the Order Handoff API requires when submitting orders.
publicUrl can then be passed straight into the projectData.photos array when calling the Add to Cart API.
If your app already hosts images at publicly accessible URLs (e.g. via your own S3 bucket, Cloudinary, Firebase Storage, etc.), you do not need this service — just pass those URLs directly to the Order Handoff API.
Upload files to S3 via presigned URLs. Supports images and other file types (PDFs, documents, etc.). Max file size is 50MB per file.
https://72yesvnolvy3nfva5gmjsqneye0knrvo.lambda-url.us-east-1.on.aws/
const response = await fetch('https://72yesvnolvy3nfva5gmjsqneye0knrvo.lambda-url.us-east-1.on.aws/', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
filename: 'photo.jpg', // required
fileSize: 1234567, // optional - enables 50MB validation
contentType: 'image/jpeg', // optional - auto-detected from filename
folder: 'lambda-uploads' // optional - defaults to 'lambda-uploads'
})
});
const { uploadUrl, publicUrl } = await response.json();
await fetch(uploadUrl, {
method: 'PUT',
headers: {
'Content-Type': 'image/jpeg'
},
body: file // raw File object
});
// File is now live at publicUrl
async function uploadToS3(file, folder = 'lambda-uploads') {
// Step 1: Get presigned URL from Lambda
const response = await fetch('https://72yesvnolvy3nfva5gmjsqneye0knrvo.lambda-url.us-east-1.on.aws/', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
filename: file.name,
fileSize: file.size,
contentType: file.type,
folder
})
});
if (!response.ok) {
const error = await response.json();
throw new Error(error.message || 'Failed to get upload URL');
}
const { uploadUrl, publicUrl } = await response.json();
// Step 2: Upload file directly to S3 using the presigned URL
const uploadResponse = await fetch(uploadUrl, {
method: 'PUT',
headers: {
'Content-Type': file.type
},
body: file
});
if (!uploadResponse.ok) {
throw new Error(`S3 upload failed: ${uploadResponse.status}`);
}
return publicUrl;
}
// Usage
const publicUrl = await uploadToS3(fileFromInput);
| Parameter | Description |
|---|---|
filename |
The original filename (used for S3 key and content type detection) |
| Parameter | Description |
|---|---|
fileSize |
File size in bytes. Recommended. Enables 50MB validation before upload. |
contentType |
MIME type (e.g., image/jpeg, application/pdf, text/plain). Auto-detected from filename if not provided. |
folder |
S3 subfolder path. Default: lambda-uploads |
JPG or PNG for photos. Some book products accept PDF files — check the specific product's JSON file in the product catalog for details.
fileSize is provided in the request)s3://serverless-image-handler-test-sps/{folder}/{timestamp}-{random}-{filename}https://serverless-image-handler-test-sps.s3.us-east-1.amazonaws.com/...x-amz-acl parameter is baked into the presigned URL — do NOT send it as a headerOnce you have publicly accessible image URLs (either from this upload service or your own hosting), you're ready to submit an order. See the Order Handoff API to add products to the Social Print Studio cart.