LOCALHOST
All pages
API reference

Mail

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 revoked
  • 403 the key lacks the permission
Example request
curl -X GET "$API/mail/" \
  -H "Authorization: Bearer $LH_API_KEY"
#

Enable Mail

mail:write

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

NameTypeNotes
name * string

Responses

  • 201 object
  • 401 no key, or a key that was revoked
  • 403 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 revoked
  • 403 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

NameTypeNotes
name * in path string

Responses

  • 200 object
  • 401 no key, or a key that was revoked
  • 403 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

NameTypeNotes
name * in path string

Responses

  • 200 list[object]
  • 401 no key, or a key that was revoked
  • 403 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

NameTypeNotes
name * in path string

Request body MailboxIn

NameTypeNotes
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 revoked
  • 403 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 Mailbox

mail:read

GET /mail/{name}/mailboxes/{local_part}

Parameters

NameTypeNotes
name * in path string
local_part * in path string

Responses

  • 200 object
  • 401 no key, or a key that was revoked
  • 403 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

NameTypeNotes
name * in path string
local_part * in path string

Request body MailboxPatch

NameTypeNotes
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 revoked
  • 403 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

NameTypeNotes
name * in path string
local_part * in path string

Responses

  • 204 No Content
  • 401 no key, or a key that was revoked
  • 403 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

NameTypeNotes
name * in path string
local_part * in path string

Request body PasswordIn

NameTypeNotes
send_to string default ""

Responses

  • 200 object
  • 401 no key, or a key that was revoked
  • 403 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

NameTypeNotes
name * string

MailboxIn

NameTypeNotes
local_part * string
display_name string default ""
quota_mb integer | null
password_to string default ""

MailboxPatch

NameTypeNotes
display_name string | null
quota_mb integer | null
aliases list[string] | null
suspended boolean | null

PasswordIn

NameTypeNotes
send_to string default ""