Skip to content

Accounts

Create email addresses and manage mailbox credentials.

Create a Mailbox

POST /api/accounts

Create a new email address on any available system domain.

Request

bash
curl -X POST https://api.mail.cx/api/accounts \
  -H "Content-Type: application/json" \
  -d '{"address":"demo@mail.cx","password":"supersecret"}'
FieldTypeRequiredDescription
addressstringYesFull email address (user@domain)
passwordstringYesMailbox password (min 6 chars)

Response 201

json
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "address": "demo@mail.cx",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

TIP

The token is returned on creation — you can start using the API immediately without a separate sign-in.

Pro users

Include a Pro API token in the Authorization header to create mailboxes on your verified custom domains. See Pro Accounts for details.

Errors

StatusError CodeDescription
400invalid_addressInvalid email format or domain
403account_limit_reachedMailbox limit reached
409address_takenAddress already in use

Sign In

POST /api/token

Get a new JWT token for an existing mailbox.

Request

bash
curl -X POST https://api.mail.cx/api/token \
  -H "Content-Type: application/json" \
  -d '{"address":"demo@mail.cx","password":"supersecret"}'

Response 200

json
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "address": "demo@mail.cx",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

Errors

StatusError CodeDescription
401invalid_credentialsWrong email or password

Get Mailbox Info

GET /api/me

Returns details about the currently authenticated mailbox.

Request

bash
curl https://api.mail.cx/api/me \
  -H "Authorization: Bearer YOUR_TOKEN"

Response 200

json
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "address": "demo@mail.cx",
  "role": "user",
  "quota": 41943040,
  "used": 12345,
  "created_at": "2025-01-15T10:00:00Z"
}
FieldTypeDescription
iduuidAccount ID
addressstringEmail address
rolestringAccount role (user or pro)
quotaintegerStorage quota in bytes
usedintegerStorage used in bytes
created_atstringAccount creation timestamp (ISO 8601)

Delete Mailbox

DELETE /api/account

Permanently delete the current mailbox and all its messages.

Request

bash
curl -X DELETE https://api.mail.cx/api/account \
  -H "Authorization: Bearer YOUR_TOKEN"

Response 204

No content. The mailbox and all associated data have been permanently deleted.

WARNING

This action is irreversible. All emails will be lost.

Mail.cx API Documentation