Extract ZIP files API
POST /v2/convert/zip/to/extract unpacks an archive and returns each file inside as its own entry in Files[]. The 1,617-byte sample holds 7 entries in two folders; it came back as 5 files, two notes, a CSV, a PNG and a README, with the folders dropped.
- Endpoint
- POST /v2/
convert/ zip/ to/ extract - Accepts
- zip
- Sample timing
- under 1 ms median of 5 runsHow we measure
- Request size
- Up to 10 MB on the Free plan or 100 MB on paid plans, all files together
Request and response
Every sample below ran against the API before this page was published. Set PDFCONVERSIONAPI_KEY to your key and run it as is.
curl -sS -X POST \
https://api.pdfconversionapi.com/v2/convert/zip/to/extract \
-H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
-F File=@site-visit-packet.zip \
-o response.json
# FileData is base64. Save the first file in converted/,
# or print the JSON error.
if jq -e '.Files' response.json > /dev/null; then
mkdir -p converted
name=$(jq -r '.Files[0].FileName' response.json)
jq -r '.Files[0].FileData' response.json \
| base64 --decode > "converted/$name"
else
cat response.json
fiimport base64
import os
import requests
key = os.environ["PDFCONVERSIONAPI_KEY"]
response = requests.post(
"https://api.pdfconversionapi.com/v2/convert/zip/to/extract",
headers={"Authorization": f"Bearer {key}"},
files=[("File", open("site-visit-packet.zip", "rb"))],
timeout=180,
)
result = response.json()
if not response.ok:
raise SystemExit(f"{result['Code']}: {result['Message']}")
os.makedirs("converted", exist_ok=True)
for file in result["Files"]:
path = os.path.join("converted", file["FileName"])
with open(path, "wb") as out:
out.write(base64.b64decode(file["FileData"]))
print(path, file["FileSize"], "bytes")
import { mkdir, readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
const form = new FormData();
const file = "site-visit-packet.zip";
form.append("File", new Blob([await readFile(file)]), file);
const url = "https://api.pdfconversionapi.com/v2/convert/zip/to/extract";
const key = process.env.PDFCONVERSIONAPI_KEY;
const response = await fetch(url, {
method: "POST",
headers: { Authorization: `Bearer ${key}` },
body: form,
});
const result = await response.json();
if (!response.ok) {
throw new Error(`${result.Code}: ${result.Message}`);
}
await mkdir("converted", { recursive: true });
for (const file of result.Files) {
const path = join("converted", file.FileName);
await writeFile(path, Buffer.from(file.FileData, "base64"));
console.log(path, file.FileSize, "bytes");
}
{
"ConversionCost": 1,
"ConversionTime": 0,
"Files": [
{
"FileName": "notes.txt",
"FileExt": "txt",
"FileSize": 111,
"FileData": "RmVuY2UgcmVwYWlyLCAxNCBB…"
},
{
"FileName": "materials.csv",
"FileExt": "csv",
"FileSize": 78,
"FileData": "aXRlbSxxdWFudGl0eSx1bml0…"
},
{
"FileName": "north-gate.png",
"FileExt": "png",
"FileSize": 499,
"FileData": "iVBORw0KGgoAAAANSUhEUgAA…"
},
… 2 more files
]
}Response from our test run on 2026-11-03. ConversionTime shows the median of 5 runs. FileData is shortened here; the real response carries the whole file as base64.
The sample, converted
The same file the code sends. Download the input and the output and compare them yourself.
notes.txt, 3 lines
Fence repair, 14 Alder Court (fictional)Replace two posts by the north gate.Bring 4 bags of concrete mix.
- Input
- site-visit-packet.zip (1.6 KB)
- Output
- notes.txt (111 bytes)materials.csv (78 bytes)north-gate.png (499 bytes)notes-2.txt (51 bytes)README.extract (54 bytes)
- Source
- A small archive for a fictional fence repair job, made for this site: two folders, notes, a CSV materials list, a drawn photo of a gate and a file with no extension. (CC0-1.0). How it was made
- Made by
- 2026-11-04, API build
9eeeb0640aba
Parameters
Send these as form fields next to the file. Names are case-insensitive. If you set one of the documented options below that we don't support yet, the request fails with a 400 that names it instead of returning a file made without it.
| Parameter | What it does |
|---|---|
StoreFileboolean, default false | true keeps every extracted file for 3 hours and gives each one its own Files[].Url, instead of five base64 blocks in the JSON. |
What carries over, and what doesn't
Kept
- Each file's bytes, unchanged: all five sample files came out identical to their entries in the archive, and a test PDF whose Producer named a browser's PDF library came back as the same 636 bytes
- Stored and compressed entries alike: the PNG was stored, the text files deflated
- The archive's order: files are returned in the order of their entries
- Names with spaces and accents, such as
café menu.txtin a test archive - Extensions, which also set
FileExtin the response (txt,csv,png)
Lost or not yet supported
- Folders. Only each entry's own name is used, so
fence-job/photos/notes.txtcomes back asnotes-2.txtbesidenotes.txtfrom the folder above. - Names without an extension get
.extractadded:READMEcame back asREADME.extract, and.envasenv.extract, while theirFileExtis empty. - Leading dots on hidden files, as
.envshows. - Directory entries, which are skipped, and every entry's date and permissions.
- Nothing is filtered out: a
__MACOSX/._notes.txtentry from a Mac archive came back as_notes.txt.
Limits
- One ZIP per request, up to 10 MB on the Free plan or 100 MB on paid plans.
- At most 10,000 entries; more returns 413 "the archive has more than 10,000 entries".
- Up to 1,024 MB of extracted data, counted as it inflates rather than taken from the sizes the archive declares; past that, 413 "the archive expands beyond the size limit".
- Encrypted archives can't be opened yet: they return 422 "the input file is password-protected" without
Passwordand 400 "password-protected ZIP archives can't be opened yet" with it. - An archive holding only folders returns 422 "the input file could not be read: the archive contains no files", and a file that isn't a ZIP 422 "the input file could not be read: it is not a ZIP archive".
- 120 seconds per request, then 504.
Where teams use it
Batch uploads sent as one archive
Users often zip a folder of invoices, photos or scans before uploading it. Unpack it here and send each returned file on to the conversion it needs, such as images to PDF.
Reading archives in serverless code
Where your runtime has no unzip tool or no writable disk, one request returns the contents as base64 in JSON, ready to loop over by FileName.
Questions
What happens to the folder structure?
It is flattened. Each file keeps only its own name, and names that would clash get -2, -3 and so on, compared without regard to case. The paths are not reported, so if you need them, list the archive's entries yourself before uploading.
Can it open password-protected archives?
Not yet. ConvertAPI documents a Password option for this conversion. An archive without encryption opens with or without it, but a test archive encrypted with the password secret returned 400 "password-protected ZIP archives can't be opened yet" with Password=secret, and 422 "the input file is password-protected" without it.
What stops a hostile archive from causing damage?
Paths are cut down to the last name, so an entry called ../../etc/evil.sh came back as evil.sh. Extracted bytes are counted while they inflate and stop at the 1,024 MB limit, and archives with more than 10,000 entries are refused before anything is extracted.
Are archives inside the archive unpacked too?
No. A ZIP inside the ZIP is returned as a file, unchanged (inner.zip, 206 bytes, in our test). Send it in a second request to unpack it.
Convert your first ZIP file in a minute.