Create a mailbox
/api/v1/email-accountsCreates 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_idstringrequiredThe ID of one of your domains. Copy it from the domain's page in the dashboard, or read it from
GET /domains.namestringrequiredThe mailbox owner's name. Recipients see it as
Name <address>.usernamestringrequiredThe part of the address before the @. On
yourdomain.com,adamakesada@yourdomain.com. Letters, numbers, dots, dashes and underscores.account_typestringrequiredmail | smtp | bothRequired, but kept for your records only: every mailbox gets full IMAP and SMTP access whatever you send. Send
both.passwordstringOptional. At least 12 characters, with letters and numbers. Leave it out and we create a strong one.
must_change_passwordbooleanMake 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_tostringOptional. 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_mbintegerOptional. This mailbox's storage, in megabytes.
smtp_settingsobjectOptional. Connection settings to print in the setup email sent to
send_setup_to. They do not change how the mailbox works.portintegerThe port number, like 587 for SMTP or 993 for IMAP.
encryptionstringssl | tls | nonessl,tlsornone.auth_methodstringplain | login | cram_md5How mail apps sign in:
plain,loginorcram_md5.
imap_settingsobjectOptional. Connection settings to print in the setup email sent to
send_setup_to. They do not change how the mailbox works.portintegerThe port number, like 587 for SMTP or 993 for IMAP.
encryptionstringssl | tls | nonessl,tlsornone.
Request
/api/v1/email-accountscurl -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"
}'const response = await fetch('https://app.mailyte.com/api/v1/email-accounts', {
method: 'POST',
headers: {
Authorization: 'Bearer mk_live_YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"domain_id": "01JBT8XQ2M9WYC3K4F6R7S8T9V",
"name": "Ada Obi",
"username": "ada",
"account_type": "both"
}),
});
const { data } = await response.json();import requests
response = requests.post(
"https://app.mailyte.com/api/v1/email-accounts",
headers={"Authorization": "Bearer mk_live_YOUR_API_KEY"},
json={
"domain_id": "01JBT8XQ2M9WYC3K4F6R7S8T9V",
"name": "Ada Obi",
"username": "ada",
"account_type": "both"
},
)
data = response.json()["data"]<?php
$response = Http::withToken('mk_live_YOUR_API_KEY')
->post('https://app.mailyte.com/api/v1/email-accounts', [
'domain_id' => '01JBT8XQ2M9WYC3K4F6R7S8T9V',
'name' => 'Ada Obi',
'username' => 'ada',
'account_type' => 'both',
]);
$data = $response->json('data');require "net/http"
require "json"
uri = URI("https://app.mailyte.com/api/v1/email-accounts")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer mk_live_YOUR_API_KEY"
request["Content-Type"] = "application/json"
request.body = {
"domain_id": "01JBT8XQ2M9WYC3K4F6R7S8T9V",
"name": "Ada Obi",
"username": "ada",
"account_type": "both"
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request) }Response
Success.
dataobjectobjectstringmailboxidstringUnique identifier for the mailbox.
addressstringThe full email address. This *is* the mailbox publicly: there is no separate
username, because the local part is already in here.namestringDisplay name, as it appears to a recipient. null when none was set.
domain_idstringThe domain this mailbox belongs to. Retrieve it with
GET /api/v1/domains/{domain}.typestringmail | smtp | bothWhat 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 | deletingWhere the mailbox stands:
deletingfirst, thensuspended, then its setup state. Only anactivemailbox sends and receives.provisioningobjectWhat 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 | deletedThe mailbox's setup state on the mail server. Use the top-level
stateto decide what the mailbox can do.errorstringWhy provisioning failed, in the mail server's words. null unless
stateisfailed.retryablebooleanTrue only while
stateisfailed, which is the only statePOST /retry-provisioningaccepts.
storageobjectBytes, both of them. Never a pre-formatted "3 GB", which cannot be computed with.
quota_bytesintegerThe mailbox's storage limit, in bytes. Always set; the default is 1 GB.
used_bytesintegerBytes 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_limitsobjectPer-mailbox sending overrides.
dailyintegerMessages per day for this mailbox. Null means no override, so your plan's limit applies. 0 means it may not send.
hourlyintegerMessages per hour for this mailbox. Null means no override, as with
daily.
created_atstringupdated_atstring
Returned inside the standard envelope.
Errors
| Status | When |
|---|---|
401 | The API key is missing, unknown, revoked or expired. All four answer identically, on purpose: distinguishing them would confirm which keys exist. |
403 | The 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. |
404 | No such resource in this organization. |
422 | The request was understood but the values were not acceptable. |
429 | Too 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.