---
title: "Capture Website"
description: "Convert a website to PDF or capture a screenshot of a website (PNG, JPG)."
canonical_url: "https://cloudconvert.com/docs/operations/capture-website"
---
# Capture Website

> Convert a website to PDF or capture a screenshot of a website (PNG, JPG).

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

The available parameters differ based on `output_format`. Select a value below to show all available conversion options.

## Task Parameters

### capture-website task parameters

- `operation` _string_ required: Value is `capture-website`.
- `url` _string_ required: URL of the website
- `output_format` _string_ required: The target format to convert to.
- `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 `capture-website` and including `options`: `GET https://api.cloudconvert.com/v2/operations?filter[operation]=capture-website&include=options`.

### Example job

Raw request:

```json
{
    "tasks": {
        "capture-my-website": {
            "operation": "capture-website",
            "url": "https://cloudconvert.com",
            "output_format": "pdf"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "capture-my-website"
        }
    }
}
```

CLI:

```bash
# Install the CloudConvert CLI: npm install -g cloudconvert-cli
$ cloudconvert capture-website \
    -f pdf \
    https://cloudconvert.com
```

cURL:

```bash
$ curl -X POST "https://api.cloudconvert.com/v2/jobs" \
    -H "Authorization: Bearer API_KEY" \
    -H "Content-type: application/json" \
    -d '{
    "tasks": {
        "capture-my-website": {
            "operation": "capture-website",
            "url": "https://cloudconvert.com",
            "output_format": "pdf"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "capture-my-website"
        }
    }
}' 
```

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('capture-website', 'capture-my-website'))
         ->set('url', 'https://cloudconvert.com')
         ->set('output_format', 'pdf')
     )
   ->addTask(
       (new Task('export/url', 'export-my-file'))
         ->set('input', 'capture-my-website')
     ); 

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

Node.js:

```js
import CloudConvert from 'cloudconvert';

const cloudConvert = new CloudConvert('api_key');

let job = await cloudConvert.jobs.create({
    "tasks": {
        "capture-my-website": {
            "operation": "capture-website",
            "url": "https://cloudconvert.com",
            "output_format": "pdf"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "capture-my-website"
        }
    }
});
```

Python:

```python
import cloudconvert

cloudconvert.configure(api_key='API_KEY')

cloudconvert.Job.create(payload={
    'tasks': {
        'capture-my-website': {
            'operation': 'capture-website',
            'url': 'https://cloudconvert.com',
            'output_format': 'pdf'
        },
        'export-my-file': {
            'operation': 'export/url',
            'input': 'capture-my-website'
        }
    }
})
```

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

Use the **Job Builder** to generate and try out capture-website jobs.

</tip>

## Header and Footer

To add a custom header and/or footer, use `header_template` and `footer_template`. These parameters need to be set to the name of another import task, containing the templates. For example, you can use `import/raw` to provide these templates. As shown in the example below, you can use the magic CSS classes `date`, `title`, `url`, `pageNumber`, `totalPages`.

Alongside `header_template` / `footer_template` you need to set `display_header_footer` to `true` and and some spacing with `margin_top`and `margin_bottom` to show the header / footer.

<code-collapse name="Example Job Payload">

```json
{
  "tasks": {
    "import-my-footer": {
      "operation": "import/raw",
      "filename": "footer.html",
      "file": "<span style='font-size: 10px'> Page <span class='pageNumber'></span> / <span class='totalPages'></span> </span>"
    },
    "import-my-header": {
      "operation": "import/raw",
      "filename": "header.html",
      "file": "<span style='font-size: 10px'> This is a header. Date: <span class='date'></span> </span>"
    },
    "capture-my-website": {
      "operation": "capture-website",
      "url": "https://cloudconvert.com",
      "output_format": "pdf",
      "margin_top": 20,
      "margin_bottom": 20,
      "display_header_footer": true,
      "footer_template": "import-my-footer",
      "header_template": "import-my-header",
    },
    "export-my-file": {
      "operation": "export/url",
      "input": "capture-my-website"
    }
  }
}
```

</code-collapse>


## Sitemap

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