api.mail

create()

api.mail.create({ address, name }) → Promise<Mailbox>

Creates a mailbox on an enabled host. The quota comes from the plan, never from the caller.

POST /api/mailhost must be enabledquota from the plan
Using Python?

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

const box = await api.mail.create({ address: "hello@example.com", name: "Hello" });

box.address;   // "hello@example.com"
box.host;      // "example.com"
box.local;     // "hello"
box = api.mail.create(address="hello@example.com", name="Hello")

box.address   # "hello@example.com"
box.host      # "example.com"
box.local     # "hello"
addressstringrequired

The full address. Its host must be one where mail is enabled.

namestring

The display name.

The host must be enabled first

import { IaGenifyError } from "iagenify";

try {
  await api.mail.create({ address: "hello@team.example.com" });
} catch (err) {
  if (err instanceof IaGenifyError && err.code === "mail_not_enabled") {
    await domain.mail.enable({ subdomain: "team" });
  }
}
from iagenify import IaGenifyError

try:
    api.mail.create(address="hello@team.example.com")
except IaGenifyError as error:
    if error.code != "mail_not_enabled":
        raise
    domain.mail.enable(subdomain="team")

The refusal names the host that is missing, so the fix is one call away.

The caller does not choose the quota

It comes from the plan, and it is the account's object storage

A mailbox has no space of its own. quotaBytes is the account's, read fresh each time — which is why a mailbox gets fuller when a host deploys something or a storage fills up.

Errors

CodeStatusWhen
mail_not_enabled403The host has no mail records yet.
mail_not_in_plan403The plan has no mail service.
address_taken409The address, or an alias of it, exists.
address_reserved400A name the domain is expected to answer for.

What follows

update() for a picture and a signature, aliases.add() for other addresses that land here, forward() for copies elsewhere.