# Download a job's file

`GET https://api.mailmasker.org/api/v1/jobs/:id/download`

The file a finished job made, such as its zip.

- Who can use it: Any signed-in account
- Area: Background jobs
- Answers 200 OK when it works
- Page: https://developer.mailmasker.org/job-download

Sends the file itself, named as the job's `output_name`. It is there once the job is completed, until the job is cleared away. A site admin can download anyone's.

## Parameters

| Name | In | Required | What it is | Example |
|---|---|---|---|---|
| `id` | path | yes | The job's `id`. | `42` |

## Good to know

- A job that hasn't finished yet answers 409.
- A job that isn't yours, or has been cleared away, answers 404.

## Examples

cURL:

```bash
curl -s 'https://api.mailmasker.org/api/v1/jobs/42/download' \
  -H "Authorization: Bearer $TOKEN"
```

Perl:

```perl
use Mojo::Base -strict;
use Mojo::UserAgent;

my $ua  = Mojo::UserAgent->new;
my $res = $ua->get('https://api.mailmasker.org/api/v1/jobs/42/download',
    { Authorization => "Bearer $ENV{TOKEN}" })->result;
die $res->code, ' ', ($res->json('/error') // $res->message), "\n" unless $res->is_success;
print $res->body, "\n";
```

homelab-cli:

```bash
homelab-cli jobs download 42
```

## Response

200 OK:

```text
(the job's output file)
```
