string
Send Email
curl --request POST \
--url https://api.example.com/v1/email/send \
--header 'Content-Type: application/json' \
--data '
{
"to": {},
"subject": "<string>",
"body_html": "<string>",
"body_text": "<string>",
"cc": [
{}
],
"bcc": [
{}
],
"reply_to": "<string>",
"contact_id": "<string>",
"deal_id": "<string>",
"thread_id": "<string>",
"attachments": [
{}
]
}
'import requests
url = "https://api.example.com/v1/email/send"
payload = {
"to": {},
"subject": "<string>",
"body_html": "<string>",
"body_text": "<string>",
"cc": [{}],
"bcc": [{}],
"reply_to": "<string>",
"contact_id": "<string>",
"deal_id": "<string>",
"thread_id": "<string>",
"attachments": [{}]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
to: {},
subject: '<string>',
body_html: '<string>',
body_text: '<string>',
cc: [{}],
bcc: [{}],
reply_to: '<string>',
contact_id: '<string>',
deal_id: '<string>',
thread_id: '<string>',
attachments: [{}]
})
};
fetch('https://api.example.com/v1/email/send', 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.example.com/v1/email/send",
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([
'to' => [
],
'subject' => '<string>',
'body_html' => '<string>',
'body_text' => '<string>',
'cc' => [
[
]
],
'bcc' => [
[
]
],
'reply_to' => '<string>',
'contact_id' => '<string>',
'deal_id' => '<string>',
'thread_id' => '<string>',
'attachments' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"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.example.com/v1/email/send"
payload := strings.NewReader("{\n \"to\": {},\n \"subject\": \"<string>\",\n \"body_html\": \"<string>\",\n \"body_text\": \"<string>\",\n \"cc\": [\n {}\n ],\n \"bcc\": [\n {}\n ],\n \"reply_to\": \"<string>\",\n \"contact_id\": \"<string>\",\n \"deal_id\": \"<string>\",\n \"thread_id\": \"<string>\",\n \"attachments\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/v1/email/send")
.header("Content-Type", "application/json")
.body("{\n \"to\": {},\n \"subject\": \"<string>\",\n \"body_html\": \"<string>\",\n \"body_text\": \"<string>\",\n \"cc\": [\n {}\n ],\n \"bcc\": [\n {}\n ],\n \"reply_to\": \"<string>\",\n \"contact_id\": \"<string>\",\n \"deal_id\": \"<string>\",\n \"thread_id\": \"<string>\",\n \"attachments\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/email/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"to\": {},\n \"subject\": \"<string>\",\n \"body_html\": \"<string>\",\n \"body_text\": \"<string>\",\n \"cc\": [\n {}\n ],\n \"bcc\": [\n {}\n ],\n \"reply_to\": \"<string>\",\n \"contact_id\": \"<string>\",\n \"deal_id\": \"<string>\",\n \"thread_id\": \"<string>\",\n \"attachments\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"thread_id": "<string>",
"provider": "<string>",
"status": "<string>",
"sent_at": "<string>"
}
}Email
Send Email
Send an email through the workspace’s connected Gmail or Office 365 account
POST
/
v1
/
email
/
send
Send Email
curl --request POST \
--url https://api.example.com/v1/email/send \
--header 'Content-Type: application/json' \
--data '
{
"to": {},
"subject": "<string>",
"body_html": "<string>",
"body_text": "<string>",
"cc": [
{}
],
"bcc": [
{}
],
"reply_to": "<string>",
"contact_id": "<string>",
"deal_id": "<string>",
"thread_id": "<string>",
"attachments": [
{}
]
}
'import requests
url = "https://api.example.com/v1/email/send"
payload = {
"to": {},
"subject": "<string>",
"body_html": "<string>",
"body_text": "<string>",
"cc": [{}],
"bcc": [{}],
"reply_to": "<string>",
"contact_id": "<string>",
"deal_id": "<string>",
"thread_id": "<string>",
"attachments": [{}]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
to: {},
subject: '<string>',
body_html: '<string>',
body_text: '<string>',
cc: [{}],
bcc: [{}],
reply_to: '<string>',
contact_id: '<string>',
deal_id: '<string>',
thread_id: '<string>',
attachments: [{}]
})
};
fetch('https://api.example.com/v1/email/send', 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.example.com/v1/email/send",
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([
'to' => [
],
'subject' => '<string>',
'body_html' => '<string>',
'body_text' => '<string>',
'cc' => [
[
]
],
'bcc' => [
[
]
],
'reply_to' => '<string>',
'contact_id' => '<string>',
'deal_id' => '<string>',
'thread_id' => '<string>',
'attachments' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"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.example.com/v1/email/send"
payload := strings.NewReader("{\n \"to\": {},\n \"subject\": \"<string>\",\n \"body_html\": \"<string>\",\n \"body_text\": \"<string>\",\n \"cc\": [\n {}\n ],\n \"bcc\": [\n {}\n ],\n \"reply_to\": \"<string>\",\n \"contact_id\": \"<string>\",\n \"deal_id\": \"<string>\",\n \"thread_id\": \"<string>\",\n \"attachments\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/v1/email/send")
.header("Content-Type", "application/json")
.body("{\n \"to\": {},\n \"subject\": \"<string>\",\n \"body_html\": \"<string>\",\n \"body_text\": \"<string>\",\n \"cc\": [\n {}\n ],\n \"bcc\": [\n {}\n ],\n \"reply_to\": \"<string>\",\n \"contact_id\": \"<string>\",\n \"deal_id\": \"<string>\",\n \"thread_id\": \"<string>\",\n \"attachments\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/email/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"to\": {},\n \"subject\": \"<string>\",\n \"body_html\": \"<string>\",\n \"body_text\": \"<string>\",\n \"cc\": [\n {}\n ],\n \"bcc\": [\n {}\n ],\n \"reply_to\": \"<string>\",\n \"contact_id\": \"<string>\",\n \"deal_id\": \"<string>\",\n \"thread_id\": \"<string>\",\n \"attachments\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"thread_id": "<string>",
"provider": "<string>",
"status": "<string>",
"sent_at": "<string>"
}
}Request
Headers
Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
string
Optional client-generated key (UUIDv4 recommended). When present, the gateway deduplicates retries within a 24-hour window and returns the original response. Strongly recommended for all send operations so that network retries never produce duplicate messages.
Body Parameters
string | array
required
Recipient email address, or an array of addresses. RFC 5322 addresses are accepted (e.g.
"Jane Doe <jane@example.com>").string
required
Email subject line. Maximum 998 characters per RFC 2822, but 150 characters is strongly recommended for deliverability.
string
HTML-formatted message body. Either
body_html or body_text is required. When both are supplied, the email is sent as a multipart/alternative message and clients select the best representation.Plain-text message body. Either
body_html or body_text is required.array
Optional array of carbon-copy recipients.
array
Optional array of blind carbon-copy recipients.
string
Optional Reply-To address. Defaults to the sending mailbox when omitted.
string
Optional contact UUID. When supplied, the message is linked to the contact’s timeline automatically.
string
Optional deal UUID. When supplied, the message is logged against the deal.
string
Optional thread identifier to reply into an existing conversation. When omitted, a new thread is created.
array
Optional array of attachments. Each entry accepts
filename, mime_type, and either content_base64 or storage_path.Response
object
X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, and X-Request-ID for support traceability.
curl -X POST \
https://data.leadlex.com/functions/v1/api-gateway/v1/email/send \
-H "Authorization: Bearer wbk_your_api_key_here" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 7e0b7c0e-5b2f-4b17-bf2a-4d7e7e33d9f1" \
-d '{
"to": "jane@example.com",
"subject": "Follow-up on our meeting",
"body_html": "<p>Hi Jane, thanks for meeting with us today.</p>",
"contact_id": "123e4567-e89b-12d3-a456-426614174000"
}'
import requests, uuid
API_KEY = "wbk_your_api_key_here"
BASE_URL = "https://data.leadlex.com/functions/v1/api-gateway"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
"Idempotency-Key": str(uuid.uuid4()),
}
payload = {
"to": "jane@example.com",
"subject": "Follow-up on our meeting",
"body_html": "<p>Hi Jane, thanks for meeting with us today.</p>",
"contact_id": "123e4567-e89b-12d3-a456-426614174000",
}
response = requests.post(f"{BASE_URL}/v1/email/send", headers=headers, json=payload)
print(response.json()["data"]["id"])
const response = await fetch(
'https://data.leadlex.com/functions/v1/api-gateway/v1/email/send',
{
method: 'POST',
headers: {
'Authorization': 'Bearer wbk_your_api_key_here',
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(),
},
body: JSON.stringify({
to: 'jane@example.com',
subject: 'Follow-up on our meeting',
body_html: '<p>Hi Jane, thanks for meeting with us today.</p>',
contact_id: '123e4567-e89b-12d3-a456-426614174000',
}),
}
);
const { data } = await response.json();
console.log(data.id);
Example Response
{
"data": {
"id": "18c9a4b2e7ff21aa",
"thread_id": "18c9a4b2e7ff21aa",
"provider": "gmail",
"status": "sent",
"sent_at": "2026-04-17T10:22:11Z"
}
}
Errors
| Status | Code | Description |
|---|---|---|
| 400 | validation_error | Missing to, subject, or both body_html and body_text |
| 401 | invalid_key | Invalid or expired API key |
| 403 | insufficient_permissions | Missing write:email permission, or no connected email provider |
| 409 | idempotency_conflict | Same Idempotency-Key reused with a different payload |
| 429 | rate_limited | Per-second or per-day send cap exceeded |
| 502 | provider_error | The upstream email provider (Gmail / Microsoft) returned an error |