# usage()

Canonical URL: https://developers.iagenify.com/sdk/ref/mail/usage/
Language: en

`api.mail.usage() → Promise<Usage>`

What the plan gives in mail, readable before anything is attempted — including the zero that means the plan has no mail at all.

Status: free · read it, do not guess · quota is the account's

```javascript
const usage = await api.mail.usage();
// { pack, mailboxes, maxMailboxes, aliases, hosts, usedBytes, quotaBytes, extraMailboxCredits }

if (!usage.maxMailboxes) {
  // This plan has no mail service. Show the limit, with a link to the plans.
}
```

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `pack` | string |  | Which plan. |
| `mailboxes · maxMailboxes` | integer |  | How many exist, and how many the plan allows. |
| `aliases` | integer |  | How many alias addresses exist. |
| `hosts` | integer |  | How many hosts have mail enabled. |
| `usedBytes · quotaBytes` | integer |  | What mail holds, against **the account's object storage**. |
| `extraMailboxCredits` | integer |  | What an additional mailbox is priced at. |

## Read the zero {#zero}

> **Never test the plan's name**
>
> maxMailboxes: 0 is the signal that this plan has no mail — the same shape as maxHosts: 0 for hosting. A page that reads the number keeps working when the plans change; a page that matches on a plan's name lies that day.

## The quota is not per mailbox {#quota}

`quotaBytes` is the account's object storage, shared with files and with whatever hosts keep online. It is re-read each time — so a mailbox can become full because something else filled up.

## What happens when it is full {#full}

Delivery is refused with a retry-later answer, so the sender's server tries again rather than giving up. The copy of a send is the exception: refusing it would lose the trace of a message already gone without freeing anything.

## Showing it {#ui}

```javascript
const u = await api.mail.usage();

if (!u.maxMailboxes) return showPlanLimit();
if (u.mailboxes >= u.maxMailboxes) return showAtLimit(u.extraMailboxCredits);
return showCreateButton();
```

- [cloud.usage()](/sdk/ref/cloud/usage): The storage this counts against.
- [create()](/sdk/ref/mail/create): After checking.

```python
usage = api.mail.usage()
# {"pack", "mailboxes", "maxMailboxes", "aliases", "hosts", "usedBytes", "quotaBytes", "extraMailboxCredits"}

if not usage["maxMailboxes"]:
    pass  # This plan has no mail service. Show the limit, with a link to the plans.
```

```python
def mail_screen():
    u = api.mail.usage()
    if not u["maxMailboxes"]:
        return show_plan_limit()
    if u["mailboxes"] >= u["maxMailboxes"]:
        return show_at_limit(u["extraMailboxCredits"])
    return show_create_button()
```
