Leads

Create leads in Pixelwand CRM from external sources.

Create a lead from any external source — a website form, a landing page, or another system — using the Leads API. New leads are added to the team that owns the API key used in the request.

Create a lead

POST /api/method/crm.api.leads.create_lead

Headers

See Authentication for details.

HeaderRequiredDescription
X-API-KeyYesThe team API key.
X-API-SecretYesThe matching API secret.

Body parameters

Parameters can be sent as form-data or JSON.

FieldRequiredDescription
nameYesFull name of the lead. The first word becomes the first name; the rest becomes the last name.
emailNoEmail address. Validated; an invalid address is rejected.
phoneNoPhone number. Skipped if the value is not a valid number.
mobile_noNoMobile number. Skipped if the value is not a valid number.
country_codeNoDial code for phone parsing, for example +91. Used to split plain numbers into country code and national number.
sourceNoLead source name (team-scoped CRM Lead Source). If the name does not exist for the team, it falls back to API.
organizationNoOrganization name.
job_titleNoJob title.
websiteNoWebsite URL.
territoryNoTerritory.
industryNoIndustry.
annual_revenueNoAnnual revenue.
no_of_employeesNoNumber of employees.
currencyNoCurrency code. Overridden to the workspace currency on creation and locked thereafter.
utm_source, utm_medium, utm_campaign, utm_term, utm_contentNoUTM attribution fields.
<any_custom_field>NoAny field not listed above is captured into the lead's extra_fields JSON column (empty strings are ignored). See below.

Example request

curl -X POST https://crm.pixelwand.io/api/method/crm.api.leads.create_lead \
  -H "X-API-Key: your_api_key" \
  -H "X-API-Secret: your_api_secret" \
  -d "name=John Doe" \
  -d "email=john@example.com" \
  -d "phone=+1234567890" \
  -d "country_code=+91" \
  -d "source=Website" \
  -d "utm_source=google" \
  -d "referral_code=REF123" \
  -d "campaign_id=CAMP456"

Extra fields

Any parameter not in the list above is treated as a custom field and stored in the lead's extra_fields JSON column. These fields appear in the lead detail view under Extra Fields and behave identically to fields captured from unknown CSV columns during import.

# These unknown fields get stored in extra_fields automatically
-d "referral_code=REF123"
-d "campaign_id=CAMP456"
-d "custom_note=Found us via podcast"

The resulting extra_fields on the lead will be:

{
  "referral_code": "REF123",
  "campaign_id": "CAMP456",
  "custom_note": "Found us via podcast"
}

Responses

Success

{
  "success": true,
  "lead_id": "CRM-LEAD-0001",
  "message": "Lead created successfully"
}

If phone or mobile_no was skipped, the message includes a suffix like Lead created successfully (skipped invalid fields: phone).

Error

{
  "success": false,
  "error": "Name is required",
  "message": "Validation failed"
}

Authentication errors return error as API key required, Team ID required, or Invalid API key with message as Authentication failed.

Notes

  • name is the only required field; a request without it is rejected.
  • Invalid phone or mobile_no values are silently skipped rather than failing the whole request, so the lead is still created. Numbers with + or 00 are split into national number and country_code; plain numbers need country_code to be parsed correctly.
  • If no organization is provided, the lead's organization defaults to the lead's name. If source is unknown for the team, it falls back to the API source.

On this page