Every call needs Authorization: Bearer lh_… unless marked No key needed ; the example uses $API for https://api.localhost.co.zw and $LH_API_KEY for your key. A * marks a required field.
#
List Mail Names
mail:read
GET /mail/
The account's names with email on, and the names email could be turned on for.
Responses
200 list[object]
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X GET "$API/mail/" \
-H "Authorization: Bearer $LH_API_KEY"
POST /mail/
Turn email on for one of the account's names: its keys, its DNS records (when we hold its DNS) and the mail server. Needs Hosting or a package.
Request body EnableIn
Name Type Notes
name *
string
Responses
201 object
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X POST "$API/mail/" \
-H "Authorization: Bearer $LH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "<name>"
}'
#
Eligible Names
mail:read
GET /mail/eligible
The account's own names that could have email turned on.
Responses
200 list[string]
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X GET "$API/mail/eligible" \
-H "Authorization: Bearer $LH_API_KEY"
#
Get Mail Name
mail:read
GET /mail/{name}
One name's email: state, the DNS records it needs and whether each is there, warnings, mailboxes, settings.
Parameters
Name Type Notes
name * in path
string
Responses
200 object
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X GET "$API/mail/<name>" \
-H "Authorization: Bearer $LH_API_KEY"
#
List Mailboxes
mail:read
GET /mail/{name}/mailboxes
Parameters
Name Type Notes
name * in path
string
Responses
200 list[object]
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X GET "$API/mail/<name>/mailboxes" \
-H "Authorization: Bearer $LH_API_KEY"
#
Create Mailbox
mail:write
POST /mail/{name}/mailboxes
A new mailbox. With `password_to`, the person who'll use it gets a one-time link (48 hours) to choose its password and nothing secret comes back; without it, the answer carries a password, once.
Parameters
Name Type Notes
name * in path
string
Request body MailboxIn
Name Type Notes
local_part *
string
display_name
string
default ""
quota_mb
integer | null
password_to
string
default ""
Responses
201 object
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X POST "$API/mail/<name>/mailboxes" \
-H "Authorization: Bearer $LH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"local_part": "<local_part>"
}'
GET /mail/{name}/mailboxes/{local_part}
Parameters
Name Type Notes
name * in path
string
local_part * in path
string
Responses
200 object
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X GET "$API/mail/<name>/mailboxes/<local_part>" \
-H "Authorization: Bearer $LH_API_KEY"
#
Update Mailbox
mail:write
PATCH /mail/{name}/mailboxes/{local_part}
Change a mailbox's name shown to people, its size, its aliases (other addresses that arrive in it), or suspend it (nobody can sign in or send; mail still arrives) and bring it back.
Parameters
Name Type Notes
name * in path
string
local_part * in path
string
Request body MailboxPatch
Name Type Notes
display_name
string | null
quota_mb
integer | null
aliases
list[string] | null
suspended
boolean | null
Responses
200 object
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X PATCH "$API/mail/<name>/mailboxes/<local_part>" \
-H "Authorization: Bearer $LH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"display_name": "<display_name>",
"quota_mb": 1,
"aliases": [
"<aliases>"
],
"suspended": true
}'
#
Delete Mailbox
mail:write
DELETE /mail/{name}/mailboxes/{local_part}
Delete a mailbox and every message in it. This can't be undone.
Parameters
Name Type Notes
name * in path
string
local_part * in path
string
Responses
204 No Content
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X DELETE "$API/mail/<name>/mailboxes/<local_part>" \
-H "Authorization: Bearer $LH_API_KEY"
#
Mailbox Password
mail:write
POST /mail/{name}/mailboxes/{local_part}/password
A new password: with `send_to`, a one-time link where the person chooses it (the old one keeps working until then); without, a new one made now and returned once (the old one stops working).
Parameters
Name Type Notes
name * in path
string
local_part * in path
string
Request body PasswordIn
Name Type Notes
send_to
string
default ""
Responses
200 object
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X POST "$API/mail/<name>/mailboxes/<local_part>/password" \
-H "Authorization: Bearer $LH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"send_to": "<send_to>"
}'
Shapes
The objects these endpoints send and receive.
EnableIn
Name Type Notes
name *
string
MailboxIn
Name Type Notes
local_part *
string
display_name
string
default ""
quota_mb
integer | null
password_to
string
default ""
MailboxPatch
Name Type Notes
display_name
string | null
quota_mb
integer | null
aliases
list[string] | null
suspended
boolean | null
PasswordIn
Name Type Notes
send_to
string
default ""