Create a mailbox

POST/api/v1/email-accounts
Requires anorganization API keywith the scopemailboxes:write

Creates a real mailbox — IMAP, SMTP and webmail — on one of your domains.

The domain must exist, but it does not need to be verified: you will usually want mailboxes in place before you cut MX over, not after. Provisioning happens on the mail server and is asynchronous; a mailbox appears with a provisioning status and becomes usable when that completes.

Passwords must be at least 12 characters. If you set a forced password change, note it governs webmail and the mobile apps only — IMAP and SMTP clients cannot present a change-password prompt, so they keep working with the old password until it is changed elsewhere.

Request body

  • domain_idstringrequired

    The ID of one of your domains. Copy it from the domain's page in the dashboard, or read it from GET /domains.

  • namestringrequired

    The mailbox owner's name. Recipients see it as Name <address>.

  • usernamestringrequired

    The part of the address before the @. On yourdomain.com, ada makes ada@yourdomain.com. Letters, numbers, dots, dashes and underscores.

  • account_typestringrequiredmail | smtp | both

    Required, but kept for your records only: every mailbox gets full IMAP and SMTP access whatever you send. Send both.

  • passwordstring

    Optional. At least 12 characters, with letters and numbers. Leave it out and we create a strong one.

  • must_change_passwordboolean

    Make the person choose their own password the first time they sign in to webmail or the app. Mail apps (IMAP and SMTP) are not affected.

  • send_setup_tostring

    Optional. An address to email the new mailbox's sign-in details to. It cannot be the new mailbox itself: nobody can open that yet.

  • storage_quota_mbinteger

    Optional. This mailbox's storage, in megabytes.

  • smtp_settingsobject

    Optional. Connection settings to print in the setup email sent to send_setup_to. They do not change how the mailbox works.

    • portinteger

      The port number, like 587 for SMTP or 993 for IMAP.

    • encryptionstringssl | tls | none

      ssl, tls or none.

    • auth_methodstringplain | login | cram_md5

      How mail apps sign in: plain, login or cram_md5.

  • imap_settingsobject

    Optional. Connection settings to print in the setup email sent to send_setup_to. They do not change how the mailbox works.

    • portinteger

      The port number, like 587 for SMTP or 993 for IMAP.

    • encryptionstringssl | tls | none

      ssl, tls or none.

Request

POST/api/v1/email-accounts
curl -X POST 'https://app.mailyte.com/api/v1/email-accounts' \
  -H 'Authorization: Bearer mk_live_YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "domain_id": "01JBT8XQ2M9WYC3K4F6R7S8T9V",
    "name": "Ada Obi",
    "username": "ada",
    "account_type": "both"
  }'
The key names its own organization, so no X-Organization-ID header is needed.

Response

Success.

  • dataobject
    • objectstringmailbox
    • idstring

      Unique identifier for the mailbox.

    • addressstring

      The full email address. This *is* the mailbox publicly: there is no separate username, because the local part is already in here.

    • namestring

      Display name, as it appears to a recipient. null when none was set.

    • domain_idstring

      The domain this mailbox belongs to. Retrieve it with GET /api/v1/domains/{domain}.

    • typestringmail | smtp | both

      What the mailbox was created as, and what you can filter the list by. Recorded rather than enforced: nothing in the product currently branches on it, so it does not by itself restrict what the mailbox can do.

    • statestringactive | provisioning | failed | suspended | deleting

      Where the mailbox stands: deleting first, then suspended, then its setup state. Only an active mailbox sends and receives.

    • provisioningobject

      What the mail server has done with this mailbox. Creation is asynchronous, so a mailbox exists here before it exists there.

      • statestringpending | provisioning | active | failed | suspended | deleting | deleted

        The mailbox's setup state on the mail server. Use the top-level state to decide what the mailbox can do.

      • errorstring

        Why provisioning failed, in the mail server's words. null unless state is failed.

      • retryableboolean

        True only while state is failed, which is the only state POST /retry-provisioning accepts.

    • storageobject

      Bytes, both of them. Never a pre-formatted "3 GB", which cannot be computed with.

      • quota_bytesinteger

        The mailbox's storage limit, in bytes. Always set; the default is 1 GB.

      • used_bytesinteger

        Bytes used. Null means we could not read it yet (for example, the mailbox is not set up on the mail server yet), not that it is empty; show it as unknown.

    • send_limitsobject

      Per-mailbox sending overrides.

      • dailyinteger

        Messages per day for this mailbox. Null means no override, so your plan's limit applies. 0 means it may not send.

      • hourlyinteger

        Messages per hour for this mailbox. Null means no override, as with daily.

    • created_atstring
    • updated_atstring

Returned inside the standard envelope.

Errors

StatusWhen
401The API key is missing, unknown, revoked or expired. All four answer identically, on purpose: distinguishing them would confirm which keys exist.
403The key is valid but may not do this: it lacks the required scope, its IP allowlist does not include you, or this endpoint does not accept API keys.
404No such resource in this organization.
422The request was understood but the values were not acceptable.
429Too many requests, or the organization has spent its sending allowance. `Retry-After` says how long to wait.

Every status, with what causes it and what to do, is on the error reference.