# Cancel a big upload

`DELETE https://api.mailmasker.org/api/v1/drive/uploads/:id`

Give up on an unfinished upload and throw away what was sent.

- Who can use it: Any signed-in account
- Area: Drive
- Answers 200 OK when it works
- Page: https://developer.mailmasker.org/drive-upload-cancel

Drops the bytes sent so far and closes the session. An upload you just abandon is cleared away after 24 hours anyway; this does it now.

## Parameters

| Name | In | Required | What it is | Example |
|---|---|---|---|---|
| `id` | path | yes | The upload_id from Start a big upload. | `0b6f3c1e-8d2a-4f7b-9e5c-3a1d2b4c6e8f` |

## Good to know

- A finished upload can't be cancelled (409), because it is a file now; delete the file instead.
- An upload that isn't yours, or no longer exists, answers 404.

## Examples

cURL:

```bash
curl -s -X DELETE 'https://api.mailmasker.org/api/v1/drive/uploads/0b6f3c1e-8d2a-4f7b-9e5c-3a1d2b4c6e8f' \
  -H "Authorization: Bearer $TOKEN"
```

Perl:

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

my $ua  = Mojo::UserAgent->new;
my $res = $ua->delete('https://api.mailmasker.org/api/v1/drive/uploads/0b6f3c1e-8d2a-4f7b-9e5c-3a1d2b4c6e8f',
    { Authorization => "Bearer $ENV{TOKEN}" })->result;
die $res->code, ' ', ($res->json('/error') // $res->message), "\n" unless $res->is_success;
print $res->body, "\n";
```

homelab-cli:

There is no homelab-cli command for this yet.

## Response

200 OK:

```json
{ "ok": true }
```
