Developer platform

NexMask OpenAPI

Manage mailboxes, read mail, and query account information through a stable API.

Download OpenAPI JSON
Credentials

API Key

Send your complete API Key in the apiKey HTTP header on every OpenAPI request. Start with the read-only request below before integrating mailbox creation. OpenAPI access requires an active membership.

API Key authentication ↓
YOUR_API_KEY
AUTHENTICATION

API Key authentication

Send your complete API Key in the apiKey HTTP header on every OpenAPI request. Start with the read-only request below before integrating mailbox creation.

1. Get your API Key

  1. Sign in and copy the key from the API Key area at the top of Personal space. This page also displays your own key while signed in. When signed out, YOUR_API_KEY is only a placeholder, not a working key. Personal space ↗
  2. OpenAPI access requires an active membership.
  3. Replace YOUR_API_KEY in every example with the complete key, without a Bearer prefix, extra quotes or whitespace. Resetting your API Key invalidates the old key; update every integration.

2. Send the request header

Use apiKey as the header name and the raw key as its value. OpenAPI does not read API Keys from Authorization: Bearer, JSON bodies, URL parameters or website login cookies. Signing in on the website does not replace this header. MCP Bearer authentication does not apply here.

apiKey: YOUR_API_KEY
Accept-Language: en-US

For POST endpoints, also set Content-Type: application/json and put business parameters in the JSON body. Keep apiKey in the header. GET queries normally do not need Content-Type.

Pass the API Key in the request header and keep it secure. Accept-Language takes priority for both success and error responses. If omitted or blank, the API Key owner language is used; unidentified accounts default to en-US. Supports zh-CN, zh-TW, en-US and language weights. Invalid or unsupported headers default to en-US. X-Language and website login preferences do not affect OpenAPI.

3. Make a read-only test request

This GET request only reads the account associated with the key. It creates no mailbox and deducts no credits. Active membership is required. HTTP 200 with code=0 indicates success; opening the public documentation is not API authentication. Examples keep placeholders and never insert your actual key.

curl --request GET 'https://app.nexmask.net/openapi/v1/user/info.cgi' \
  --header 'apiKey: YOUR_API_KEY' \
  --header 'Accept-Language: en-US'

Configure Postman

In Headers, add apiKey with your full key as Value; optionally add Accept-Language. Alternatively, select API Key in Authorization, set Key to apiKey, enter the key as Value and choose Header for Add to. Do not select Bearer Token. For POST, select raw / JSON under Body.

Common authentication errors

  • HTTP 401 / code=-1210 — The API Key is missing or invalid, or the account is frozen. Check the placeholder, the apiKey header, any accidental Bearer prefix and whether the key was reset.
  • HTTP 403 / code=-1300 — The key was recognized, but membership is missing or expired. Check membership status in Personal space.
  • HTTP 415 — The POST content type is incorrect. Set Content-Type: application/json and send valid JSON. The JSON example contains business parameters only, not a complete HTTP request.

Keep and use the key on a trusted backend. Do not expose it in public pages, repositories, screenshots, shared logs or URLs. Reset it in Personal space if leaked, and never publicly share requests containing a real key.

POST/openapi/v1/mailbox/create.cgi

Create mailbox

Create a new incoming mailbox. If domainId is omitted, a public or login domain is selected at random.

Request fields

FieldTypeRequiredDescription
prefixstringNoMailbox prefix, 5–64 characters; omit to generate randomly
domainIdlongNoOptional incoming domain ID; omit it to randomly select a public or login domain
durationHoursintegerNoValidity period in hours; defaults to 1. 0 is also treated as 1 hour. An unconfigured one-hour duration remains free; every other duration must match an available plan. Negative or unconfigured duration: -1100 (invalid parameter).

Successful response data

FieldTypeRequiredDescription
idlongYesMailbox ID
emailstringYesFull email address
receivedCountlongYesTotal number of received emails
expiresAtdatetimeYesExpiration time
guestbooleanYesWhether this is a guest mailbox; always false when created through OpenAPI

Response example

{"code":0,"msg":"Success","data":{"id":128,"email":"[email protected]","receivedCount":0,"expiresAt":"2026-09-03T12:00:00.000+00:00","guest":false}}
POST/openapi/v1/relay/mailbox/create.cgi

Create a mainstream mailbox

Allocate a new mainstream mailbox with the selected suffix. No prefix or domain ID is needed. Requires a valid API Key and active VIP membership. Uses the same plans and credit pricing as temporary mailboxes. Does not renew, reclaim, or switch the active mailbox on the website.

Request fields

FieldTypeRequiredDescription
suffixstring (enum)YesRequired enum: gmail.com, outlook.com, googlemail.com, hotmail.com. The suffix is selected exactly. Returns -1407 when unavailable; never substitutes another suffix.
durationHoursintegerYesRequired non-negative integer, not null. 0 is treated as 1 hour. VIP pricing applies. An unconfigured one-hour duration remains free; every other duration must match a configured mailbox plan. Insufficient credits: -1208; negative or unconfigured duration: -1100 (invalid parameter).

