LeadSquared

Usage Instructions

Integrate LeadSquared CRM into the workflow. Create, update, upsert, look up, and search leads, change a lead owner or stage, log AI call and WhatsApp outcomes as activities, read a lead activity history, create and list follow-up tasks, add notes, and capture or update opportunities. Can also run workflows when LeadSquared posts a webhook. Requires a LeadSquared access key, secret key, and the API host of your region.

Actions

LeadSquared Get Lead

Get one lead by its lead ID, email address, or phone number. Returns found=false when no lead matches.

Input

ParameterTypeRequiredDescription
apiHoststringYesRegional API host of the account, e.g. "api-in21.leadsquared.com" (Mumbai). Shown under My Account > Settings > API and Webhooks.
accessKeystringYesLeadSquared access key, from My Account > Settings > API and Webhooks
secretKeystringYesLeadSquared secret key, from My Account > Settings > API and Webhooks
lookupBystringYesHow to find the lead: "id", "email", or "phone"
leadIdstringNoLead ID (ProspectID), when looking up by id
emailAddressstringNoEmail address, when looking up by email
phonestringNoPhone number, when looking up by phone. With or without country code, but no spaces or hyphens.

Output

ParameterTypeDescription
leadIdstringLead ID (ProspectID)
firstNamestringFirst name
lastNamestringLast name
emailAddressstringEmail address
phonestringPhone number
mobilestringMobile number
stagestringLead stage (ProspectStage)
ownerIdstringUser ID of the lead owner
ownerNamestringName of the lead owner
ownerEmailAddressstringEmail address of the lead owner
sourcestringLead source
scorenumberLead score
engagementScorenumberEngagement score
createdOnstringCreated time (UTC)
modifiedOnstringLast modified time (UTC)
recordjsonEvery field LeadSquared returned for the lead, keyed by schema name (mx_ custom fields included)
foundbooleanWhether a matching lead was found

LeadSquared Search Leads

Find leads with a quick search across name, email, phone, company, city, and country, or by a field criterion such as CreatedOn > 2026-01-01 or ProspectStage = Prospect.

Input

ParameterTypeRequiredDescription
apiHoststringYesRegional API host of the account, e.g. "api-in21.leadsquared.com" (Mumbai). Shown under My Account > Settings > API and Webhooks.
accessKeystringYesLeadSquared access key, from My Account > Settings > API and Webhooks
secretKeystringYesLeadSquared secret key, from My Account > Settings > API and Webhooks
searchModestringYes"quick" for a quick search, or "criteria" to match one field with an operator
quickSearchKeystringNoText to quick search for, e.g. a name, email, or phone number
lookupNamestringNoCriteria search: schema name of the field to match, e.g. "ProspectStage"
lookupValuestringNoCriteria search: value to compare with. Dates use "yyyy-MM-dd HH:mm:ss" in UTC.
sqlOperatorstringNoCriteria search: one of =, LIKE, >, <, <=, >=, <> (default =)
columnsstringNoCriteria search: comma-separated schema names to return. Defaults to the standard contact, stage, and owner fields.
sortColumnstringNoCriteria search: schema name to sort by, e.g. "CreatedOn"
sortDirectionstringNoCriteria search: "desc" (default) or "asc"
pageIndexnumberNoCriteria search: page number, starting at 1
pageSizenumberNoCriteria search: leads per page (default 25, max 1000)

Output

ParameterTypeDescription
leadsarrayMatching leads. A criteria search fills only the requested columns.
↳ leadIdstringLead ID (ProspectID)
↳ firstNamestringFirst name
↳ lastNamestringLast name
↳ emailAddressstringEmail address
↳ phonestringPhone number
↳ mobilestringMobile number
↳ stagestringLead stage (ProspectStage)
↳ ownerIdstringUser ID of the lead owner
↳ ownerNamestringName of the lead owner
↳ ownerEmailAddressstringEmail address of the lead owner
↳ sourcestringLead source
↳ scorenumberLead score
↳ engagementScorenumberEngagement score
↳ createdOnstringCreated time (UTC)
↳ modifiedOnstringLast modified time (UTC)
↳ recordjsonEvery field LeadSquared returned for the lead, keyed by schema name (mx_ custom fields included)
countnumberNumber of leads returned on this page

LeadSquared Create Lead

Create a new lead in LeadSquared. Pass at least one of FirstName, LastName, EmailAddress, or Phone; EmailAddress and Phone are unique by default, so creating a duplicate fails.

Input

