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.
The returned publicUrl can be passed directly into the projectData.photos array when calling the Order Handoff API.
When to use this:
If your application doesn’t have its own backend or image hosting, or if you’d rather not manage file storage yourself, use this endpoint to upload customer photos directly to our S3 bucket.
When to skip this:
If your app already hosts images at publicly accessible URLs (e.g. via your own S3 bucket, Cloudinary, Firebase Storage, etc.), just pass those URLs directly to the Order Handoff API. You don’t need this service.
Endpoint
text
POST https://printkit.dev/api/uploadAuthorization: Bearer <your-api-key> (optional)
Upload files to S3 via presigned URLs. Supports images and other file types (PDFs, documents, etc.). Max file size is 50 MB per file. Optionally include an API key for attribution. If an invalid key is provided, the API returns 401.
Usage
The upload process is two steps: get a presigned upload URL, then send the file directly to S3 using that URL.
curl -X PUT "UPLOAD_URL_FROM_STEP_1" \ -H "Content-Type: image/jpeg" \ --data-binary @photo.jpg# File is now live at the publicUrl from Step 1
await fetch(uploadUrl, { method: 'PUT', headers: { 'Content-Type': 'image/jpeg' }, body: file // raw File object from a file input});// File is now live at publicUrl
import httpxwith open("photo.jpg", "rb") as f: upload_response = httpx.put( upload_url, # from Step 1 headers={"Content-Type": "image/jpeg"}, content=f.read(), )# File is now live at public_url from Step 1
Important
The x-amz-acl parameter is baked into the presigned URL — do not send it as a header, or the request will fail.
Complete Helper Function
A drop-in helper that handles both steps and returns the final public URL:
# Step 1: Get a presigned upload URLUPLOAD_RESPONSE=$(curl -s -X POST https://printkit.dev/api/upload \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "filename": "photo.jpg", "source": "my-app", "email": "[email protected]", "fileSize": 1234567, "contentType": "image/jpeg" }')# Extract URLs from response (requires jq)UPLOAD_URL=$(echo $UPLOAD_RESPONSE | jq -r '.uploadUrl')PUBLIC_URL=$(echo $UPLOAD_RESPONSE | jq -r '.publicUrl')# Step 2: Upload the file directly to S3curl -X PUT "$UPLOAD_URL" \ -H "Content-Type: image/jpeg" \ --data-binary @photo.jpg# Step 3: Use the public URL in your order submissioncurl -X POST https://printkit.dev/api/add-to-cart \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d "{ \"sku\": \"metal-print-4x4\", \"source\": \"my-app\", \"email\": \"[email protected]\", \"projectData\": { \"photos\": [\"$PUBLIC_URL\"] } }"