curl --request POST \
--url https://api.mailbeast.ai/v1/contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contacts": [
{
"email": "[email protected]",
"firstName": "<string>",
"lastName": "<string>",
"companyName": "<string>",
"jobTitle": "<string>",
"website": "<string>",
"linkedinProfile": "<string>",
"location": "<string>",
"tags": [
"vip"
],
"customFields": {},
"customFieldLabels": {},
"customFieldTypes": {}
}
],
"mode": "fill_empty"
}
'import requests
url = "https://api.mailbeast.ai/v1/contacts"
payload = {
"contacts": [
{
"email": "[email protected]",
"firstName": "<string>",
"lastName": "<string>",
"companyName": "<string>",
"jobTitle": "<string>",
"website": "<string>",
"linkedinProfile": "<string>",
"location": "<string>",
"tags": ["vip"],
"customFields": {},
"customFieldLabels": {},
"customFieldTypes": {}
}
],
"mode": "fill_empty"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contacts: [
{
email: '[email protected]',
firstName: '<string>',
lastName: '<string>',
companyName: '<string>',
jobTitle: '<string>',
website: '<string>',
linkedinProfile: '<string>',
location: '<string>',
tags: ['vip'],
customFields: {},
customFieldLabels: {},
customFieldTypes: {}
}
],
mode: 'fill_empty'
})
};
fetch('https://api.mailbeast.ai/v1/contacts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mailbeast.ai/v1/contacts",
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([
'contacts' => [
[
'email' => '[email protected]',
'firstName' => '<string>',
'lastName' => '<string>',
'companyName' => '<string>',
'jobTitle' => '<string>',
'website' => '<string>',
'linkedinProfile' => '<string>',
'location' => '<string>',
'tags' => [
'vip'
],
'customFields' => [
],
'customFieldLabels' => [
],
'customFieldTypes' => [
]
]
],
'mode' => 'fill_empty'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mailbeast.ai/v1/contacts"
payload := strings.NewReader("{\n \"contacts\": [\n {\n \"email\": \"[email protected]\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"companyName\": \"<string>\",\n \"jobTitle\": \"<string>\",\n \"website\": \"<string>\",\n \"linkedinProfile\": \"<string>\",\n \"location\": \"<string>\",\n \"tags\": [\n \"vip\"\n ],\n \"customFields\": {},\n \"customFieldLabels\": {},\n \"customFieldTypes\": {}\n }\n ],\n \"mode\": \"fill_empty\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mailbeast.ai/v1/contacts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contacts\": [\n {\n \"email\": \"[email protected]\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"companyName\": \"<string>\",\n \"jobTitle\": \"<string>\",\n \"website\": \"<string>\",\n \"linkedinProfile\": \"<string>\",\n \"location\": \"<string>\",\n \"tags\": [\n \"vip\"\n ],\n \"customFields\": {},\n \"customFieldLabels\": {},\n \"customFieldTypes\": {}\n }\n ],\n \"mode\": \"fill_empty\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mailbeast.ai/v1/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contacts\": [\n {\n \"email\": \"[email protected]\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"companyName\": \"<string>\",\n \"jobTitle\": \"<string>\",\n \"website\": \"<string>\",\n \"linkedinProfile\": \"<string>\",\n \"location\": \"<string>\",\n \"tags\": [\n \"vip\"\n ],\n \"customFields\": {},\n \"customFieldLabels\": {},\n \"customFieldTypes\": {}\n }\n ],\n \"mode\": \"fill_empty\"\n}"
response = http.request(request)
puts response.read_body{
"summary": {
"submitted": 4,
"created": 1,
"updated": 1,
"unchanged": 0,
"skipped": 0,
"invalid": 1,
"duplicates": 1,
"overStorageLimit": 0
},
"results": [
{
"email": "[email protected]",
"outcome": "created",
"contactId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"invalidRows": [
{
"index": 3,
"reason": "website must be a URL address"
}
]
}{
"error": {
"type": "invalid_request_error",
"code": "validation_failed",
"message": "One or more fields are invalid.",
"status": 400,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f",
"details": [
"name should not be empty"
]
}
}{
"error": {
"type": "authentication_error",
"code": "unauthenticated",
"message": "Missing or invalid API key.",
"status": 401,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "invalid_request_error",
"code": "plan_limit_exceeded",
"message": "A plan limit was reached.",
"status": 402,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "authorization_error",
"code": "permission_denied",
"message": "This API key is missing the required scope.",
"status": 403,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "invalid_request_error",
"code": "conflict",
"message": "The request conflicts with an existing resource.",
"status": 409,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "invalid_request_error",
"code": "idempotency_key_reused",
"message": "The Idempotency-Key was already used with a different request body. Use a new key for a new operation.",
"status": 422,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "rate_limit_error",
"code": "rate_limited",
"message": "Too many requests. Retry after the interval in the Retry-After header.",
"status": 429,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f",
"retryAfter": 30
}
}Upsert contacts
Create or update 1-1,000 people, matched by email. mode decides what happens to people who already exist (default fill_empty); a missing or empty value never erases a field, and the tags you send are added to the person’s (an upsert never removes a tag; PATCH replaces them). A contact that fails validation is reported in invalidRows and the rest are saved. New people beyond the fair use of contact storage are not saved (over_storage_limit); if nobody in the request can be saved (all valid emails are new people and none fit), the request fails with 402. The body is limited to 1 MB: a bigger one fails with 413 request_too_large, so send full profiles in smaller requests.
Requires one of the following scopes: contacts:write, contacts:all, all:all.
curl --request POST \
--url https://api.mailbeast.ai/v1/contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contacts": [
{
"email": "[email protected]",
"firstName": "<string>",
"lastName": "<string>",
"companyName": "<string>",
"jobTitle": "<string>",
"website": "<string>",
"linkedinProfile": "<string>",
"location": "<string>",
"tags": [
"vip"
],
"customFields": {},
"customFieldLabels": {},
"customFieldTypes": {}
}
],
"mode": "fill_empty"
}
'import requests
url = "https://api.mailbeast.ai/v1/contacts"
payload = {
"contacts": [
{
"email": "[email protected]",
"firstName": "<string>",
"lastName": "<string>",
"companyName": "<string>",
"jobTitle": "<string>",
"website": "<string>",
"linkedinProfile": "<string>",
"location": "<string>",
"tags": ["vip"],
"customFields": {},
"customFieldLabels": {},
"customFieldTypes": {}
}
],
"mode": "fill_empty"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contacts: [
{
email: '[email protected]',
firstName: '<string>',
lastName: '<string>',
companyName: '<string>',
jobTitle: '<string>',
website: '<string>',
linkedinProfile: '<string>',
location: '<string>',
tags: ['vip'],
customFields: {},
customFieldLabels: {},
customFieldTypes: {}
}
],
mode: 'fill_empty'
})
};
fetch('https://api.mailbeast.ai/v1/contacts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mailbeast.ai/v1/contacts",
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([
'contacts' => [
[
'email' => '[email protected]',
'firstName' => '<string>',
'lastName' => '<string>',
'companyName' => '<string>',
'jobTitle' => '<string>',
'website' => '<string>',
'linkedinProfile' => '<string>',
'location' => '<string>',
'tags' => [
'vip'
],
'customFields' => [
],
'customFieldLabels' => [
],
'customFieldTypes' => [
]
]
],
'mode' => 'fill_empty'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mailbeast.ai/v1/contacts"
payload := strings.NewReader("{\n \"contacts\": [\n {\n \"email\": \"[email protected]\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"companyName\": \"<string>\",\n \"jobTitle\": \"<string>\",\n \"website\": \"<string>\",\n \"linkedinProfile\": \"<string>\",\n \"location\": \"<string>\",\n \"tags\": [\n \"vip\"\n ],\n \"customFields\": {},\n \"customFieldLabels\": {},\n \"customFieldTypes\": {}\n }\n ],\n \"mode\": \"fill_empty\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mailbeast.ai/v1/contacts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contacts\": [\n {\n \"email\": \"[email protected]\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"companyName\": \"<string>\",\n \"jobTitle\": \"<string>\",\n \"website\": \"<string>\",\n \"linkedinProfile\": \"<string>\",\n \"location\": \"<string>\",\n \"tags\": [\n \"vip\"\n ],\n \"customFields\": {},\n \"customFieldLabels\": {},\n \"customFieldTypes\": {}\n }\n ],\n \"mode\": \"fill_empty\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mailbeast.ai/v1/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contacts\": [\n {\n \"email\": \"[email protected]\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"companyName\": \"<string>\",\n \"jobTitle\": \"<string>\",\n \"website\": \"<string>\",\n \"linkedinProfile\": \"<string>\",\n \"location\": \"<string>\",\n \"tags\": [\n \"vip\"\n ],\n \"customFields\": {},\n \"customFieldLabels\": {},\n \"customFieldTypes\": {}\n }\n ],\n \"mode\": \"fill_empty\"\n}"
response = http.request(request)
puts response.read_body{
"summary": {
"submitted": 4,
"created": 1,
"updated": 1,
"unchanged": 0,
"skipped": 0,
"invalid": 1,
"duplicates": 1,
"overStorageLimit": 0
},
"results": [
{
"email": "[email protected]",
"outcome": "created",
"contactId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"invalidRows": [
{
"index": 3,
"reason": "website must be a URL address"
}
]
}{
"error": {
"type": "invalid_request_error",
"code": "validation_failed",
"message": "One or more fields are invalid.",
"status": 400,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f",
"details": [
"name should not be empty"
]
}
}{
"error": {
"type": "authentication_error",
"code": "unauthenticated",
"message": "Missing or invalid API key.",
"status": 401,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "invalid_request_error",
"code": "plan_limit_exceeded",
"message": "A plan limit was reached.",
"status": 402,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "authorization_error",
"code": "permission_denied",
"message": "This API key is missing the required scope.",
"status": 403,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "invalid_request_error",
"code": "conflict",
"message": "The request conflicts with an existing resource.",
"status": 409,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "invalid_request_error",
"code": "idempotency_key_reused",
"message": "The Idempotency-Key was already used with a different request body. Use a new key for a new operation.",
"status": 422,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "rate_limit_error",
"code": "rate_limited",
"message": "Too many requests. Retry after the interval in the Retry-After header.",
"status": 429,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f",
"retryAfter": 30
}
}Authorizations
Headers
Optional. A unique key you generate (max 255 chars, such as a UUID) that makes this request safe to retry. Retrying with the same key replays the original response instead of repeating the operation. Reusing a key with a different body returns 422.
255"a1b2c3d4-e5f6-7890-abcd-ef1234567890"
Body
What to do with a person who already exists: fill_empty fills only their empty fields, overwrite replaces fields with the values you send, skip leaves them as they are. In both fill_empty and overwrite the tags you send are added to the person's tags: an upsert never removes a tag (PATCH replaces them). A missing or empty value never erases a field.
fill_empty, overwrite, skip