← Back to blog

Zip Files with curl: Free ZIP & Unzip API for AI Agents

August 31, 2026 · Eric · 8 min read

Bundling files into a ZIP archive is one of those tasks that looks trivial on a laptop and becomes annoyingly hard inside a script. Your agent needs to hand a human a tidy archive of logs, screenshots, and export files. A pipeline needs to compress a folder of generated assets before uploading them. A support workflow needs to peek inside an archive it just received — without extracting anything to disk.

Agent Media Tools exposes both sides of that job as plain REST endpoints: POST /api/zip to bundle multiple uploaded files into an archive and return a download URL, and POST /api/unzip to list the contents of an archive you upload. No SDK, no API key required, no local zip binary needed on the machine running your script.

Quick Reference

EndpointMethodWhat it does
/api/zipPOSTAccepts up to 50 uploaded files (multipart, field files), returns a ZIP download URL
/api/unzipPOSTAccepts one ZIP (multipart, field file), returns the entry listing

Both endpoints return JSON. The ZIP endpoint accepts up to 50 files per request, with a 25 MB per-file upload limit and a 250 MB total ceiling. Anonymous requests share the site's free daily allowance; signing in raises that allowance. Check the pricing page for current plan limits.

Create a ZIP with curl

Send every file you want archived as a repeated -F "files=@path" part. The server preserves each file's original name inside the archive.

curl -X POST https://agentmediatools.com/api/zip \
  -F "files=@report.pdf" \
  -F "files=@screenshot.png" \
  -F "files=@logs/app.log"

The response is small and predictable:

{
  "success": true,
  "url": "/downloads/a-1756635800000.zip",
  "files": 3,
  "size": 48291
}

files is the number of entries archived and size is the resulting ZIP size in bytes. The url is a relative path served from the static /downloads route, so the full address is just the site origin plus that path. Fetch it immediately in a second request:

curl -o bundle.zip "https://agentmediatools.com/downloads/a-1756635800000.zip"

Treat the generated file as ephemeral: it exists on the server so your script can download it, not as a permanent home for your data. Download the archive as soon as you create it.

Create a ZIP with Python (requests)

There is no special client library to install — the built-in requests package is all you need. Repeat the files key once per file:

import requests

url = "https://agentmediatools.com/api/zip"
files = [
    ("files", ("report.pdf", open("report.pdf", "rb"), "application/pdf")),
    ("files", ("screenshot.png", open("screenshot.png", "rb"), "image/png")),
    ("files", ("app.log", open("app.log", "rb"), "text/plain")),
]

resp = requests.post(url, files=files)
resp.raise_for_status()
result = resp.json()

download = requests.get("https://agentmediatools.com" + result["url"])
download.raise_for_status()
with open("bundle.zip", "wb") as f:
    f.write(download.content)

print(f"Archived {result['files']} files -> {result['size']} bytes")

This pattern is easy to generalize into a batch helper that walks a directory and attaches every file it finds. Because the API takes one request per archive, a pipeline can build one ZIP per customer, per order, or per job without touching the filesystem's zip command or fighting platform differences.

Inspect a ZIP without extracting it

The unzip endpoint is deliberately read-only. You upload a single ZIP file and get back a listing of its entries — name, uncompressed size, and whether the entry is a directory. Nothing is extracted to the server and there is no endpoint to fetch individual entries; you get the manifest, which is exactly what an agent needs to decide what to do next.

curl -X POST https://agentmediatools.com/api/unzip \
  -F "file=@bundle.zip"
{
  "success": true,
  "files": 3,
  "entries": [
    { "name": "report.pdf", "size": 21408, "dir": false },
    { "name": "screenshots/", "size": 0, "dir": true },
    { "name": "screenshots/shot-1.png", "size": 91822, "dir": false }
  ]
}

files counts only the non-directory entries. The dir flag lets you reconstruct the folder structure — useful for validating that an archive matches an expected layout before you trust it.

Inspect a ZIP with Python

import requests

resp = requests.post(
    "https://agentmediatools.com/api/unzip",
    files={"file": open("bundle.zip", "rb")},
)
resp.raise_for_status()
data = resp.json()

for entry in data["entries"]:
    kind = "dir " if entry["dir"] else f"{entry['size']:>10} bytes"
    print(f"{kind}  {entry['name']}")

print(f"Total files: {data['files']}")

Run this against an archive your agent just downloaded and you can answer questions like "does this export contain a manifest.json?" or "is there anything nested under data/?" without ever unzipping to disk — a small but real win for sandboxed or serverless runtimes where writing temp files is awkward.

Practical use cases

Limits and honest boundaries

Errors are JSON: a request with no files returns 400, while an unreadable archive returns an unsuccessful response body. Check both the HTTP status and the JSON success field before continuing your pipeline.

Zip and move on

Archive handling is a solved problem on a desktop and a recurring friction point in automation. Two public endpoints — one to bundle, one to inspect — cover the common cases without an SDK, a signup, or a local binary. If you want to try it in the browser first, the same tools are one click away in the toolbox.

Try it in the Toolbox

Run the same tools in the browser, or call them from your agent with an API key.

Open toolbox