curl --request POST \
--url https://api.example.com/v1/lexi/chat \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"context": {
"list_id": "<string>",
"campaign_id": "<string>",
"conversation_id": "<string>"
}
}
'{
"data": {
"response": "<string>",
"task_id": "<string>",
"requires_approval": true,
"conversation_id": "<string>"
}
}Send a message to Lexi AI and get a response
curl --request POST \
--url https://api.example.com/v1/lexi/chat \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"context": {
"list_id": "<string>",
"campaign_id": "<string>",
"conversation_id": "<string>"
}
}
'{
"data": {
"response": "<string>",
"task_id": "<string>",
"requires_approval": true,
"conversation_id": "<string>"
}
}Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
curl -X POST \
https://data.leadlex.com/functions/v1/api-gateway/v1/lexi/chat \
-H "Authorization: Bearer wbk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"message": "Find me 20 CEOs at law firms in New York",
"context": {
"list_id": "list-uuid"
}
}'
{
"data": {
"response": "I found 20 CEOs at law firms in New York. I've added them to your list.",
"task_id": null,
"requires_approval": false,
"conversation_id": "conv-uuid"
}
}
{
"data": {
"response": "I'll search for 20 CEOs at law firms in New York and add them to your list. Please approve this task to proceed.",
"task_id": "task-uuid",
"requires_approval": true,
"conversation_id": "conv-uuid"
}
}
{
"message": "Find CTOs at SaaS companies with 50-200 employees in California"
}
{
"message": "Create an outreach campaign for my 'Q1 Leads' list about legal automation",
"context": {
"list_id": "list-uuid"
}
}
{
"message": "Can you make the email more casual?",
"context": {
"conversation_id": "conv-uuid"
}
}
conversation_id to continue a conversation. Lexi will remember the context from previous messages.# First message
response1 = client.chat_with_lexi("Find CEOs at law firms")
conv_id = response1["conversation_id"]
# Follow-up (Lexi remembers we're talking about CEOs at law firms)
response2 = client.chat_with_lexi(
"Filter to only New York",
context={"conversation_id": conv_id}
)
402 Payment Required error.
| Status | Code | Description |
|---|---|---|
| 400 | validation_error | Missing message parameter |
| 401 | invalid_key | Invalid API key |
| 402 | insufficient_credits | No Lexi credits remaining |
| 403 | insufficient_permissions | Missing lexi permission |
| 429 | rate_limited | Rate limit exceeded |
{
"error": {
"code": "insufficient_credits",
"message": "Your workspace has no Lexi credits remaining"
}
}