ParameterTypeRequiredDescription
apiHoststringYesRegional API host of the account, e.g. "api-in21.leadsquared.com" (Mumbai). Shown under My Account > Settings > API and Webhooks.
accessKeystringYesLeadSquared access key, from My Account > Settings > API and Webhooks
secretKeystringYesLeadSquared secret key, from My Account > Settings > API and Webhooks
fieldsjsonNoLead fields as a JSON object keyed by schema name, e.g. {"FirstName": "Asha", "EmailAddress": "asha@example.com", "Phone": "+91-9876543210", "mx_City": "Pune"}. A nested object sets a custom field set.
ownerIdstringNoUser ID to assign as the lead owner (sets the OwnerId field)
stagestringNoLead stage to set, e.g. "Prospect" or "Customer" (sets the ProspectStage field)

Output

ParameterTypeDescription
leadIdstringID (ProspectID) of the new lead

LeadSquared Update Lead

Update fields on an existing lead by its lead ID, including changing the lead owner or stage. Only the fields you pass change.

Input

ParameterTypeRequiredDescription
apiHoststringYesRegional API host of the account, e.g. "api-in21.leadsquared.com" (Mumbai). Shown under My Account > Settings > API and Webhooks.
accessKeystringYesLeadSquared access key, from My Account > Settings > API and Webhooks
secretKeystringYesLeadSquared secret key, from My Account > Settings > API and Webhooks
leadIdstringYesID (ProspectID) of the lead to update
fieldsjsonNoLead fields as a JSON object keyed by schema name, e.g. {"FirstName": "Asha", "EmailAddress": "asha@example.com", "Phone": "+91-9876543210", "mx_City": "Pune"}. A nested object sets a custom field set.
ownerIdstringNoUser ID to assign as the lead owner (sets the OwnerId field)
stagestringNoLead stage to set, e.g. "Prospect" or "Customer" (sets the ProspectStage field)
postUpdatedLeadbooleanNoRun the automations, webhooks, and notifications configured for lead updates. LeadSquared skips them for API updates unless this is on.

Output

ParameterTypeDescription
affectedRowsnumberNumber of leads updated

LeadSquared Create or Update Lead

Update the lead that matches the email address or phone (or the Search By field), or create a new lead when none matches.

Input

ParameterTypeRequiredDescription
apiHoststringYesRegional API host of the account, e.g. "api-in21.leadsquared.com" (Mumbai). Shown under My Account > Settings > API and Webhooks.
accessKeystringYesLeadSquared access key, from My Account > Settings > API and Webhooks
secretKeystringYesLeadSquared secret key, from My Account > Settings > API and Webhooks
fieldsjsonNoLead fields as a JSON object keyed by schema name, e.g. {"FirstName": "Asha", "EmailAddress": "asha@example.com", "Phone": "+91-9876543210", "mx_City": "Pune"}. A nested object sets a custom field set.
ownerIdstringNoUser ID to assign as the lead owner (sets the OwnerId field)
stagestringNoLead stage to set, e.g. "Prospect" or "Customer" (sets the ProspectStage field)
searchBystringNoSchema name of the field to match an existing lead on, e.g. "EmailAddress" or "Phone". Defaults to email address and phone.
postUpdatedLeadbooleanNoRun the automations, webhooks, and notifications configured for lead updates

Output

ParameterTypeDescription
leadIdstringID (ProspectID) of the lead that was created or updated
affectedRowsnumberNumber of leads affected

LeadSquared Post Activity

Post an activity on a lead, such as the outcome of an AI call or a WhatsApp conversation, with a note and custom activity fields. Find the activity event code under My Account > Settings > Customization > Custom Activities & Scores.

Input

ParameterTypeRequiredDescription
apiHoststringYesRegional API host of the account, e.g. "api-in21.leadsquared.com" (Mumbai). Shown under My Account > Settings > API and Webhooks.
accessKeystringYesLeadSquared access key, from My Account > Settings > API and Webhooks
secretKeystringYesLeadSquared secret key, from My Account > Settings > API and Webhooks
leadIdstringYesID (ProspectID) of the lead to post the activity on
activityEventnumberYesActivity event code of the activity type, e.g. 201 for a custom activity
activityNotestringNoActivity note, e.g. a call summary or the conversation outcome
activityDateTimestringNoWhen the activity happened, in UTC as "yyyy-MM-dd HH:mm:ss". Defaults to now.
activityFieldsjsonNoCustom activity fields as a JSON object keyed by schema name, e.g. {"mx_Custom_1": "Interested", "mx_Custom_2": "180"}

Output

ParameterTypeDescription
idstringID of the new activity

