---
title: "Create Archives"
description: "Create a task to create a ZIP, RAR, 7Z, TAR, TAR.GZ or TAR.BZ2 archive."
canonical_url: "https://cloudconvert.com/docs/operations/create-archives"
---
# Create Archives

> Create a task to create a ZIP, RAR, 7Z, TAR, TAR.GZ or TAR.BZ2 archive.

To create an archive, [create a job](https://cloudconvert.com/docs/raw/api-reference/jobs.md#create-job) with a `archive` task.

## Task Parameters

### archive task parameters

- `operation` _string_ required: Value is `archive`.
- `input` _string or array of task names_: The input task name(s) for this task.
- `output_format` _string_ required: The archive format.
- `engine` _string_: Use a specific engine for the conversion.
- `engine_version` _string_: Use a specific engine version for the conversion.
- `filename` _string_: Choose a filename (including extension) for the output file.
- `timeout` _integer_: Timeout in seconds after the task will be cancelled. By default, tasks time out after 5 hours.

Additional operation-specific parameters can be available depending on the input format and output format. Use the [operations API](https://cloudconvert.com/docs/raw/api-reference/operations.md#list-operations) to identify these dynamic parameters, for example by filtering for `archive` and including `options`: `GET https://api.cloudconvert.com/v2/operations?filter[operation]=archive&include=options`.

### Example job

Raw request:

```json
{
    "tasks": {
        "import-frist-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "import-second-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/logo.png"
        },
        "archive-my-files": {
            "operation": "archive",
            "input": [
                "import-frist-file",
                "import-second-file"
            ],
            "output_format": "zip"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "archive-my-files"
        }
    }
}
```

CLI:

```bash
# Install the CloudConvert CLI: npm install -g cloudconvert-cli
# The CloudConvert CLI does not support these task types: archive.
```

cURL:

```bash
$ curl -X POST "https://api.cloudconvert.com/v2/jobs" \
    -H "Authorization: Bearer API_KEY" \
    -H "Content-type: application/json" \
    -d '{
    "tasks": {
        "import-frist-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "import-second-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/logo.png"
        },
        "archive-my-files": {
            "operation": "archive",
            "input": [
                "import-frist-file",
                "import-second-file"
            ],
            "output_format": "zip"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "archive-my-files"
        }
    }
}' 
```

PHP:

```php
use \CloudConvert\CloudConvert;
use \CloudConvert\Models\Job;
use \CloudConvert\Models\Task;

$cloudconvert = new CloudConvert(['api_key' => 'API_KEY']);

$job = (new Job())
   ->addTask(
       (new Task('import/url', 'import-frist-file'))
         ->set('url', 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf')
     )
   ->addTask(
       (new Task('import/url', 'import-second-file'))
         ->set('url', 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/logo.png')
     )
   ->addTask(
       (new Task('archive', 'archive-my-files'))
         ->set('input', ["import-frist-file","import-second-file"])
         ->set('output_format', 'zip')
     )
   ->addTask(
       (new Task('export/url', 'export-my-file'))
         ->set('input', 'archive-my-files')
     ); 

$cloudconvert->jobs()->create($job);
```

Node.js:

```js
import CloudConvert from 'cloudconvert';

const cloudConvert = new CloudConvert('api_key');

let job = await cloudConvert.jobs.create({
    "tasks": {
        "import-frist-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "import-second-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/logo.png"
        },
        "archive-my-files": {
            "operation": "archive",
            "input": [
                "import-frist-file",
                "import-second-file"
            ],
            "output_format": "zip"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "archive-my-files"
        }
    }
});
```

Python:

```python
import cloudconvert

cloudconvert.configure(api_key='API_KEY')

cloudconvert.Job.create(payload={
    'tasks': {
        'import-frist-file': {
            'operation': 'import/url',
            'url': 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf'
        },
        'import-second-file': {
            'operation': 'import/url',
            'url': 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/logo.png'
        },
        'archive-my-files': {
            'operation': 'archive',
            'input': [
                'import-frist-file',
                'import-second-file'
            ],
            'output_format': 'zip'
        },
        'export-my-file': {
            'operation': 'export/url',
            'input': 'archive-my-files'
        }
    }
})
```

<tip to="https://cloudconvert.com/job-builder?operation=archive">

Use the **Job Builder** to generate and try out archive jobs.

</tip>

## Extract Archives

Extract the files of a ZIP, RAR or 7Z archive. Each file of the archive is a separate output file of the task.

#### Task Parameters

### archive/extract task parameters

- `operation` _string_ required: Value is `archive/extract`.
- `input` _string or array of task names_: The input task name(s) for this task.
- `input_format` _string_: The format of the archive, e.g. zip. If not set, the extension of the input file is used as input format.
- `engine` _string_: Use a specific engine for the extraction.
- `engine_version` _string_: Use a specific engine version for the extraction.
- `timeout` _integer_: Timeout in seconds after the task will be cancelled. By default, tasks time out after 5 hours.

Additional operation-specific parameters can be available depending on the input format and output format. Use the [operations API](https://cloudconvert.com/docs/raw/api-reference/operations.md#list-operations) to identify these dynamic parameters, for example by filtering for `archive/extract` and including `options`: `GET https://api.cloudconvert.com/v2/operations?filter[operation]=archive/extract&include=options`.

### Example job

Raw request:

```json
{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://github.com/cloudconvert/cloudconvert-php/archive/refs/heads/master.zip"
        },
        "extract-my-file": {
            "operation": "archive/extract",
            "input": "import-my-file"
        },
        "export-my-files": {
            "operation": "export/url",
            "input": "extract-my-file"
        }
    }
}
```

CLI:

```bash
# Install the CloudConvert CLI: npm install -g cloudconvert-cli
# The CloudConvert CLI does not support these task types: archive/extract.
```

cURL:

```bash
$ curl -X POST "https://api.cloudconvert.com/v2/jobs" \
    -H "Authorization: Bearer API_KEY" \
    -H "Content-type: application/json" \
    -d '{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://github.com/cloudconvert/cloudconvert-php/archive/refs/heads/master.zip"
        },
        "extract-my-file": {
            "operation": "archive/extract",
            "input": "import-my-file"
        },
        "export-my-files": {
            "operation": "export/url",
            "input": "extract-my-file"
        }
    }
}' 
```

PHP:

```php
use \CloudConvert\CloudConvert;
use \CloudConvert\Models\Job;
use \CloudConvert\Models\Task;

$cloudconvert = new CloudConvert(['api_key' => 'API_KEY']);

$job = (new Job())
   ->addTask(
       (new Task('import/url', 'import-my-file'))
         ->set('url', 'https://github.com/cloudconvert/cloudconvert-php/archive/refs/heads/master.zip')
     )
   ->addTask(
       (new Task('archive/extract', 'extract-my-file'))
         ->set('input', 'import-my-file')
     )
   ->addTask(
       (new Task('export/url', 'export-my-files'))
         ->set('input', 'extract-my-file')
     ); 

$cloudconvert->jobs()->create($job);
```

Node.js:

```js
import CloudConvert from 'cloudconvert';

const cloudConvert = new CloudConvert('api_key');

let job = await cloudConvert.jobs.create({
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://github.com/cloudconvert/cloudconvert-php/archive/refs/heads/master.zip"
        },
        "extract-my-file": {
            "operation": "archive/extract",
            "input": "import-my-file"
        },
        "export-my-files": {
            "operation": "export/url",
            "input": "extract-my-file"
        }
    }
});
```

Python:

```python
import cloudconvert

cloudconvert.configure(api_key='API_KEY')

cloudconvert.Job.create(payload={
    'tasks': {
        'import-my-file': {
            'operation': 'import/url',
            'url': 'https://github.com/cloudconvert/cloudconvert-php/archive/refs/heads/master.zip'
        },
        'extract-my-file': {
            'operation': 'archive/extract',
            'input': 'import-my-file'
        },
        'export-my-files': {
            'operation': 'export/url',
            'input': 'extract-my-file'
        }
    }
})
```

<tip to="https://cloudconvert.com/job-builder?operation=archive/extract">

Use the **Job Builder** to generate and try out archive/extract jobs.

</tip>


## Sitemap

See the full [sitemap](https://cloudconvert.com/docs/sitemap.md) for all pages.
