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. 1

    App picks a file

    HEIC, JPEG, MP4 or MOV

  2. 2

    Backend presigns

    Checks the user

  3. 3

    App PUTs bytes

    URLSession or OkHttp

  4. 4

    Backend confirms

    Returns delivery URLs

  5. 5

    App renders

    Adds dpr for its screen

Up to 500 MB per file. Upload URLs are valid for 10 minutes.

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" }) };
};

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.

Related

Upload from a real phone today

Add one presign endpoint to your backend and render the photo with dpr for the device.