LeadSquared Get Activities

List the activities on a lead, optionally only one activity type, with each activity note and custom field values. Returns 25 activities unless a row count is set.

Input

ParameterTypeRequiredDescription
apiHoststringYesRegional API host of the account, e.g. "api-in21.leadsquared.com" (Mumbai). Shown under My Account > Settings > API and Webhooks.
accessKeystringYesLeadSquared access key, from My Account > Settings > API and Webhooks
secretKeystringYesLeadSquared secret key, from My Account > Settings > API and Webhooks
leadIdstringYesID (ProspectID) of the lead
activityEventnumberNoOnly return activities with this event code. Leave empty for all activities.
offsetnumberNoPage offset (default 0)
rowCountnumberNoActivities per page (default 25)

Output

ParameterTypeDescription
recordCountnumberTotal activities matching the filter
activitiesarrayActivities on the lead
↳ activityIdstringActivity ID
↳ eventCodenumberActivity event code
↳ eventNamestringActivity type name
↳ activityScorenumberScore of the activity
↳ createdOnstringCreated time (UTC)
↳ modifiedOnstringLast modified time (UTC)
↳ activityTypenumberActivity type code
↳ typestringDirection, e.g. Inbound
↳ leadIdstringID of the lead
↳ datajsonActivity properties keyed by name, e.g. CreatedByName, NotableEventDescription (the note), HasAttachments
↳ fieldsjsonNon-empty custom activity fields keyed by schema name

LeadSquared Create Task

Create an appointment or to-do task, such as a callback, on a lead or an opportunity and assign it to a user. The task type name decides whether it is an appointment or a to-do.

Input

ParameterTypeRequiredDescription
apiHoststringYesRegional API host of the account, e.g. "api-in21.leadsquared.com" (Mumbai). Shown under My Account > Settings > API and Webhooks.
accessKeystringYesLeadSquared access key, from My Account > Settings > API and Webhooks
secretKeystringYesLeadSquared secret key, from My Account > Settings > API and Webhooks
namestringYesTask subject, e.g. "Call back about the loan offer"
taskTypestringYesName of a task type configured in LeadSquared, e.g. "Meeting" or "Follow Up"
relatedEntitystringNoWhat the task is about: "lead" (default), "opportunity", or "none"
relatedEntityIdstringNoLead ID or opportunity ID the task is about
descriptionstringNoTask description
dueDatestringNoDue date in UTC as "yyyy-MM-dd HH:mm:ss". Defaults to today.
endDatestringNoEnd date in UTC as "yyyy-MM-dd HH:mm:ss". The task turns overdue after it.
ownerIdstringNoUser ID to assign the task to
ownerEmailAddressstringNoEmail of the user to assign the task to, when the user ID is not known
remindernumberNoAppointments: minutes before the due time to remind the owner
reminderBeforeDaysnumberNoTo-dos: days before the due date to remind the owner
reminderTimestringNoTo-dos: time of day for the reminder, as "hh:mm:ss"
notifyByEmailbooleanNoEmail the task owner about the task

Output

ParameterTypeDescription
idstringID of the new task

LeadSquared Get Tasks

List the tasks on a lead, or the tasks assigned to a user with optional date range and completion filters.

Input

ParameterTypeRequiredDescription
apiHoststringYesRegional API host of the account, e.g. "api-in21.leadsquared.com" (Mumbai). Shown under My Account > Settings > API and Webhooks.
accessKeystringYesLeadSquared access key, from My Account > Settings > API and Webhooks
secretKeystringYesLeadSquared secret key, from My Account > Settings > API and Webhooks
taskLookupBystringYes"lead" for the tasks on one lead, or "owner" for the tasks assigned to a user
leadIdstringNoLead ID (ProspectID), when listing tasks on a lead
ownerIdstringNoUser ID of the task owner, when listing by owner
ownerEmailAddressstringNoEmail of the task owner, when listing by owner and the user ID is not known
fromDatestringNoOwner lookup: only tasks from this UTC time ("yyyy-MM-dd HH:mm:ss")
toDatestringNoOwner lookup: only tasks up to this UTC time ("yyyy-MM-dd HH:mm:ss")
taskStatusstringNoOwner lookup: "incomplete", "complete", or "any" (default)
offsetnumberNoOwner lookup: number of tasks to skip (default 0)
rowCountnumberNoOwner lookup: number of tasks to return (default 50)

Output

