Upload tokens — why your API key stays server-side

Your ek_ API key is your tenant. Anyone holding it can read every video, change your config, and rotate your webhooks. It must never be embedded in a mobile app or web bundle — extracting secrets from shipped clients is trivial.

But uploads should go device → Energixer directly: proxying a 200 MB file through your backend doubles your egress, adds your server to the failure path, and breaks resumability at your hop.

The upload token resolves this tension:

  1. Your backend calls POST /v1/videos (with the API key, server-side).
  2. The response includes an upload_token — a short-lived JWT that is a capability for exactly one video: claims {type: "upload", video_id, domain_id}, expiring after 2 hours.
  3. The device performs the tus protocol with Authorization: Bearer <upload_token>.

Properties worth knowing:

Rule of thumb: the API key lives where your database credentials live. The upload token lives wherever the file lives.