api.hosts

usage()

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.

freeread the zeroquota is the object storage
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

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

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

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

Which plan.

hosts · maxHostsinteger

How many exist, and how many the plan allows.

usedBytesinteger

What the hosts keep online.

quotaBytesinteger

The account's object storage quota.

Read the 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

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

Showing it

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

if (!u.maxHosts)             return showPlanLimit();
if (u.hosts >= u.maxHosts)   return showAtLimit();
return showCreateButton();
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()