Skip to main content
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": [
    {}
  ]
}
'
{
  "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
Idempotency-Key
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

to
string | array
required
Recipient email address, or an array of addresses. RFC 5322 addresses are accepted (e.g. "Jane Doe <jane@example.com>").
subject
string
required
Email subject line. Maximum 998 characters per RFC 2822, but 150 characters is strongly recommended for deliverability.
body_html
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.
body_text
string
Plain-text message body. Either body_html or body_text is required.
cc
array
Optional array of carbon-copy recipients.
bcc
array
Optional array of blind carbon-copy recipients.
reply_to
string
Optional Reply-To address. Defaults to the sending mailbox when omitted.
contact_id
string
Optional contact UUID. When supplied, the message is linked to the contact’s timeline automatically.
deal_id
string
Optional deal UUID. When supplied, the message is logged against the deal.
thread_id
string
Optional thread identifier to reply into an existing conversation. When omitted, a new thread is created.
attachments
array
Optional array of attachments. Each entry accepts filename, mime_type, and either content_base64 or storage_path.

Response

data
object
Every response also carries standard rate-limit headers: 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"
  }'

Example Response

{
  "data": {
    "id": "18c9a4b2e7ff21aa",
    "thread_id": "18c9a4b2e7ff21aa",
    "provider": "gmail",
    "status": "sent",
    "sent_at": "2026-04-17T10:22:11Z"
  }
}

Errors

StatusCodeDescription
400validation_errorMissing to, subject, or both body_html and body_text
401invalid_keyInvalid or expired API key
403insufficient_permissionsMissing write:email permission, or no connected email provider
409idempotency_conflictSame Idempotency-Key reused with a different payload
429rate_limitedPer-second or per-day send cap exceeded
502provider_errorThe upstream email provider (Gmail / Microsoft) returned an error