Successful response data

FieldTypeRequiredDescription
idlongYesMailbox ID
emailstringYesFull email address
receivedCountlongYesTotal number of received emails
expiresAtdatetimeYesExpiration time
guestbooleanYesWhether this is a guest mailbox; always false when created through OpenAPI

Returns exactly the same structure as temporary mailbox creation. Use id as mailboxId to query messages, or use the mailbox list and mail detail endpoints. Only the owning API user has access. Each repeated call creates another mailbox and charges the selected plan.

Response example

{"code":0,"msg":"Success","data":{"id":1024,"email":"[email protected]","receivedCount":0,"expiresAt":"2026-10-06T10:00:00.000+00:00","state":0,"uuid":null,"guest":false}}
GET/openapi/v1/domain/list.cgi

Available domains

List every domain available to the current API user: public, login, the user's private domains, and member domains while membership is active. All domains are loaded first and filtered in application code.

Successful response data

FieldTypeRequiredDescription
idlongYesDomain ID accepted as domainId by mailbox creation
domainstringYesIncoming domain name
typeintegerYesDomain type: 0 public, 1 login, 2 member, 3 private
ownerIdlongYesOwning user ID; 0 for system domains
mailboxCountlongYesTotal mailbox pool size for the domain
mailboxOccupylongYesNumber of occupied mailbox pool entries
stateintegerYesDomain state; this list only returns available domains with state 0

Response example

{"code":0,"msg":"Success","data":[{"id":1,"domain":"nexmask.com","type":0,"ownerId":0,"mailboxOccupy":320,"seq":1000,"mailboxCount":10000,"mailCount":860,"state":0,"createdAt":"2026-09-01T10:00:00.000+00:00","updatedAt":"2026-09-04T10:00:00.000+00:00"}]}
POST/openapi/v1/tools/us_address/generate.cgi

Random US address

Create a temporary mailbox using the existing OpenAPI mailbox rules, then return public address data and randomly generated identity details for a selected or random state.

Request fields

FieldTypeRequiredDescription
prefixstringNoMailbox prefix, 5–64 characters; omit to generate randomly
domainIdlongNoOptional incoming domain ID; omit it to randomly select a public or login domain
durationHoursintegerNoValidity period in hours; defaults to 1. 0 is also treated as 1 hour. An unconfigured one-hour duration remains free; every other duration must match an available plan. Negative or unconfigured duration: -1100 (invalid parameter).
stateCodestringNoTwo-letter USPS state code, such as CA; omit it to choose randomly from the 50 states and Washington, DC.

Successful response data

FieldTypeRequiredDescription
mailboxIdlongYesRecord ID of the mailbox created by this request
emailstringYesTemporary email address created by this request
mailboxDomainIdlongYesIncoming domain ID of the created mailbox
firstNamestringYesRandomly generated first name
lastNamestringYesRandomly generated last name
genderstringYesRandom gender localized to the current API language
phonestringYesPhone number with a state-matched area code and randomly generated exchange and subscriber numbers
streetAddressstringYesComplete street address from the public data sample
citystringYesCity
stateNamestringYesFull state name
stateCodestringYesTwo-letter USPS state code
zipCodestringYesZIP Code
latitudedecimalYesAddress latitude
longitudedecimalYesAddress longitude
fullAddressstringYesComplete address composed of street, city, state, and ZIP Code

Response example

{"code":0,"msg":"Success","data":{"mailboxId":128,"email":"[email protected]","mailboxDomainId":1,"firstName":"Emily","lastName":"Carter","gender":"Female","phone":"+1 (202) 483-7612","streetAddress":"4600 Silver Hill Rd","city":"Washington","stateName":"District of Columbia","stateCode":"DC","zipCode":"20233","latitude":38.8459,"longitude":-76.9274,"fullAddress":"4600 Silver Hill Rd, Washington, DC 20233, United States"}}
POST/openapi/v1/mail/list.cgi

Mail list

List mail for the current API user, optionally filtered by mailboxId, newest first, with 10 items per page.

Request fields

FieldTypeRequiredDescription
mailboxIdlongNoMailbox ID owned by the current user; omit it to query all account mail
pageintegerNoPage number starting at 1; defaults to 1
keywordstringNoSender or subject keyword, up to 100 characters

Successful response data

FieldTypeRequiredDescription
countintegerYesTotal number of matching records
sizeintegerYesFixed at 10 items per page
pageintegerYesCurrent page number
totalintegerYesTotal number of pages
dataarrayYesArray of mail summaries

data mail item

FieldTypeRequiredDescription
idlongYesMail ID
tostringYesRecipient email address
messageIdstring/nullNoEmail Message-ID; null when not provided by the message
fromstringYesSender address
subjectstring/nullNoEmail subject; null when absent
receivedAtdatetimeYesTime received
readbooleanYesWhether the email has been read
keywordstring/nullNoKeyword extracted from the email; null when none is found
keywordDisplaystring/nullNoDisplay-ready keyword text; null when unavailable

