Contents
On this page
Convert Lead - Plugixa CRM
POST /plugixa-crm/v1/leads/{id}/convert
Convert a lead in one step: create an account from its company, a contact from its person, and optionally an opportunity, then mark the lead converted.
Any user with access to Plugixa CRM. With Plugixa CRM Pro roles, the user’s role must also allow editing this lead.
All or nothing. If the contact or the opportunity cannot be created, the account and contact this call already created are deleted permanently and the lead is left unconverted.
Note.
create_accountandcreate_contactare only switched off by a JSONfalse.0,"false"or an empty string still count as on.
Request
POST https://your-site.example/wp-json/plugixa-crm/v1/leads/22/convert
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The lead’s id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
account_id |
integer |
No | Use this existing account instead of creating one. Must exist. |
create_account |
boolean |
No | Defaults to true: create an account from account_name when the lead has one. |
create_contact |
boolean |
No | Defaults to true: create a contact when the lead has a first or last name. |
create_opportunity |
boolean |
No | Defaults to false. Needs the Opportunities app on in the App Manager; otherwise it is skipped. |
opportunity |
object |
No | The opportunity to create, see below. |
modified_at |
string |
No | The lead’s modified_at, to refuse the conversion if it changed since. |
opportunity takes name (defaults to the company, else the person), amount and currency (default to the lead’s opportunity_amount and opportunity_currency), close_date, pipeline_id and stage_id, with the same rules as Create Opportunity.
The account gets the lead’s company name, industry, website, phone, city, country and owner, with type customer. The contact gets the lead’s salutation, names, title, e-mail, phone, description and owner, and is linked to the account. The opportunity gets the lead’s source and owner, and its lead_id. Converting needs at least an account or a contact to come out of it.
{
"create_opportunity": true,
"opportunity": {
"name": "Analytical Engines Ltd: pilot",
"close_date": "2026-12-15",
"stage_id": 2
}
}
Responses
200 OK. The lead is converted.
{
"success": true,
"data": {
"lead": {
"id": 22,
"salutation": "",
"first_name": "Ada",
"last_name": "Lovelace",
"full_name": "Ada Lovelace",
"account_name": "Analytical Engines Ltd",
"title": "CTO",
"email": "ada@analytical.example",
"phone": "",
"website": "https://analytical.example",
"status": "converted",
"source": "web_site",
"industry": "Software",
"score": 40,
"opportunity_amount": 12000,
"opportunity_currency": "EUR",
"address_city": "London",
"address_country": "United Kingdom",
"description": "",
"converted_at": "2026-11-12 10:15:00",
"converted_account_id": 48,
"converted_contact_id": 77,
"converted_opportunity_id": 51,
"assigned_user_id": 3,
"created_by": "1",
"modified_by": "1",
"created_at": "2026-11-12 09:30:00",
"modified_at": "2026-11-12 10:15:00",
"deleted_at": null,
"do_not_call": "0",
"address_street": "",
"address_state": "",
"address_postal_code": ""
},
"created": {
"account_id": 48,
"contact_id": 77,
"opportunity_id": 51
}
}
}
| Field | Type | Meaning |
|---|---|---|
data.lead |
object |
The lead, now converted, with the converted_* ids filled in |
data.created.account_id |
integer|null |
The account used or created |
data.created.contact_id |
integer|null |
The contact created, null when none was |
data.created.opportunity_id |
integer|null |
The opportunity created, null when none was |
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_crm_not_found |
No lead with that id, or it is in the trash. |
409 |
plugixa_crm_already_converted |
The lead has already been converted. |
422 |
plugixa_crm_invalid_account |
account_id is not an existing account. |
422 |
plugixa_crm_nothing_to_convert |
Nothing would be created: no account (no company, or create_account: false) and no contact (no name, or create_contact: false). |
422 |
plugixa_crm_invalid_stage |
The opportunity’s stage_id is not in its pipeline. |
422 |
plugixa_crm_no_pipeline |
An opportunity was asked for and no pipeline exists. |
409 |
plugixa_crm_busy |
Another conversion of the same lead is running. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-crm/v1/leads/22/convert" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"create_opportunity":true,"opportunity":{"name":"Analytical Engines Ltd: pilot","close_date":"2026-12-15","stage_id":2}}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-crm/v1/leads/22/convert');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'create_opportunity' => true,
'opportunity' => [
'name' => 'Analytical Engines Ltd: pilot',
'close_date' => '2026-12-15',
'stage_id' => 2,
],
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`);
const response = await fetch('https://your-site.example/wp-json/plugixa-crm/v1/leads/22/convert', {
method: 'POST',
headers: {
'Authorization': auth,
'Content-Type': 'application/json',
},
body: JSON.stringify({
create_opportunity: true,
opportunity: {
name: 'Analytical Engines Ltd: pilot',
close_date: '2026-12-15',
stage_id: 2,
},
}),
});
const { data } = await response.json();
Quick Links
Share