> For the complete documentation index, see [llms.txt](https://docs.fastn.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fastn.ai/connectors/catalog/crm-sales/lead-squared.md). Agents can also search and read this documentation through its [MCP server](https://docs.fastn.ai/~gitbook/mcp).

# LeadSquared

LeadSquared is a sales and marketing CRM. Create and update leads, log activities, capture opportunities and manage notes, tasks and lists.

![LeadSquared logo](https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2Fgit-blob-34710828dcfbff013bdf4416b73cfb4a9b66b0b7%2Flead-squared.png?alt=media)

|                    |                                                                                |
| ------------------ | ------------------------------------------------------------------------------ |
| **Category**       | [CRM and sales](https://docs.fastn.ai/connectors/catalog/crm-sales.md)         |
| **Website**        | [leadsquared.com](https://leadsquared.com)                                     |
| **Authentication** | Access key and secret key                                                      |
| **Slug**           | `leadSquared`                                                                  |
| **On fastn.ai**    | [Embed LeadSquared in your product](https://fastn.ai/integrations/leadsquared) |

## Setup

Your customers enter their access key and secret key for LeadSquared when they connect. Nothing else needs setting up.

## Connect in Fastn

Your customers connect LeadSquared from your widget. To connect an account yourself:

1. Go to **Build → Integrations → Connectors** and search for **LeadSquared**.
2. Select **Connect** on the LeadSquared card.

   <figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2Fgit-blob-586dd03cdc0c6904263f58928d7a531eae2f85df%2Fconnect-search.png?alt=media" alt="The Connectors page in Fastn with ServiceNow typed in the search box and the ServiceNow card showing a Connect button"><figcaption><p>Search for the connector, then select Connect on its card. ServiceNow is shown here.</p></figcaption></figure>
3. Fill in the fields the form asks for, using the values from [Setup](#setup) above. Then select **Connect**.

   <figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2Fgit-blob-51fb88ef328c525b5b11f8d7094bab11efc333b8%2Fconnect-credentials.png?alt=media" alt="The Connect ServiceNow dialog with an optional account name and the Instance, Username and Password fields, and Cancel and Connect buttons"><figcaption><p>A connect form that asks for credentials. Each connector asks for its own fields.</p></figcaption></figure>
4. Check that the connection appears under **Operate → Connections** with the status `Active`. Your workflows can now use LeadSquared's actions.

For more detail, see [Connect an app](https://docs.fastn.ai/build/integrations/connectors/connect-an-app.md).

## Actions

<table><thead><tr><th width="240">Action</th><th width="260">Slug</th><th>What it does</th></tr></thead><tbody><tr><td>Add Leads to Static List</td><td><code>addLeadsToStaticList</code></td><td>Add one or more leads to a static list. Leads already on the list are ignored rather than duplicated. Works only on static lists - dynamic and refreshable lists compute their own membership.</td></tr><tr><td>Capture Opportunity</td><td><code>captureOpportunity</code></td><td>Create an opportunity, creating or matching its lead in the same call. leadDetails identifies the lead (at least one unique attribute plus a SearchBy pair); opportunityEventCode is the opportunity type's code from Get Opportunity Types; opportunityFields carries the opportunity's field values. Returns CreatedOpportunityId and the related lead id.</td></tr><tr><td>Create Activity on Lead</td><td><code>createActivity</code></td><td>Post a custom activity against a lead. ActivityEvent is the numeric event code of the activity type - get the codes from Get Activity Types. Custom activity fields are supplied as an array of SchemaName/Value pairs. Returns the new activity id.</td></tr><tr><td>Create Custom Lead Field</td><td><code>createCustomLeadField</code></td><td>Create a new custom lead field on the account. LeadSquared assigns the mx_ schema name itself and returns the new field's id. Dropdown-style fields take their values through OptionsJson.</td></tr><tr><td>Create Lead</td><td><code>createLead</code></td><td>Create a new lead in LeadSquared. The body is LeadSquared's attribute-value array: a JSON array of {"Attribute": schemaName, "Value": value} objects. At least one unique identifying attribute (EmailAddress or Phone) must be present. Standard schema names include EmailAddress, FirstName, LastName, Phone, Company, ProspectStage, Source, OwnerId; account-specific custom fields use their mx_ schema name. Returns the new ProspectID.</td></tr><tr><td>Create Leads in Bulk</td><td><code>createLeadsInBulk</code></td><td>Create up to 50 leads in a single call. The body is an array of attribute-value arrays, one inner array per lead. Returns a per-row result with the created LeadId and a LeadCreated flag. Counts against the stricter bulk rate limit (5 or 10 calls per 5 seconds depending on plan).</td></tr><tr><td>Create Note</td><td><code>createNote</code></td><td>Add a note to a lead, optionally with a file attached by URL. LeadSquared downloads the URL in AttachmentName and stores it against the note. Returns the new ProspectNoteId.</td></tr><tr><td>Create or Update Lead</td><td><code>createOrUpdateLead</code></td><td>Upsert a lead: create it if no match is found, otherwise update the existing one. Matching is controlled by a SearchBy attribute in the body (for example {"Attribute":"SearchBy","Value":"EmailAddress"}). Returns the lead's ProspectID and the number of rows affected.</td></tr><tr><td>Create Sales Group</td><td><code>createSalesGroup</code></td><td>Create a sales group (user group). Name is mandatory. Returns the new group id.</td></tr><tr><td>Create Static List</td><td><code>createStaticList</code></td><td>Create a new, empty static lead list. Returns the new list id, which Add Leads to Static List and Send Email Campaign to List then take.</td></tr></tbody></table>

<details>

<summary>View 48 more actions</summary>

<table><thead><tr><th width="240">Action</th><th width="260">Slug</th><th>What it does</th></tr></thead><tbody><tr><td>Create Task</td><td><code>createTask</code></td><td>Create a to-do or an appointment. The task type name decides which: appointment task types have Category 0 and to-do types have Category 1 - list them with Get Task Types. RelatedEntity is 0 for a standalone task, 1 to attach it to a lead, and 5 to attach it to an opportunity. Returns the new task id.</td></tr><tr><td>Create User</td><td><code>createUser</code></td><td>Create a LeadSquared user. FirstName, EmailAddress and Role are mandatory. Role must be one of Administrator, Marketing_User, Sales_Manager or Sales_User. Returns the new user's id.</td></tr><tr><td>Create Webhook</td><td><code>createWebhook</code></td><td>Register a webhook that LeadSquared will POST to when the chosen event fires. WebhookEvent is a numeric event code as a string: 1 landing page submission, 2 lead activity create, 3 lead create, 4 lead owner change, 5 lead stage change, 6 lead update, 7 task create, 8 task reminder, 9 lead score change, 15 lead activity update, 16 task complete, 17 task update, 26 lead field update, 31 opportunity create, 32 opportunity update, 33 opportunity field update, 34 opportunity stage update, 35 opportunity delete. Returns the new webhook id.</td></tr><tr><td>Delete Activity</td><td><code>deleteActivity</code></td><td>Delete a single custom activity by its id. LeadSquared exposes this as a GET. The activity type must allow deletion (CanDeleteActivity on the type).</td></tr><tr><td>Delete Lead</td><td><code>deleteLead</code></td><td>Permanently delete a lead and everything attached to it - opportunities, activities, tasks, notes, audit history and files. This cannot be reversed and there is no bulk equivalent. LeadSquared exposes this as a GET, and the endpoint is disabled by default: LeadSquared support must enable it on the account first.</td></tr><tr><td>Delete Opportunity</td><td><code>deleteOpportunity</code></td><td>Delete an opportunity by id. LeadSquared exposes this as a GET. The opportunity type must have been created with Allow Delete enabled, otherwise the call fails.</td></tr><tr><td>Delete Sales Group</td><td><code>deleteSalesGroup</code></td><td>Delete a sales group by id. The group id comes from Get Sales Groups and is sent in the request body, not the query string.</td></tr><tr><td>Delete Task</td><td><code>deleteTask</code></td><td>Delete a task by its id. LeadSquared exposes this as a GET. Returns the number of rows affected.</td></tr><tr><td>Delete Webhook</td><td><code>deleteWebhook</code></td><td>Delete a registered webhook by id, stopping further deliveries. LeadSquared exposes this as a GET.</td></tr><tr><td>Get Activity Details</td><td><code>getActivityDetails</code></td><td>Retrieve one activity by its id, with every custom field resolved to schema name, display name, value and data type, plus the lead it belongs to.</td></tr><tr><td>Get Activity Types</td><td><code>getActivityTypes</code></td><td>List every activity type configured on the account with its numeric ActivityEvent code, custom field definitions and settings. Call this first to find the event code required by Create Activity on Lead and Get Lead Activities. EventType is 0 for email, 1 for web, 2 for custom and 4 for revenue or sales activities.</td></tr><tr><td>Get All Lists</td><td><code>getAllLists</code></td><td>List every lead list on the account, system-generated and user-created, with its id, type and member count. Optionally filter by list type or by a name search.</td></tr><tr><td>Get Campaign Statistics</td><td><code>getCampaignStatistics</code></td><td>Retrieve per-campaign email statistics for a date range: recipients, delivered, opens, clicks, bounces, unsubscribes and spam complaints. Paged with PageIndex and PageSize.</td></tr><tr><td>Get Lead Activities</td><td><code>getLeadActivities</code></td><td>Retrieve the activities posted on a lead, optionally narrowed to one activity type. This endpoint pages with Offset and RowCount rather than PageIndex and PageSize. Each activity carries its event code, type, custom field values and a Data array of extra key-value pairs.</td></tr><tr><td>Get Lead by Email Address</td><td><code>getLeadByEmail</code></td><td>Retrieve a lead by its EmailAddress field. Returns a bare array with the matching lead, or an empty array when no lead has that address.</td></tr><tr><td>Get Lead by Id</td><td><code>getLeadById</code></td><td>Retrieve a single lead by its ProspectID, returning every populated lead field including custom mx_ fields. LeadSquared returns a bare array containing at most one lead; an unknown id yields an empty array.</td></tr><tr><td>Get Lead by Phone Number</td><td><code>getLeadByPhone</code></td><td>Retrieve a lead by its Phone or Mobile field. If several leads share the number, LeadSquared returns the one with the most recent activity. Pass digits only, with or without a country code, and without spaces or hyphens.</td></tr><tr><td>Get Lead Field Metadata</td><td><code>getLeadMetadata</code></td><td>Retrieve the properties of every lead field on the account, standard and custom: schema name, display name, data type, render type, mandatory flag, validation and dropdown option sets. This is the source of truth for the mx_ schema names used by the lead write actions. Set excludeOptionSets to 1 to drop dropdown values and speed the call up.</td></tr><tr><td>Get Lead Notes</td><td><code>getLeadNotes</code></td><td>Retrieve the notes attached to a lead, paged and sorted. Pass a note id in noteId to fetch one specific note, or an empty string to return all of the lead's notes. Each note carries its attachment name and CDN URL when one is present.</td></tr><tr><td>Get Lead Owner</td><td><code>getLeadOwner</code></td><td>Get the user who owns a lead, identified by any lead field rather than only the id. Pass the field name in LeadIdentifier and the value in value. Returns the owner's user record including role, team and time zone.</td></tr><tr><td>Get Leads by Date Range</td><td><code>getLeadsByDateRange</code></td><td>List leads modified between two timestamps. Useful as an incremental sync source. A single call returns at most 5000 leads, so page through with PageIndex. Each lead comes back as a LeadPropertyList of attribute-value pairs rather than a flat object.</td></tr><tr><td>Get Leads in a List</td><td><code>getLeadsInList</code></td><td>Retrieve the leads that belong to a static or dynamic list, selecting which columns come back. Each lead is returned as a LeadPropertyList of attribute-value pairs.</td></tr><tr><td>Get Lists by Lead Id</td><td><code>getListsByLeadId</code></td><td>Return every list a given lead currently belongs to, as id and name pairs.</td></tr><tr><td>Get Opportunities of a Lead</td><td><code>getOpportunitiesOfLead</code></td><td>List the opportunities belonging to one lead, optionally restricted to a single opportunity type, selecting which opportunity columns come back. Paged with PageIndex and PageSize.</td></tr><tr><td>Get Opportunity by Id</td><td><code>getOpportunityById</code></td><td>Retrieve a single opportunity with every field resolved to schema name, display name, value and data type, plus the related lead. Set getFileURL to true to have file-type fields returned as downloadable URLs.</td></tr><tr><td>Get Opportunity Types</td><td><code>getOpportunityTypes</code></td><td>List every opportunity type on the account with its numeric EventCode. The EventCode is required by Capture Opportunity and Search Opportunities.</td></tr><tr><td>Get Sales Groups</td><td><code>getSalesGroups</code></td><td>List the sales groups (user groups) on the account with their ids, descriptions and member counts. Supply a UserId to return only the groups that user belongs to.</td></tr><tr><td>Get Sent Emails</td><td><code>getSentEmails</code></td><td>Retrieve individual email events in a date range - sends, opens, clicks, unsubscribes, resubscribes and view-in-browser clicks - each linked to the lead it concerned. Paged with PageIndex and PageSize.</td></tr><tr><td>Get Task by Id</td><td><code>getTaskById</code></td><td>Retrieve one task by its UserTaskId, including status, owner, reminder and the related lead or opportunity. LeadSquared returns a bare array with at most one task.</td></tr><tr><td>Get Task Types</td><td><code>getTaskTypes</code></td><td>List the task types configured on the account, with their ids, category (0 appointment, 1 to-do) and column configuration. Supply the Name to Create Task and the Id to Search Tasks. Results can be filtered with a ColumnName and ColumnValue pair.</td></tr><tr><td>Get Tasks by Lead Id</td><td><code>getTasksByLeadId</code></td><td>List every task attached to a lead, with owner, due date, status and reminder. Note this endpoint lives under LeadManagement.svc rather than Task.svc.</td></tr><tr><td>Get User by Email Address</td><td><code>getUserByEmail</code></td><td>Retrieve a user by email address, including role, phone numbers, time zone and org id. Returns an empty array if the user is inactive or does not exist.</td></tr><tr><td>Get User by Id</td><td><code>getUserById</code></td><td>Retrieve one user by UserId, including role, manager, designation, department and current check-in and availability status. Returns an empty array if the user is inactive or does not exist.</td></tr><tr><td>Get Users</td><td><code>getUsers</code></td><td>List every user on the LeadSquared account with id, name, email, role and group membership. StatusCode 0 means active and 1 means inactive. This action takes no inputs, so it doubles as a cheap connection check.</td></tr><tr><td>List Webhooks</td><td><code>listWebhooks</code></td><td>List the webhooks registered on the account, paged and filterable. Note the asymmetry: Create Webhook takes a NUMERIC event code while this endpoint filters on the STRING event code (for example Lead_Post_Create) and returns both EventName and EventCode in string form.</td></tr><tr><td>Mark Task Complete</td><td><code>markTaskComplete</code></td><td>Mark a task as complete by its id. LeadSquared exposes this as a GET. Returns the number of rows affected.</td></tr><tr><td>Quick Search Leads</td><td><code>quickSearchLeads</code></td><td>Search leads the same way the LeadSquared web app's Quick Search box does. The key is matched across FirstName, LastName, EmailAddress, Phone, Mobile, Company, City and Country. Returns a bare array of matching leads.</td></tr><tr><td>Remove Lead from Static List</td><td><code>removeLeadFromStaticList</code></td><td>Remove a single lead from a static list. LeadSquared exposes this as a GET and it removes exactly one lead per call - there is no bulk form. Note the parameter casing: ListId and LeadID.</td></tr><tr><td>Search Leads by Criteria</td><td><code>searchLeadsByCriteria</code></td><td>Search leads with an explicit field comparison: a lead field name, a value, and a SQL operator. Choose which columns come back with a CSV list, and page through results. Returns a bare array of lead objects containing only the requested columns.</td></tr><tr><td>Search Opportunities</td><td><code>searchOpportunities</code></td><td>Advanced search across opportunities of one type. The advancedSearch input is LeadSquared's serialised condition JSON, passed as a string. Paged with PageIndex and PageSize.</td></tr><tr><td>Search Tasks</td><td><code>searchTasks</code></td><td>Search tasks by owner, date window, status and task type. Pages with Offset and RowCount. StatusCode 0 is pending and 1 is complete. TypeName takes a task type id from Get Task Types.</td></tr><tr><td>Send Email Campaign to List</td><td><code>sendEmailCampaignToList</code></td><td>Send an email campaign built from a saved template to every lead on a list. Returns the campaign id, the list's member count and how many recipients actually qualified. Campaign reports become available about 20 minutes after sending.</td></tr><tr><td>Send Email to Lead</td><td><code>sendEmailToLead</code></td><td>Send a one-off email to a single lead, either from inline HTML or from a saved email template. Set schedule to a future timestamp to queue it, or leave it empty to send immediately. Returns the email's id and recipient count.</td></tr><tr><td>Update Activity</td><td><code>updateActivity</code></td><td>Update an existing custom activity by its ProspectActivityId. Only the custom fields listed in Fields are written; pass an empty Value to clear one. The activity's own type code must be repeated in ActivityEvent.</td></tr><tr><td>Update Lead</td><td><code>updateLead</code></td><td>Update an existing lead identified by its ProspectID. Only the attributes present in the body are written; every other field on the lead is left untouched. Returns the number of rows affected.</td></tr><tr><td>Update Opportunity</td><td><code>updateOpportunity</code></td><td>Update an existing opportunity by its id. Only the fields listed in fields are written. Use this to move an opportunity's Status, change its value, or set custom fields. Returns the opportunity id.</td></tr><tr><td>Update Task</td><td><code>updateTask</code></td><td>Update an existing task by its UserTaskId - rename it, change its description, due date, reminder, owner, or which lead or opportunity it hangs off. Returns the number of rows affected and the task's auto id.</td></tr><tr><td>Update Webhook</td><td><code>updateWebhook</code></td><td>Update a registered webhook by its WebhookId - change its destination URL, event, content type or custom headers. WebhookId is mandatory.</td></tr></tbody></table>

</details>

## Events

Start a workflow when one of these happens, with an [app event trigger](https://docs.fastn.ai/build/integrations/triggers.md).

<table><thead><tr><th width="240">Event</th><th width="260">Id</th><th>When it fires</th></tr></thead><tbody><tr><td>Landing Page Submitted</td><td><code>1</code></td><td>Fires when a LeadSquared landing page form is submitted. Event code 1. Set Is Specific Landing Page on the registration to restrict it to named pages. Schema derived from the published Lead Created sample, which is the entity the submission produces.</td></tr><tr><td>Lead Activity Created</td><td><code>2</code></td><td>Fires when an activity is posted on a lead. Event code 2. Payload schema is LeadSquared's published sample for this event; custom activity fields appear as additional mx_ keys.</td></tr><tr><td>Lead Activity Updated</td><td><code>15</code></td><td>Fires when an existing lead activity is edited. Event code 15. Schema derived from the published Lead Activity Created sample.</td></tr><tr><td>Lead Created</td><td><code>3</code></td><td>Fires when a lead is created. Event code 3 (Lead_Post_Create). Payload schema is LeadSquared's published sample for this event.</td></tr><tr><td>Lead Field Updated</td><td><code>26</code></td><td>Fires when a specific watched lead field changes. Event code 26. Same Before/After envelope as Lead Updated, narrowed to the watched field. Schema derived from the published Lead Updated sample.</td></tr><tr><td>Lead Owner Changed</td><td><code>4</code></td><td>Fires when a lead is reassigned to a different user. Event code 4. Before/After envelope carrying the owner. Schema derived from the published Lead Stage Changed sample, which uses the same envelope.</td></tr><tr><td>Lead Score Changed</td><td><code>9</code></td><td>Fires when a lead's score changes. Event code 9. Before/After envelope carrying the score. Schema derived from the published Lead Stage Changed sample, which uses the same envelope.</td></tr><tr><td>Lead Stage Changed</td><td><code>5</code></td><td>Fires when a lead moves between stages. Event code 5. Payload schema is LeadSquared's published sample for this event.</td></tr><tr><td>Lead Updated</td><td><code>6</code></td><td>Fires when any lead field changes. Event code 6. The body is a Before/After pair of partial lead objects containing only the changed fields. Payload schema is LeadSquared's published sample.</td></tr><tr><td>Opportunity Created</td><td><code>31</code></td><td>Fires when an opportunity is created. Event code 31. Payload schema is LeadSquared's published sample; opportunity custom fields appear as additional mx_ keys and ActivityEvent carries the opportunity type code.</td></tr></tbody></table>

<details>

<summary>View 8 more events</summary>

<table><thead><tr><th width="240">Event</th><th width="260">Id</th><th>When it fires</th></tr></thead><tbody><tr><td>Opportunity Deleted</td><td><code>35</code></td><td>Fires when an opportunity is deleted. Event code 35. Schema derived from the published Opportunity Created sample.</td></tr><tr><td>Opportunity Field Updated</td><td><code>33</code></td><td>Fires when a specific watched opportunity field changes. Event code 33. Schema derived from the published Opportunity Created sample.</td></tr><tr><td>Opportunity Stage Updated</td><td><code>34</code></td><td>Fires when an opportunity's Status or stage changes. Event code 34. Schema derived from the published Opportunity Created sample.</td></tr><tr><td>Opportunity Updated</td><td><code>32</code></td><td>Fires when an opportunity is edited. Event code 32. Schema derived from the published Opportunity Created sample.</td></tr><tr><td>Task Completed</td><td><code>16</code></td><td>Fires when a task is marked complete. Event code 16. Schema derived from the published Task Created sample.</td></tr><tr><td>Task Created</td><td><code>7</code></td><td>Fires when a task or appointment is created. Event code 7. Payload schema is LeadSquared's published sample for this event.</td></tr><tr><td>Task Reminder</td><td><code>8</code></td><td>Fires at a task's configured reminder time. Event code 8. Schema derived from the published Task Created sample.</td></tr><tr><td>Task Updated</td><td><code>17</code></td><td>Fires when a task is edited. Event code 17. Schema derived from the published Task Created sample.</td></tr></tbody></table>

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.fastn.ai/connectors/catalog/crm-sales/lead-squared.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
