curl --request POST \
--url https://api.mailbeast.ai/v1/campaigns/{cid}/leads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"leads": [
{
"email": "[email protected]",
"firstName": "Jane",
"lastName": "Doe",
"companyName": "Acme Inc",
"jobTitle": "VP Sales",
"website": "https://acme.com",
"linkedinProfile": "https://linkedin.com/in/jane",
"location": "New York, US",
"tags": [
"vip",
"q4"
],
"customFields": {
"industry": "SaaS",
"employees": 120
},
"customFieldLabels": {
"fund_manager": "Fund Manager"
},
"customFieldTypes": {
"logo_url": "image"
}
}
]
}
'import requests
url = "https://api.mailbeast.ai/v1/campaigns/{cid}/leads"
payload = { "leads": [
{
"email": "[email protected]",
"firstName": "Jane",
"lastName": "Doe",
"companyName": "Acme Inc",
"jobTitle": "VP Sales",
"website": "https://acme.com",
"linkedinProfile": "https://linkedin.com/in/jane",
"location": "New York, US",
"tags": ["vip", "q4"],
"customFields": {
"industry": "SaaS",
"employees": 120
},
"customFieldLabels": { "fund_manager": "Fund Manager" },
"customFieldTypes": { "logo_url": "image" }
}
] }
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({
leads: [
{
email: '[email protected]',
firstName: 'Jane',
lastName: 'Doe',
companyName: 'Acme Inc',
jobTitle: 'VP Sales',
website: 'https://acme.com',
linkedinProfile: 'https://linkedin.com/in/jane',
location: 'New York, US',
tags: ['vip', 'q4'],
customFields: {industry: 'SaaS', employees: 120},
customFieldLabels: {fund_manager: 'Fund Manager'},
customFieldTypes: {logo_url: 'image'}
}
]
})
};
fetch('https://api.mailbeast.ai/v1/campaigns/{cid}/leads', 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/campaigns/{cid}/leads",
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([
'leads' => [
[
'email' => '[email protected]',
'firstName' => 'Jane',
'lastName' => 'Doe',
'companyName' => 'Acme Inc',
'jobTitle' => 'VP Sales',
'website' => 'https://acme.com',
'linkedinProfile' => 'https://linkedin.com/in/jane',
'location' => 'New York, US',
'tags' => [
'vip',
'q4'
],
'customFields' => [
'industry' => 'SaaS',
'employees' => 120
],
'customFieldLabels' => [
'fund_manager' => 'Fund Manager'
],
'customFieldTypes' => [
'logo_url' => 'image'
]
]
]
]),
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/campaigns/{cid}/leads"
payload := strings.NewReader("{\n \"leads\": [\n {\n \"email\": \"[email protected]\",\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"companyName\": \"Acme Inc\",\n \"jobTitle\": \"VP Sales\",\n \"website\": \"https://acme.com\",\n \"linkedinProfile\": \"https://linkedin.com/in/jane\",\n \"location\": \"New York, US\",\n \"tags\": [\n \"vip\",\n \"q4\"\n ],\n \"customFields\": {\n \"industry\": \"SaaS\",\n \"employees\": 120\n },\n \"customFieldLabels\": {\n \"fund_manager\": \"Fund Manager\"\n },\n \"customFieldTypes\": {\n \"logo_url\": \"image\"\n }\n }\n ]\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/campaigns/{cid}/leads")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"leads\": [\n {\n \"email\": \"[email protected]\",\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"companyName\": \"Acme Inc\",\n \"jobTitle\": \"VP Sales\",\n \"website\": \"https://acme.com\",\n \"linkedinProfile\": \"https://linkedin.com/in/jane\",\n \"location\": \"New York, US\",\n \"tags\": [\n \"vip\",\n \"q4\"\n ],\n \"customFields\": {\n \"industry\": \"SaaS\",\n \"employees\": 120\n },\n \"customFieldLabels\": {\n \"fund_manager\": \"Fund Manager\"\n },\n \"customFieldTypes\": {\n \"logo_url\": \"image\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mailbeast.ai/v1/campaigns/{cid}/leads")
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 \"leads\": [\n {\n \"email\": \"[email protected]\",\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"companyName\": \"Acme Inc\",\n \"jobTitle\": \"VP Sales\",\n \"website\": \"https://acme.com\",\n \"linkedinProfile\": \"https://linkedin.com/in/jane\",\n \"location\": \"New York, US\",\n \"tags\": [\n \"vip\",\n \"q4\"\n ],\n \"customFields\": {\n \"industry\": \"SaaS\",\n \"employees\": 120\n },\n \"customFieldLabels\": {\n \"fund_manager\": \"Fund Manager\"\n },\n \"customFieldTypes\": {\n \"logo_url\": \"image\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"summary": {
"submitted": 3,
"created": 2,
"duplicates": 1,
"invalid": 0
},
"leads": [
{
"id": "c9e5b1a3-7f24-4d80-a6b9-2e4f8c0d1a37",
"email": "[email protected]",
"tags": [
"vip",
"q4"
],
"customFields": {
"industry": "SaaS"
},
"status": "not_contacted",
"verification": {
"status": "valid",
"subStatus": "email_ok"
},
"metrics": {
"sent": 2,
"opened": 1,
"clicked": 0,
"replied": 0
},
"createdAt": "2023-11-07T05:31:56Z",
"firstName": "Jane",
"lastName": "Doe",
"companyName": "Acme Inc",
"jobTitle": "VP Sales",
"website": "https://acme.com",
"linkedinProfile": "https://www.linkedin.com/in/janedoe",
"location": "New York, US",
"provider": "google",
"sequenceProgress": {
"totalSteps": 3,
"sentCount": 1,
"plannedCount": 1,
"failedCount": 0,
"nextPlannedAt": "2023-11-07T05:31:56Z"
},
"lastContactedAt": "2023-11-07T05:31:56Z",
"lastRepliedAt": "2023-11-07T05:31:56Z"
}
]
}{
"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": "not_found",
"message": "Resource not found.",
"status": 404,
"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
}
}Add leads
Add 1-100 leads to a campaign. Each is deduplicated by email within the campaign, provider-detected, and counts toward the monthly-imports quota. The response summarizes the outcome and returns the created leads.
Requires one of the following scopes: leads:write, leads:all, all:all.
curl --request POST \
--url https://api.mailbeast.ai/v1/campaigns/{cid}/leads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"leads": [
{
"email": "[email protected]",
"firstName": "Jane",
"lastName": "Doe",
"companyName": "Acme Inc",
"jobTitle": "VP Sales",
"website": "https://acme.com",
"linkedinProfile": "https://linkedin.com/in/jane",
"location": "New York, US",
"tags": [
"vip",
"q4"
],
"customFields": {
"industry": "SaaS",
"employees": 120
},
"customFieldLabels": {
"fund_manager": "Fund Manager"
},
"customFieldTypes": {
"logo_url": "image"
}
}
]
}
'import requests
url = "https://api.mailbeast.ai/v1/campaigns/{cid}/leads"
payload = { "leads": [
{
"email": "[email protected]",
"firstName": "Jane",
"lastName": "Doe",
"companyName": "Acme Inc",
"jobTitle": "VP Sales",
"website": "https://acme.com",
"linkedinProfile": "https://linkedin.com/in/jane",
"location": "New York, US",
"tags": ["vip", "q4"],
"customFields": {
"industry": "SaaS",
"employees": 120
},
"customFieldLabels": { "fund_manager": "Fund Manager" },
"customFieldTypes": { "logo_url": "image" }
}
] }
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({
leads: [
{
email: '[email protected]',
firstName: 'Jane',
lastName: 'Doe',
companyName: 'Acme Inc',
jobTitle: 'VP Sales',
website: 'https://acme.com',
linkedinProfile: 'https://linkedin.com/in/jane',
location: 'New York, US',
tags: ['vip', 'q4'],
customFields: {industry: 'SaaS', employees: 120},
customFieldLabels: {fund_manager: 'Fund Manager'},
customFieldTypes: {logo_url: 'image'}
}
]
})
};
fetch('https://api.mailbeast.ai/v1/campaigns/{cid}/leads', 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/campaigns/{cid}/leads",
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([
'leads' => [
[
'email' => '[email protected]',
'firstName' => 'Jane',
'lastName' => 'Doe',
'companyName' => 'Acme Inc',
'jobTitle' => 'VP Sales',
'website' => 'https://acme.com',
'linkedinProfile' => 'https://linkedin.com/in/jane',
'location' => 'New York, US',
'tags' => [
'vip',
'q4'
],
'customFields' => [
'industry' => 'SaaS',
'employees' => 120
],
'customFieldLabels' => [
'fund_manager' => 'Fund Manager'
],
'customFieldTypes' => [
'logo_url' => 'image'
]
]
]
]),
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/campaigns/{cid}/leads"
payload := strings.NewReader("{\n \"leads\": [\n {\n \"email\": \"[email protected]\",\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"companyName\": \"Acme Inc\",\n \"jobTitle\": \"VP Sales\",\n \"website\": \"https://acme.com\",\n \"linkedinProfile\": \"https://linkedin.com/in/jane\",\n \"location\": \"New York, US\",\n \"tags\": [\n \"vip\",\n \"q4\"\n ],\n \"customFields\": {\n \"industry\": \"SaaS\",\n \"employees\": 120\n },\n \"customFieldLabels\": {\n \"fund_manager\": \"Fund Manager\"\n },\n \"customFieldTypes\": {\n \"logo_url\": \"image\"\n }\n }\n ]\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/campaigns/{cid}/leads")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"leads\": [\n {\n \"email\": \"[email protected]\",\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"companyName\": \"Acme Inc\",\n \"jobTitle\": \"VP Sales\",\n \"website\": \"https://acme.com\",\n \"linkedinProfile\": \"https://linkedin.com/in/jane\",\n \"location\": \"New York, US\",\n \"tags\": [\n \"vip\",\n \"q4\"\n ],\n \"customFields\": {\n \"industry\": \"SaaS\",\n \"employees\": 120\n },\n \"customFieldLabels\": {\n \"fund_manager\": \"Fund Manager\"\n },\n \"customFieldTypes\": {\n \"logo_url\": \"image\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mailbeast.ai/v1/campaigns/{cid}/leads")
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 \"leads\": [\n {\n \"email\": \"[email protected]\",\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"companyName\": \"Acme Inc\",\n \"jobTitle\": \"VP Sales\",\n \"website\": \"https://acme.com\",\n \"linkedinProfile\": \"https://linkedin.com/in/jane\",\n \"location\": \"New York, US\",\n \"tags\": [\n \"vip\",\n \"q4\"\n ],\n \"customFields\": {\n \"industry\": \"SaaS\",\n \"employees\": 120\n },\n \"customFieldLabels\": {\n \"fund_manager\": \"Fund Manager\"\n },\n \"customFieldTypes\": {\n \"logo_url\": \"image\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"summary": {
"submitted": 3,
"created": 2,
"duplicates": 1,
"invalid": 0
},
"leads": [
{
"id": "c9e5b1a3-7f24-4d80-a6b9-2e4f8c0d1a37",
"email": "[email protected]",
"tags": [
"vip",
"q4"
],
"customFields": {
"industry": "SaaS"
},
"status": "not_contacted",
"verification": {
"status": "valid",
"subStatus": "email_ok"
},
"metrics": {
"sent": 2,
"opened": 1,
"clicked": 0,
"replied": 0
},
"createdAt": "2023-11-07T05:31:56Z",
"firstName": "Jane",
"lastName": "Doe",
"companyName": "Acme Inc",
"jobTitle": "VP Sales",
"website": "https://acme.com",
"linkedinProfile": "https://www.linkedin.com/in/janedoe",
"location": "New York, US",
"provider": "google",
"sequenceProgress": {
"totalSteps": 3,
"sentCount": 1,
"plannedCount": 1,
"failedCount": 0,
"nextPlannedAt": "2023-11-07T05:31:56Z"
},
"lastContactedAt": "2023-11-07T05:31:56Z",
"lastRepliedAt": "2023-11-07T05:31:56Z"
}
]
}{
"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": "not_found",
"message": "Resource not found.",
"status": 404,
"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
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
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"
Path Parameters
"a7d4e2f1-08b3-4c65-9e7a-1b2c3d4e5f60"
Body
Leads to add (1-100). Each is deduplicated by email within the campaign, provider-detected, and counts toward the monthly-imports quota. Send one element to add a single lead.
1 - 100 elementsShow child attributes
Show child attributes