Response example

{"code":0,"msg":"Success","data":{"count":1,"size":10,"page":1,"total":1,"data":[{"id":901,"to":"[email protected]","messageId":"example-message-id","from":"NexMask <[email protected]>","subject":"Your verification code","receivedAt":"2026-09-02T12:30:00.000+00:00","read":false,"keyword":"897456","keywordDisplay":"897456"}]}}
POST/openapi/v1/mail/detail.cgi

Mail details

Read the complete content of a specific email.

Request fields

FieldTypeRequiredDescription
idlongYesMail ID

Successful response data

FieldTypeRequiredDescription
idlongYesMail ID
tostringYesRecipient email address
messageIdstring/nullNoEmail Message-ID; null when not provided by the message
fromstringYesSender address
subjectstring/nullNoEmail subject; null when absent
receivedAtdatetimeYesTime received
textContentstring/nullNoPlain-text email body; null when absent
attachmentsarrayYesArray of attachments; empty when there are no attachments

attachments item

FieldTypeRequiredDescription
fileNamestringYesAttachment file name
contentTypestring/nullNoAttachment media type; null when unknown
sizelongYesAttachment size in bytes

Response example

{"code":0,"msg":"Success","data":{"id":901,"to":"[email protected]","messageId":"example-message-id","from":"NexMask <[email protected]>","subject":"Your verification code","receivedAt":"2026-09-02T12:30:00.000+00:00","textContent":"Your verification code is 897456.","attachments":[]}}
GET/openapi/v1/user/info.cgi

User information

Query the account associated with the current API Key.

Successful response data

FieldTypeRequiredDescription
idlongYesUser ID
emailstringYesLogin email address
scoreintegerYesCurrent points
vipExpiredatetime/nullYesMembership expiration time; null when membership has never been activated
stateintegerYesAccount status
createdAtdatetimeYesCreation time
updatedAtdatetimeYesLast update time

Response example

{"code":0,"msg":"Success","data":{"id":1,"email":"[email protected]","score":50000,"vipExpire":"2026-10-01T00:00:00.000+00:00","state":0,"createdAt":"2026-08-01T00:00:00.000+00:00","updatedAt":"2026-09-02T00:00:00.000+00:00"}}
POST/openapi/v1/mailbox/list.cgi

Mailbox list

List mailboxes for the current account with pagination.

Request fields

FieldTypeRequiredDescription
pageintegerNoPage number starting at 1; defaults to 1
keywordstringNoEmail address keyword, up to 100 characters

Successful response data

FieldTypeRequiredDescription
countintegerYesTotal number of matching records
sizeintegerYesFixed at 10 items per page
pageintegerYesCurrent page number
totalintegerYesTotal number of pages
dataarrayYesArray of mailboxes

data mailbox item

FieldTypeRequiredDescription
idlongYesMailbox ID
domainIdlongYesIncoming domain ID
emailstringYesFull email address
userIdlongYesOwner user ID
receivedCountlongYesTotal number of received emails
expiresAtdatetime/nullNoExpiration time; null means no expiration
createdAtdatetimeYesCreation time
updatedAtdatetimeYesLast update time
expiredbooleanYesWhether the mailbox has expired
expiryTextstringYesLocalized expiration status text for display
expiryTonestringYesStatus style: permanent, warning, healthy, or expired

Response example

{"code":0,"msg":"Success","data":{"count":1,"size":10,"page":1,"total":1,"data":[{"id":128,"domainId":1,"email":"[email protected]","userId":1,"receivedCount":1,"expiresAt":"2026-09-03T12:00:00.000+00:00","createdAt":"2026-09-02T12:00:00.000+00:00","updatedAt":"2026-09-02T12:30:00.000+00:00","expired":false,"expiryText":"Expires in 24 hours","expiryTone":"warning"}]}}

Common responses and errors

All endpoints use the same code, msg, and data response structure.

FieldTypeRequiredDescription
codeintegerYes0 indicates success; negative values indicate recognized business errors
msgstringYesHuman-readable result message
dataobject/nullNoBusiness data returned on success

Response codes

CodeDefault message
0Operation successful
-1001The system is busy, please try again later
-1006Frequent operations, please try again later
-1100The request parameter is illegal
-1101Request parameters cannot be empty
-1102The request type must be application/json
-1208Insufficient points, please top up first
-1210API Key is invalid
-1300An active membership is required to use this feature.
-1400Please select the receiving domain name
-1401The receiving domain name is currently unavailable
-1403This domain name is for members only
-1404The private domain name is not available
-1405Please select the validity period
-1407The email address is being added, please try again later.
-1408Invalid email name format; maximum 64 characters
-1409This email address is already in use
-1410Email creation failed, please try again later
-1411This email is currently unavailable
-1412This email is currently unavailable
-1700No US address is currently available. Please try again later.
{"code":-1210,"msg":"API Key is invalid","data":null}