# usage()

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

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

What the plan allows in hosting, and how much space what is online takes — against the account's object storage.

Status: free · read the zero · quota is the object storage

```javascript
const usage = await api.hosts.usage();

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

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `pack` | string |  | Which plan. |
| `hosts · maxHosts` | integer |  | How many exist, and how many the plan allows. |
| `usedBytes` | integer |  | What the hosts keep online. |
| `quotaBytes` | integer |  | **The account's object storage quota.** |

## Read the zero {#zero}

> **maxHosts: 0 means the plan has no hosting**
>
> The same shape as maxMailboxes: 0 for mail. Read the number rather than matching on a plan's name — the day the plans change, the page that matches is the one that lies.

## quotaBytes is not a hosting allowance {#quota}

It is the account's object storage — shared with files, mailboxes and everything else kept for the account. [cloud.usage()](/sdk/ref/cloud/usage) shows the same number from the other side, with `object.hostingBytes` saying how much of it is hosting.

## Showing it {#ui}

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

if (!u.maxHosts)             return showPlanLimit();
if (u.hosts >= u.maxHosts)   return showAtLimit();
return showCreateButton();
```

- [cloud.usage()](/sdk/ref/cloud/usage): The storage behind it.
- [host.usage()](/sdk/ref/host/usage): One host in detail.

```python
usage = api.hosts.usage()

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

```python
def hosting_screen():
    u = api.hosts.usage()
    if not u["maxHosts"]:
        return show_plan_limit()
    if u["hosts"] >= u["maxHosts"]:
        return show_at_limit()
    return show_create_button()
```
