Picsha AI

Quickstart Guide

Picsha AI allows you to instantly upload, intelligently process, and deliver media around the globe using our edge network.

1. Get an API Key

To interact with the Delivery or Upload APIs programmatically, you'll need an API key.

  1. Navigate to the API Keys tab in your dashboard.
  2. Click Generate New Key.
  3. Store this key securely. Your API key (sk_live_...) is a secret: it carries full read, write, and delete rights over your organization, so it belongs on your server only — never in browser code, a mobile bundle, or a public repo.

WARNING

Picsha does not currently issue a separate browser-safe "publishable" key. Any credential you hand to a browser must be either a short-lived Picsha session token belonging to a user signed in to Picsha, or a URL your backend has already signed (a presigned upload URL or a signed delivery URL). Picsha has no API for minting your own end-user tokens. See Architecture & Concepts for the full credential model.

2. Uploading an Image

The simplest path is a single multipart/form-data request from your server. It stores the file, creates the asset and queues it for processing in one call (files up to 100 MB):

curl -X POST https://api.picsha.ai/v1/assets \
  -H "Authorization: Bearer $PICSHA_API_KEY" \
  -F "file=@photo.jpg"

For larger files, or uploads that go straight from a browser to storage, upload the bytes first and then register them:

  1. Get an upload target from your server: a presigned S3 URL from GET /v1/assets/presigned?filename=…&contentType=…, or the tus resumable endpoint (/v1/upload/resumable).
  2. Upload the bytes to it.
  3. Register the upload with POST /v1/assets and { "s3Key": "<key>" }. Until you do, the file is only stored: it is not processed, searchable or deliverable. See Register a Direct Upload for how to derive the s3Key.

Your API key must stay on your server, so for uploads by your own end users, have your backend request the presigned URL, hand only that URL to the browser for the PUT, and register the upload from your backend afterwards.

The React SDK's PicshaUploadWidget does all three steps in the browser. Its getToken callback must return a Picsha session token for a user signed in to Picsha itself (it is sent as Authorization: Bearer <token>), so it suits internal tools where your team signs in to Picsha — not anonymous end users:

import { PicshaUploadWidget } from '@picsha-ai/react';

export default function MyUpload() {
  return (
    <PicshaUploadWidget
      // A Picsha session token for the signed-in user. Never your sk_live_... key.
      getToken={getPicshaSessionToken}
      onUploadSuccess={(asset) => console.log('Upload finished:', asset.id)}
    />
  )
}

3. Delivering the Image

Once uploaded, Picsha instantly encodes and distributes your media via CloudFront.

<img src="https://cdn.picsha.ai/render/550e8400-e29b-41d4-a716-446655440000?fit=cover&h=500&w=500" />

Any image parameters (h, w, fit) are automatically computed on the fly by our high-performance Sharp (libvips) image processors!

WARNING

By default, plain transforms of your assets are publicly deliverable. Generative edits (MIMI, background removal and replacement) always need your API key or a signed URL (?sig=...), so nobody can run paid generations against your account. To require signatures on plain renders of a specific asset too, set requiresSignature: true on it. See Signed Delivery URLs.