The CRM plugin exposes two HTTP endpoints for creating leads programmatically.
For integrations from trusted systems (CRMs, marketing tools, Zapier, etc.).
URL: POST /plugin/crm/api_leads/create/
Authentication: Bearer token in the Authorization header.
Authorization: Bearer <your-api-key-token>
Content-Type: application/x-www-form-urlencoded
Request Fields:
| Field | Required | Description |
|---|---|---|
first_name |
Yes | Lead's first name |
last_name |
Yes | Lead's last name |
email |
Yes | Email address |
phone |
No | Phone number |
company_name |
No | Company or organisation |
source |
No | Acquisition source. Defaults to "api". |
notes |
No | Initial notes |
tags[] |
No | Array of tag names. Tags are created automatically if they don't exist. |
pipeline_id |
No | Pipeline to place the lead in. Defaults to the company's default pipeline. |
Success Response (200):
{
"success": true,
"lead_id": 42
}
Error Response (400):
{
"success": false,
"errors": {
"email": "The email address must be a valid email."
}
}
Authentication Error (401):
{
"success": false,
"errors": {
"auth": "Invalid or inactive API key."
}
}
For embedding lead capture forms on websites. No API key required — protected by rate limiting and a honeypot field.
URL: POST /plugin/crm/api_leads/submit/
Content-Type: application/x-www-form-urlencoded
Request Fields:
All fields from the authenticated endpoint, plus:
| Field | Required | Description |
|---|---|---|
_company_key |
Yes | Company identifier. Use the Blesta company ID. |
_website |
No | Honeypot field. Must be empty. Hide this field with CSS (display: none). If filled, the submission is silently accepted but not processed. |
The source field defaults to "web_form" for public submissions.
Rate Limiting:
429 response.Rate Limit Error (429):
{
"success": false,
"errors": {
"rate_limit": "Too many requests. Please try again later."
}
}
<form action="https://your-blesta-url/plugin/crm/api_leads/submit/" method="POST">
<input type="hidden" name="_company_key" value="1" />
<!-- Honeypot: hide with CSS, bots will fill it -->
<div style="display: none;">
<input type="text" name="_website" value="" tabindex="-1" autocomplete="off" />
</div>
<label>First Name <input type="text" name="first_name" required /></label>
<label>Last Name <input type="text" name="last_name" required /></label>
<label>Email <input type="email" name="email" required /></label>
<label>Phone <input type="tel" name="phone" /></label>
<label>Company <input type="text" name="company_name" /></label>
<textarea name="notes" placeholder="How can we help?"></textarea>
<button type="submit">Get in Touch</button>
</form>
curl -X POST https://your-blesta-url/plugin/crm/api_leads/create/ \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d "first_name=Jane" \
-d "last_name=Doe" \
-d "email=jane@example.com" \
-d "company_name=Acme%20Corp" \
-d "source=zapier" \
-d "tags[]=vip" \
-d "tags[]=enterprise"