Skip to main content
POST
/
v1
/
lexi
/
personalize-email
Personalize Email
curl --request POST \
  --url https://api.example.com/v1/lexi/personalize-email \
  --header 'Content-Type: application/json' \
  --data '
{
  "contact_id": "<string>",
  "intent": "<string>",
  "template": "<string>",
  "tone": "<string>",
  "length": "<string>",
  "language": "<string>"
}
'
{
  "data": {
    "subject": "<string>",
    "body_text": "<string>",
    "body_html": "<string>",
    "personalization_notes": [
      {}
    ],
    "reading_time_seconds": 123,
    "credits_remaining": 123
  }
}
This endpoint consumes 2 AI credits per call. If the workspace balance is insufficient, the API returns 402 insufficient_credits.

Request

Headers

Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
Idempotency-Key
string
Optional UUID for retry deduplication.

Body Parameters

contact_id
string
required
UUID of the contact the email is for.
intent
string
required
High-level purpose of the email, in natural language. Examples: "schedule an intro call", "follow up on proposal", "check-in after six weeks of silence".
template
string
Optional template body. Merge tokens ({{first_name}}, {{company}}) are resolved and the output is personalized around the template’s voice.
tone
string
default:"professional"
One of professional, warm, formal, casual.
length
string
default:"medium"
short (~50 words), medium (~120 words), or long (~250 words).
language
string
default:"en"
ISO 639-1 language code.

Response

data
object
Responses include X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, and X-Request-ID.
curl -X POST \
  https://data.leadlex.com/functions/v1/api-gateway/v1/lexi/personalize-email \
  -H "Authorization: Bearer wbk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "contact_id": "123e4567-e89b-12d3-a456-426614174000",
    "intent": "follow up on proposal",
    "tone": "warm"
  }'

Example Response

{
  "data": {
    "subject": "Quick follow-up on the Series B engagement proposal",
    "body_text": "Hi Jane,\n\nHope the week has been smooth on your end. Wanted to circle back on the flat-fee engagement proposal we shared last Tuesday and see if anything could use another pass or clarification before you share internally...",
    "body_html": "<p>Hi Jane,</p><p>Hope the week has been smooth on your end. Wanted to circle back on the flat-fee engagement proposal we shared last Tuesday and see if anything could use another pass or clarification before you share internally...</p>",
    "personalization_notes": [
      "Referenced the proposal date from the last email thread",
      "Used warm tone aligned with prior correspondence"
    ],
    "reading_time_seconds": 28,
    "credits_remaining": 4840
  }
}

Errors

StatusCodeDescription
400validation_errorMissing contact_id or intent
401invalid_keyInvalid or expired API key
402insufficient_creditsWorkspace credit balance is exhausted
403insufficient_permissionsMissing write:ai permission
404not_foundContact not found
429rate_limitedRate limit exceeded