Photo and video uploads for iOS and Android apps
Your app asks your backend for a presigned URL, PUTs the photo or video straight to Dreep, and your backend confirms it. The API key never ships in the app, HEIC is accepted as is, and dpr matches each screen.
How it works
Your backend is the only thing holding the Dreep API key. The app only ever sees a single-use upload URL.
- 1
App picks a file
HEIC, JPEG, MP4 or MOV
- 2
Backend presigns
Checks the user
- 3
App PUTs bytes
URLSession or OkHttp
- 4
Backend confirms
Returns delivery URLs
- 5
App renders
Adds dpr for its screen
Presign and confirm on your backend
Presign returns the upload URL to the app. Confirm finalises the asset and hands back the URLs the app will render.
import { Dreep } from "dreep";
const dreep = new Dreep({ apiKey: process.env.DREEP_API_KEY });
// POST /uploads/presign (the app calls this with its user session)
export const presignMobileUpload = ({ userId, filename, contentType, sizeBytes }) =>
dreep.presignUpload({
filename,
contentType,
sizeBytes,
folder: "users/" + userId + "/uploads",
});
// POST /uploads/:id/confirm. The app appends &dpr=1, 2 or 3.
export const confirmMobileUpload = async ({ id }) => {
const asset = await dreep.confirmUpload({ id });
return { id: asset.id, feed: dreep.url(asset, { width: 384, format: "avif" }) };
};// POST /uploads/presign
upload, err := client.PresignUpload(ctx, dreep.PresignOptions{
Filename: body.Filename,
ContentType: body.ContentType, // "image/heic" is accepted as is
SizeBytes: body.SizeBytes,
Destination: dreep.Destination{Folder: "users/" + userID + "/uploads"},
})
// POST /uploads/{id}/confirm
asset, err := client.ConfirmUpload(ctx, id, nil)
feed := client.URL(asset.ID, &dreep.Transform{Width: 384, Format: dreep.FormatAVIF})# 1. Your backend presigns (API key stays server side)
curl -X POST https://api.dreep.cloud/api/v1/upload/presign \
-H "Authorization: Bearer $DREEP_API_KEY" \
-H "Content-Type: application/json" \
-d '{"filename":"IMG_0042.HEIC","contentType":"image/heic","sizeBytes":3145728,
"folder":"users/u_193/uploads"}'
# 2. The app PUTs to uploadUrl, then 3. your backend confirms
curl -X POST https://api.dreep.cloud/api/v1/upload/$UPLOAD_ID/confirm \
-H "Authorization: Bearer $DREEP_API_KEY"Why mobile teams use it
No key in the binary
Presigned URLs are single use and expire after 10 minutes, so there is nothing long-lived to steal.
dpr on the URL
One URL pattern for every device, with no separate 1x, 2x and 3x renditions to maintain.
Video previews from the original
Posters, short MP4 clips and GIFs are URL parameters on the uploaded video.
Frequently asked questions
Can I put the Dreep API key in my iOS or Android app?
No. The key can be extracted from an app package. Keep it on your backend and give the app a presigned upload URL for each file.
Do I need to convert HEIC to JPEG before uploading?
No. HEIC and HEIF are accepted inputs. Upload as captured and request format=avif or format=webp when you display the photo.
Why does my GIF or clip URL return 202?
Re-encodes and GIFs are processed in the background. Request the same URL again later and it returns 200 from cache.
Is there a Swift or Kotlin SDK?
No. The official SDKs are JavaScript and Go, for your backend. On the device the upload is a plain HTTP PUT with URLSession or OkHttp.
Upload from a real phone today
Add one presign endpoint to your backend and render the photo with dpr for the device.