Order Mailboxes
curl --request POST \
--url https://api.lemlist.com/api/domains-core/{domainId}/mailboxes \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"emails": [
{
"username": "john",
"sendername": "John Doe",
"assignToUser": "usr_Ye6Ta3Uo8Ic1Mn7Bh",
"workspaceAdmin": true
}
]
}
'import requests
url = "https://api.lemlist.com/api/domains-core/{domainId}/mailboxes"
payload = { "emails": [
{
"username": "john",
"sendername": "John Doe",
"assignToUser": "usr_Ye6Ta3Uo8Ic1Mn7Bh",
"workspaceAdmin": True
}
] }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
emails: [
{
username: 'john',
sendername: 'John Doe',
assignToUser: 'usr_Ye6Ta3Uo8Ic1Mn7Bh',
workspaceAdmin: true
}
]
})
};
fetch('https://api.lemlist.com/api/domains-core/{domainId}/mailboxes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://api.lemlist.com/api/domains-core/{domainId}/mailboxes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"emails\": [\n {\n \"username\": \"john\",\n \"sendername\": \"John Doe\",\n \"assignToUser\": \"usr_Ye6Ta3Uo8Ic1Mn7Bh\",\n \"workspaceAdmin\": true\n }\n ]\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lemlist.com/api/domains-core/{domainId}/mailboxes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'emails' => [
[
'username' => 'john',
'sendername' => 'John Doe',
'assignToUser' => 'usr_Ye6Ta3Uo8Ic1Mn7Bh',
'workspaceAdmin' => true
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"added": 2,
"mailboxes": [
{
"_id": "dem_Rb4Nc7Fy1Hs6Jq0Wt",
"email": "john@getacme.com",
"assignToUser": "usr_Ye6Ta3Uo8Ic1Mn7Bh"
},
{
"_id": "dem_Zp2Gx8Vm4Lk9Ds5Qe",
"email": "jane@getacme.com",
"assignToUser": "usr_Wf3Kp9Rd2Nz6Xc4Lj"
}
]
}{
"error": "Match error: Expected object, got undefined"
}{
"error": "Unauthorized"
}{
"error": "You do not have permission to perform this action"
}{
"error": "Some emails are already taken"
}{
"error": "Internal error"
}{
"error": "Unable to verify your workspace status. Please try again in a moment."
}Domains
Order Mailboxes
Orders mailboxes on one of the team’s domains and bills the team.
POST
/
domains-core
/
{domainId}
/
mailboxes
Order Mailboxes
curl --request POST \
--url https://api.lemlist.com/api/domains-core/{domainId}/mailboxes \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"emails": [
{
"username": "john",
"sendername": "John Doe",
"assignToUser": "usr_Ye6Ta3Uo8Ic1Mn7Bh",
"workspaceAdmin": true
}
]
}
'import requests
url = "https://api.lemlist.com/api/domains-core/{domainId}/mailboxes"
payload = { "emails": [
{
"username": "john",
"sendername": "John Doe",
"assignToUser": "usr_Ye6Ta3Uo8Ic1Mn7Bh",
"workspaceAdmin": True
}
] }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
emails: [
{
username: 'john',
sendername: 'John Doe',
assignToUser: 'usr_Ye6Ta3Uo8Ic1Mn7Bh',
workspaceAdmin: true
}
]
})
};
fetch('https://api.lemlist.com/api/domains-core/{domainId}/mailboxes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://api.lemlist.com/api/domains-core/{domainId}/mailboxes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"emails\": [\n {\n \"username\": \"john\",\n \"sendername\": \"John Doe\",\n \"assignToUser\": \"usr_Ye6Ta3Uo8Ic1Mn7Bh\",\n \"workspaceAdmin\": true\n }\n ]\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lemlist.com/api/domains-core/{domainId}/mailboxes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'emails' => [
[
'username' => 'john',
'sendername' => 'John Doe',
'assignToUser' => 'usr_Ye6Ta3Uo8Ic1Mn7Bh',
'workspaceAdmin' => true
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"added": 2,
"mailboxes": [
{
"_id": "dem_Rb4Nc7Fy1Hs6Jq0Wt",
"email": "john@getacme.com",
"assignToUser": "usr_Ye6Ta3Uo8Ic1Mn7Bh"
},
{
"_id": "dem_Zp2Gx8Vm4Lk9Ds5Qe",
"email": "jane@getacme.com",
"assignToUser": "usr_Wf3Kp9Rd2Nz6Xc4Lj"
}
]
}{
"error": "Match error: Expected object, got undefined"
}{
"error": "Unauthorized"
}{
"error": "You do not have permission to perform this action"
}{
"error": "Some emails are already taken"
}{
"error": "Internal error"
}{
"error": "Unable to verify your workspace status. Please try again in a moment."
}This call bills the team: each mailbox is a monthly seat on the domain’s mailbox subscription, prorated on the first invoice. Nothing can be canceled through the API; use the lemlist app.
registrar: Google Workspace, Microsoft 365 or SMTP. The order is checked as a whole: one invalid mailbox refuses it all, and nothing is billed.
You can order right after Purchase Domain. The mailboxes stay ordered until the domain is set up, then they are billed and created. Follow them with List Domain Mailboxes.
Rules by provider
| Provider | Rules |
|---|---|
google | The first mailbox set up becomes the Google Workspace super admin. Pick it with workspaceAdmin: true, otherwise lemlist picks one. The order is refused while the domain’s nameservers do not point to lemlist. |
m365 | The username admin is reserved by Microsoft. Every assigned user needs a first and last name in lemlist. |
infraforge | At most 10 mailboxes per domain. Set a sendername. |
Pass
assignToUser for each mailbox: without it the mailbox goes to the user of the API key.This call is not idempotent. Calling it again with the same usernames answers 409 (Some emails are already taken): check List Domain Mailboxes before retrying.Requires the Manage domains permission on the user of the API key.
Authorizations
Was this page helpful?