ParameterTypeDescription
recordCountnumberTotal matching tasks
tasksarrayMatching tasks
↳ taskIdstringTask ID
↳ namestringTask subject
↳ descriptionstringTask description
↳ dueDatestringDue date (UTC)
↳ endDatestringEnd date (UTC), owner lookups only
↳ statusstringTask status, e.g. Pending, for lead lookups; Incomplete or Complete for owner lookups
↳ ownerIdstringUser ID of the owner
↳ ownerNamestringName of the owner
↳ ownerEmailAddressstringEmail of the owner, owner lookups only
↳ createdBystringUser ID of the creator
↳ createdByNamestringName of the creator
↳ createdOnstringCreated time (UTC)
↳ remindernumberReminder in minutes
↳ taskTypeNamestringTask type name, owner lookups only

LeadSquared Add Note

Add a note to a lead, optionally with an attachment URL.

Input

ParameterTypeRequiredDescription
apiHoststringYesRegional API host of the account, e.g. "api-in21.leadsquared.com" (Mumbai). Shown under My Account > Settings > API and Webhooks.
accessKeystringYesLeadSquared access key, from My Account > Settings > API and Webhooks
secretKeystringYesLeadSquared secret key, from My Account > Settings > API and Webhooks
leadIdstringYesID (ProspectID) of the lead
notestringYesNote text
attachmentUrlstringNoURL of a file to attach to the note

Output

ParameterTypeDescription
idstringID of the new note

LeadSquared Create Opportunity

Capture an opportunity on a lead, creating the lead too when no lead matches. Duplicate detection rules may attach it to an existing opportunity instead of creating a new one.

Input

ParameterTypeRequiredDescription
apiHoststringYesRegional API host of the account, e.g. "api-in21.leadsquared.com" (Mumbai). Shown under My Account > Settings > API and Webhooks.
accessKeystringYesLeadSquared access key, from My Account > Settings > API and Webhooks
secretKeystringYesLeadSquared secret key, from My Account > Settings > API and Webhooks
opportunityEventCodenumberYesEvent code of the opportunity type, from Settings > Opportunities > Opportunity Types, e.g. 12000
leadIdstringNoID (ProspectID) of an existing lead. Use this or Lead Fields.
leadFieldsjsonNoUnique lead fields to find or create the lead, as a JSON object, e.g. {"EmailAddress": "asha@example.com"}
searchBystringNoSchema name of the lead field to match on, e.g. "EmailAddress" or "Phone". Defaults to the first lead field.
opportunityNotestringNoNote on the opportunity
opportunityDateTimestringNoOpportunity date in UTC as "yyyy-MM-dd HH:mm:ss"
opportunityFieldsjsonNoOpportunity fields as a JSON object keyed by schema name, e.g. {"mx_Custom_1": "Home loan", "Status": "Open"}
overwriteFieldsbooleanNoOverwrite the fields of a duplicate opportunity with the values passed
updateEmptyFieldsbooleanNoFill empty fields of a duplicate opportunity with the values passed
doNotPostDuplicateActivitybooleanNoDo not post a duplicate-detected activity on the opportunity
doNotChangeOwnerbooleanNoKeep the current owner of a duplicate opportunity

Output

ParameterTypeDescription
opportunityIdstringID of the new opportunity, null when a duplicate was detected
leadIdstringID of the lead the opportunity is on
activityIdstringID of the opportunity captured activity
isUniquebooleanFalse when the opportunity matched an existing one
conflictedOpportunityIdstringID of the existing opportunity matched as a duplicate
statusnumber0 success, 2 partial success (secondary action failed)
primaryActionnumber0 none, 1 create opportunity, 2 opportunity captured activity, 3 duplicate detected activity
secondaryActionnumberSecond action taken, with the same codes as primaryAction
requestIdstringLeadSquared request ID

LeadSquared Update Opportunity

Update fields or the note of an existing opportunity by its opportunity ID. Only the fields you pass change.

Input

ParameterTypeRequiredDescription
apiHoststringYesRegional API host of the account, e.g. "api-in21.leadsquared.com" (Mumbai). Shown under My Account > Settings > API and Webhooks.
accessKeystringYesLeadSquared access key, from My Account > Settings > API and Webhooks
secretKeystringYesLeadSquared secret key, from My Account > Settings > API and Webhooks
opportunityIdstringYesID of the opportunity (ProspectOpportunityId), or its AutoId value
opportunityNotestringNoNote on the opportunity
opportunityFieldsjsonNoOpportunity fields to change, as a JSON object keyed by schema name, e.g. {"Status": "Won", "mx_Custom_7": "200000"}

Output

ParameterTypeDescription
idstringID LeadSquared returns for the update (Message.Id)