PixViroDocs

Uploading

Upload files, import from URLs, let browsers upload directly, and import in bulk.

Upload a file

POST /v1/assets with multipart/form-data (assets:write). The format is detected from the bytes, never from the file name.

curl https://pixviro.com/v1/assets \
  -H "Authorization: Bearer $PIXVIRO_API_KEY" \
  -F file=@red-shoe.jpg \
  -F public_id=products/red-shoe \
  -F tags=shoes,sale \
  -F 'custom_metadata={"sku":"RS-42"}' \
  -F eager='c_fill,w_800,h_600,f_auto'
Field
file The image or PDF (JPEG, PNG, GIF, WebP, AVIF, HEIF, TIFF, PDF).
public_id Exact public ID; omit for a random one. folder puts it in a folder.
overwrite true to replace an existing asset (creates a new version).
tags Comma-separated or an array.
custom_metadata JSON object of your own key/value fields.
eager Transformations to generate right away, so the first visitor never waits.
access public (default) or private — see Signed URLs.

Size, pixel and page limits depend on your plan; uploads over them are refused with 413/422 and a clear error.

Import from a URL

POST /v1/assets/import with {"url": "https://…", …} takes the same options. PixViro fetches over HTTPS from public addresses only.

curl https://pixviro.com/v1/assets/import \
  -H "Authorization: Bearer $PIXVIRO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/photos/beach.jpg","folder":"imports"}'

Signed browser uploads

Let users upload straight from the browser without exposing your API key: your backend asks for a single-use upload URL, the browser posts the file to it.

// Server
const { upload_url } = await pixviro.uploads.sign({
  folder: 'avatars',
  maxBytes: 5_000_000,
  allowedFormats: ['jpeg', 'png', 'webp'],
});

// Browser
const body = new FormData();
body.append('file', input.files[0]);
const asset = (await (await fetch(upload_url, { method: 'POST', body })).json()).data;

Everything except the file is decided by your backend (where it goes, limits, tags, metadata). The URL works once and expires (10 minutes by default).

Upload widget

For a ready-made UI (drag and drop, progress per file, retries), embed the upload widget. For each file it asks your backend for a signed upload (your endpoint calls POST /v1/uploads/sign and returns the JSON):

<div id="uploader"></div>
<script src="https://pixviro.com/widget/v1/upload.js"></script>
<script>
  PixViro.uploadWidget('#uploader', {
    signature: async (file) => (await fetch('/pixviro/sign', { method: 'POST' })).json(),
    onUpload: (asset, file) => console.log(asset.url),
    onError: (error, file) => console.warn(error.message),
  });
</script>

Options include multiple, accept, maxFileSize, concurrency, labels (for translations) and theme. See Developers → Upload widget in the dashboard for a live configurator.

Bulk import

Import up to 1,000 URLs per batch, processed in the background with retries:

curl https://pixviro.com/v1/imports \
  -H "Authorization: Bearer $PIXVIRO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"items":[{"url":"https://example.com/a.jpg","public_id":"catalog/a"},{"url":"https://example.com/b.jpg"}]}'

Follow progress with GET /v1/imports/{id} (and /items for each URL's result), or listen for the import.finished webhook. In the dashboard, Bulk import accepts a list of URLs or a CSV. Moving from another service? See Migrate from Cloudinary or S3.