# Set an account's drive quota

`PUT https://api.mailmasker.org/api/v1/drive/admin/quota`

Change how much one account may keep in drive, or put it back to the default.

- Who can use it: Site admins
- Area: Users and roles
- Answers 200 OK when it works
- Page: https://developer.mailmasker.org/admin-set-drive-quota

Sets the account's own limit, in bytes. An upload, or joining files together, that would take the account over it is refused; files in the trash don't count. Leave out `limit_bytes` (or send null) to remove the account's own limit, so the 1 TB default applies again.

## Parameters

| Name | In | Required | What it is | Example |
|---|---|---|---|---|
| `user_email` | body | yes | The account's address, exactly as the account has it. | `alice@example.com` |
| `limit_bytes` | body | no | The new limit in bytes, as a whole number. Leave it out, or send null, for the default. | `53687091200` |

## Good to know

- Putting it back to the default answers a null `limit_bytes` and a `note` saying "reset to default".
- A limit lower than what the account already keeps deletes nothing; it only stops further uploads.
- It doesn't check that the address has an account.
- A limit that isn't a whole number answers 400.

## Examples

cURL:

```bash
curl -s -X PUT 'https://api.mailmasker.org/api/v1/drive/admin/quota' \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"user_email":"alice@example.com","limit_bytes":53687091200}'
```

Perl:

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

my $ua  = Mojo::UserAgent->new;
my $res = $ua->put('https://api.mailmasker.org/api/v1/drive/admin/quota',
    { Authorization => "Bearer $ENV{TOKEN}" },
    json => { user_email => 'alice@example.com', limit_bytes => 53687091200 })->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, "user_email": "alice@example.com", "limit_bytes": 53687091200 }
```
