Dashboard

Create Lead

Add a new lead to a specific chatbot

POST
4 min read

Endpoint

Leads are scoped to a chatbot — the chatbot ID is part of the URL

POST https://pollybot.app/api/v1/chatbots/{chatbotId}/leads

Required Headers

Authorization: Bearer sk-workspace_your_api_key_here
Content-Type: application/json

Path Parameters

chatbotId

The chatbot the lead belongs to. Must belong to the workspace of your API key.

string

Request Body

JSON object. Only name is required.

FieldTypeRequiredConstraintsDefault
namestring
Yes
1–100 characters—
emailstringNoValid email. Must be unique among this chatbot's leads—
phonestringNoMax 20 characters—
discordstringNoMax 50 characters—
companystringNoMax 100 characters—
messagestringNoMax 1000 characters—
preferredMethodenumNoemail | phone | discord"email"
urgencyenumNolow | medium | high"low"
sourcestringNoMax 50 characters"api"
customFieldsobjectNoArbitrary key–value pairs—
tagsstring[]NoMax 10 tags, each max 50 characters[]

Example Request

curl -X POST "https://pollybot.app/api/v1/chatbots/cmq8h2xkp0031jrnghg5wq9d2/leads" \
  -H "Authorization: Bearer sk-workspace_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Jane Cooper",
    "email": "jane.cooper@acme.com",
    "phone": "+14155550132",
    "company": "Acme Inc.",
    "message": "Interested in the enterprise plan.",
    "preferredMethod": "email",
    "urgency": "high",
    "source": "landing-page",
    "customFields": { "plan": "enterprise" },
    "tags": ["enterprise", "pricing"]
  }'
201 Created

Success Response

Returns the full lead record, including the connected chatbot. New leads start with status NEW and priority MEDIUM. Successful responses include X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers.

{
  "success": true,
  "data": {
    "id": "cmqjwkljc00892znge0tk4c37",
    "chatbotId": "cmq8h2xkp0031jrnghg5wq9d2",
    "conversationId": null,
    "name": "Jane Cooper",
    "email": "jane.cooper@acme.com",
    "phone": "+14155550132",
    "company": "Acme Inc.",
    "message": "Interested in the enterprise plan.",
    "source": "landing-page",
    "status": "NEW",
    "priority": "MEDIUM",
    "assignedAgentId": null,
    "notes": null,
    "tags": ["enterprise", "pricing"],
    "customFields": { "plan": "enterprise" },
    "followUpDate": null,
    "lastContactAt": null,
    "convertedAt": null,
    "createdAt": "2026-08-19T09:14:32.118Z",
    "updatedAt": "2026-08-19T09:14:32.118Z",
    "discord": null,
    "preferredMethod": "email",
    "urgency": "high",
    "chatbots": {
      "id": "cmq8h2xkp0031jrnghg5wq9d2",
      "name": "Support Bot"
    }
  }
}

Webhooks

Creating a lead fires the LEAD_CREATED webhook event for the chatbot. Webhook delivery failures do not fail the request — the lead is still created.

Errors

All error responses have the shape { success: false, error, code }

StatusCodeDescription
400
VALIDATION_ERRORRequest body failed validation. The details field contains per-field Zod errors.
401
AUTHENTICATION_FAILEDMissing, malformed, or invalid API key.
404
CHATBOT_NOT_FOUNDChatbot does not exist or does not belong to your workspace.
409
DUPLICATE_EMAILA lead with this email already exists for this chatbot. Response includes existingLeadId.
429
RATE_LIMIT_EXCEEDEDMore than 1000 requests in the past hour for this API key.
500
INTERNAL_ERRORUnexpected server error.

400 — Validation failed

{
  "success": false,
  "error": "Validation failed",
  "code": "VALIDATION_ERROR",
  "details": {
    "_errors": [],
    "name": { "_errors": ["Name is required"] },
    "email": { "_errors": ["Invalid email"] }
  }
}

409 — Duplicate email

{
  "success": false,
  "error": "Lead with this email already exists for this chatbot",
  "code": "DUPLICATE_EMAIL",
  "existingLeadId": "cmqhx2p4d00312zngq7rv8m1k"
}