Create a ZIP from file URLs by API: one link, many files

Bundle up to 100 files from URLs, base64 or earlier results into one ZIP with one API call. File names, duplicates, what gets compressed, and the 200 MB limit.

Four file URLs bundled into one ZIP with a single download link

"Download all" is one of the most requested buttons in any app that stores files. Building it means fetching every file, zipping them, storing the ZIP and returning a link. The ZIP Files API does all of that in one call.

curl https://api.justapi.tech/v1/files/zip \
  -H "Authorization: Bearer ak_live_..." \
  -H "Content-Type: application/json" \
  -d '{"sources": [{"url": "https://files.example.com/invoice-1042.pdf"}, {"url": "https://files.example.com/photo.jpg"}, {"file_id": "file_01J..."}], "options": {"names": ["invoice.pdf", "site-photo.jpg", "report.pdf"], "filename": "order-1042.zip"}}'

Sources

Each source is one of:

  • url: a public http or https link. It passes the same private-address guard as every JustAPI download.
  • base64: the file itself, for small files.
  • file_id: the result of an earlier JustAPI call, read straight from storage. Use this to bundle compressed PDFs or optimized images without downloading them first.

Up to 100 sources and 200 MB in total per ZIP.

Names

names sets the name of each file inside the ZIP, in the same order as sources. Without it, files are named file-1.pdf, file-2.jpg and so on, with the extension guessed from the content. Duplicate names get " (2)" so nothing is overwritten. Slashes and other unsafe characters are replaced, so a name cannot escape the ZIP's folder.

filename names the ZIP itself.

What gets compressed

Formats that are already compressed, like JPG, PNG, PDF, XLSX, DOCX and MP4, are stored as they are. Compressing them again saves almost nothing and takes time. Text formats like CSV, JSON and TXT are deflated, which often shrinks them by 70% or more.

All or nothing

If one URL cannot be downloaded, the call fails with invalid_source and the source_index of that file. No partial ZIP is made, and nothing is charged.

Cost

$0.003 per ZIP at the first tier, for one file or a hundred.

The free ZIP tool bundles up to 20 files from your computer.