Guide
Create archives
Create and extract password-protected archives.
The archive capabilities let you bundle several inputs into a single compressed file, password-protect it, and unpack existing archives back into their original contents. Creating an archive is a normal conversion to an archive target; extracting one is an operation that returns a manifest of what is inside.
Create an archive
Convert to an archive target to pack one or more inputs into a single file. Supported archive targets are 7Z, ZIP, GZ and BZ2. Add multiple objects to the input array and they are all packed into the same archive.
{
"input": [
{
"type": "remote",
"source": "https://example-files.online-convert.com/document/pdf/example.pdf"
},
{
"type": "remote",
"source": "https://example-files.online-convert.com/raster%20image/png/example.png"
}
],
"conversion": [
{
"category": "archive",
"target": "zip"
}
]
}
Submit the job with your API key:
curl -X POST https://api.api2convert.com/v2/jobs \
-H "x-oc-api-key: <your-api-key>" \
-H "Content-Type: application/json" \
-d @create-archive.json
Password-protect the archive
Pass encrypt_password in the conversion options to encrypt the output archive. Anyone opening it will need this password.
{
"conversion": [
{
"category": "archive",
"target": "zip",
"options": {
"encrypt_password": "secret"
}
}
]
}
Extract an archive
Use the extract-archive operation to unpack an existing archive. Enable the summary option to receive a JSON manifest describing the files contained in the archive.
{
"input": [
{
"type": "remote",
"source": "https://example-files.online-convert.com/archive/zip/example.zip"
}
],
"conversion": [
{
"category": "operation",
"target": "extract-archive",
"options": {
"summary": true
}
}
]
}
Extract an encrypted archive
For password-protected archives, supply the password on the input object via credentials.decrypt_password so the archive can be opened before extraction.
{
"input": [
{
"type": "remote",
"source": "https://example-files.online-convert.com/archive/zip/example.zip",
"credentials": {
"decrypt_password": "secret"
}
}
],
"conversion": [
{
"category": "operation",
"target": "extract-archive",
"options": {
"summary": true
}
}
]
}
decrypt_password belongs on the input (it unlocks the source), whereas encrypt_password belongs in the conversion options (it locks the new output). See the full list of archive targets in the format explorer.Live options
Pick an archive target or the extract operation to see its live options:
Loading options…