CData Python Connector for HubSpot

Build 25.0.9454

Leads

Retrieves all lead records from HubSpot for lead tracking and management.

Table Specific Information

In HubSpot, leads are contacts or companies that are potential customers.

SELECT

When selecting leads, they can be filtered by columns marked below as 'Filterable'. For those columns, the supported server-side operators are: =, !=, <, <=, >, >=, IN

Further filtering is available using AND and OR combinations. A maximum of 3 OR operators are supported server-side, with each of these operators supporting up to 3 AND operators inside of them. For example:

SELECT * FROM Leads;
SELECT * FROM Leads WHERE [Id] = '385815394826';
SELECT * FROM Leads WHERE [Workflow updated lifecycle stage of company] = true OR [Associated Company Domain] = 'http://HubTest.com';

In the below server-offloading examples, "{Column}" represents any column you'd like to filter and "{Value}" represents any value you want to filter it on:

SELECT * FROM Leads WHERE {Column} = {Value} AND {Column} < {Value} AND {Column} > {Value}
SELECT * FROM Leads WHERE {Column} != {Value} AND {Column} >= {Value} AND {Column} <= {Value}
SELECT * FROM Leads WHERE ({Column} = {Value} AND {Column} = {Value}) OR ({Column} != {Value} AND {Column} >= {Value})
SELECT * FROM Leads WHERE ({Column} != {Value} AND {Column} >= {Value} AND {Column} <= {Value}) OR ({Column} != {Value} AND {Column} >= {Value} AND {Column} <= {Value}) OR ({Column} != {Value} AND {Column} >= {Value} AND {Column} <= {Value})

INSERT

When creating Leads, either the 'Primary Associated Contact Object ID' column or the 'Primary Associated Company Object ID' column (these names can change based on UseDisplayNames and UseSimpleNames) must be specified in the INSERT statement, otherwise the query will fail. For example:

INSERT INTO Leads (`Lead Name`, `Primary Associated Contact Object ID`) VALUES ('Inserted Lead 1', 31501492998);
INSERT INTO Leads (`Lead Name`, `Primary Associated Company Object ID`) VALUES ('Inserted Lead 1', 21960329051);
INSERT INTO Leads (`Lead Name`, `Primary Associated Contact Object ID`, `Primary Associated Company Object ID`) VALUES ('Inserted Lead 1', 31501492998, 21960329051);

The same applies for bulk INSERTs:

INSERT INTO Leads#TEMP (`Lead Name`, `Primary Associated Contact Object ID`) VALUES ('Inserted Lead 1', 31501492998);
INSERT INTO Leads#TEMP (`Lead Name`, `Primary Associated Contact Object ID`) VALUES ('Inserted Lead 1', 31501492998);
INSERT INTO Leads#TEMP (`Lead Name`, `Primary Associated Contact Object ID`) VALUES ('Inserted Lead 1', 31501492998);
INSERT INTO Leads (`Lead Name`, `Primary Associated Contact Object ID`) SELECT * FROM Leads#TEMP;

UPDATE


UPDATE Leads SET [Business units] = '10' WHERE [Id] = '3917882265'
UPDATE Leads SET [Lead Disqualification Note] = 'testing note', [Disqualification Reason] = 'BAD_TIMING' WHERE [Id] = '386085073667'

DELETE


DELETE FROM Leads WHERE ID = '3917882265'

Columns

Name Type ReadOnly References Filterable Description
Id [KEY] Long True True

Unique identifier for the lead record.

Archived Bool True False

Indicates whether the lead record is archived.

CreatedAt Datetime True False

Timestamp when the lead record was initially created.

UpdatedAt Datetime True False

Timestamp when the lead record was most recently updated.

All teams String True True

Team IDs, including inherited teams in the hierarchy, associated with this lead's owner properties.

Business units String False True

Business units this lead is assigned to within HubSpot.

All owner ids String True True

All owner IDs, including custom and default owner assignments, linked to this lead.

All team ids String True True

Team IDs corresponding to all owner properties linked to this lead.

Associated Company Domain String True True

Domain name of the company associated with the lead, if available.

Associated Company Name String True True

Name of the company associated with the lead, if available.

Associated Contact Email String True True

Email address of the primary contact associated with the lead, if available.

Associated Contact First Name String True True

First name of the primary contact associated with the lead, if available.

Associated Contact Last Name String True True

Last name of the primary contact associated with the lead, if available.

Calls Connected Count Decimal True True

Total number of calls associated with the lead that were successfully connected.

Primary company analytics source String True True

Primary company's most recent analytics source at the time of lead association. Not updated after initial rollup.

Primary company analytics source first drilldown String True True

First-level drilldown of the primary company's analytics source when initially associated with the lead.

Primary company analytics source second drilldown String True True

Second-level drilldown of the primary company's analytics source when initially associated with the lead.

Company Avatar FileManager key String True True

FileManager path to the avatar override image for the associated company.

Is Target Account String True True

Indicates if the associated company is considered a target account in marketing or sales strategy.

Company Last Activity Date Datetime True True

Date of the most recent activity involving the lead's associated company.

Company Last Engagement Date Datetime True True

Date of the most recent contact engagement with the associated company, excluding marketing and bulk emails.

Company Last Engagement Type String True True

Type of the last engagement activity from the associated company, excluding marketing and bulk emails.

Company Time of Last Session Datetime True True

Timestamp of the last recorded web session for the associated company's contacts.

Company Next Activity Date Datetime True True

Date of the next scheduled activity associated with the lead's primary company.

Company Next Activity Type String True True

Type of the next scheduled activity associated with the lead's primary company.

Company Number of Pageviews Decimal True True

Total number of web pageviews from contacts associated with the lead's primary company.

Associated company timezone String True True

Time zone associated with the lead's primary company, if known.

Primary contact analytics source String True True

Most recent analytics source from the primary contact when initially associated with the lead.

Primary contact analytics source first drilldown String True True

First-level drilldown of the primary contact's analytics source at the time of lead association.

Primary contact analytics source second drilldown String True True

Second-level drilldown of the primary contact's analytics source at the time of lead association.

Contact Avatar FileManager key String True True

FileManager path to the avatar override image for the lead's primary contact.

Contact Buying Role String True True

Sales buying role of the lead's primary contact.

Associated contact job title String True True

Job title of the lead's primary contact, if available.

Contact Last Activity Date Datetime True True

Date of the most recent activity involving the lead's primary contact.

Contact Last Engagement Date Datetime True True

Date of the most recent engagement by the primary contact, excluding marketing and bulk emails.

Contact Last Engagement Type String True True

Type of the most recent engagement by the primary contact, excluding marketing and bulk emails.

Contact Time of Last Session Datetime True True

Timestamp for the start of the most recent web session by the lead's primary contact.

Contact Next Activity Date Datetime True True

Scheduled date of the next activity involving the lead's primary contact.

Contact Next Activity Type String True True

Type of the next scheduled activity involving the lead's primary contact.

Contact Number of Pageviews Decimal True True

Total number of pageviews recorded for the lead's primary contact.

Associated contact timezone String True True

Time zone of the associated contact, if available.

Created by user ID Decimal True True

User ID of the HubSpot user who created this lead. Automatically assigned.

Object create date/time Datetime True True

Date and time when this lead object was created. Automatically set by HubSpot.

Emails Connected Count Decimal True True

Number of email communications with this lead that were successfully connected.

Initial Assign Notification State String True True

Status of the initial lead assignment notification sent at creation.

Last Activity Date Datetime True True

Date of the most recent activity, prioritizing contact data first, then company data if contact is unavailable.

Last Engagement Date Datetime True True

Latest engagement date for the primary contact or, if absent, the associated company. Excludes marketing and mass emails.

Last Engagement Type String True True

Latest engagement type for the primary contact or, if absent, the associated company. Excludes marketing and mass emails.

Lead Time of Last Session Datetime True True

Timestamp for the latest session of the lead's contact or, if unavailable, the associated company.

Object last modified date/time Datetime True True

Timestamp of the most recent update to the lead object, including hidden internal properties. Set automatically by HubSpot.

Associated Deal Pipeline Stage String True True

Current pipeline stage of the primary associated deal.

Associated deals Decimal True True

Total number of deals associated with this lead.

Call Count Decimal True True

Total number of calls made to the lead.

Closed won deal amount Decimal True True

Aggregate value of all associated deals marked as closed-won.

Message Thread Count Decimal True True

Number of message threads (SMS, LinkedIn, WhatsApp) opened with this lead.

Currency String True True

Currency code used in the lead's most recent associated deal.

Lead Disqualification Note String False True

Free-text explanation provided when a lead is marked disqualified.

Disqualification Reason String False True

Standardized dropdown option selected when disqualifying a lead.

Email Count Decimal True True

Total number of emails sent to the lead.

First Outreach Date Datetime True True

Date of the first outreach attempt to the lead, including calls, emails, or meetings.

Lead Inferred Pseudostage String True True

Inferred stage of the lead based on user or system activity, not necessarily matching the formal pipeline stage.

Is Disqualified Decimal True True

Indicates whether the lead is disqualified (1) or not (0). Used for reporting.

In progress leads Decimal True True

Indicates whether the lead is actively in progress (1) or not (0). Used for reporting.

Is New Decimal True True

Indicates whether the lead is newly created (1) or not (0). Used for reporting.

Open leads Decimal True True

Indicates whether the lead is considered 'open' based on the pipeline stage not being qualified or unqualified.

Is Qualified Decimal True True

Indicates whether the lead is qualified (1) or not (0). Used for reporting.

Lead Label String False True

Current user-defined status label applied to the lead.

Meeting Count Decimal True True

Total number of meetings booked with this lead.

Lead Name String False True

Full name of the lead, as entered in the system.

Lead name calculated String True True

System-calculated full name of the lead, typically derived from associated contact data.

Outreach activity count Decimal True True

Cumulative number of outreach activities such as calls, emails, and meetings related to this lead.

Open deal amount Decimal True True

Total value of all open deals associated with this lead.

Primary Company Owner String True True

HubSpot owner ID of the lead's associated primary company.

Primary Contact Owner String True True

HubSpot owner ID of the lead's associated primary contact.

Lead Source String True True

Analytics source of the lead, based on the primary contact or company at the time of creation.

Initial company lifecycle stage String True True

Lifecycle stage detected on the lead's associated primary company at creation. Not updated thereafter.

Initial contact lifecycle stage String True True

Lifecycle stage detected on the lead's associated primary contact at creation. Not updated thereafter.

Lead Source DrillDown 1 String True True

Secondary level of detail for the lead's analytics source.

Lead Source DrillDown 2 String True True

Tertiary level of detail for the lead's analytics source.

Initial source lifecycle stage String True True

Lifecycle stage of the lead's source contact or company at time of lead creation.

Time to First Touch Decimal True True

Elapsed time in seconds between lead creation and the first outreach activity.

Lead Title (DEPRECATEDUse hsLeadName) String True True

Deprecated field for lead title. Use hsLeadName instead.

Lead Type String False True

Classification of the lead such as New Business, Existing Business, or Re-attempting.

Meetings Connected Count Decimal True True

Number of associated meetings that are considered to be connected or successful.

Merged record IDs String True True

Record IDs that were merged into this lead. Automatically assigned by HubSpot.

Next Activity Date Datetime True True

Date of the next scheduled activity related to this lead or its associated contact or company.

Next Activity Type String True True

Type of the next scheduled activity related to this lead or its associated contact or company.

Lead Number of Pageviews Decimal True True

Number of website pageviews from the associated contact, or the associated company if contact is not available.

Record ID Decimal True True

Unique record ID assigned to this lead. Automatically set by HubSpot.

Record Creation Source String True True

System source that created this lead, stored in the internal RequestMeta.

Record Source Detail 1 String True True

Primary level of detail on how this lead was created.

Record Source Detail 2 String True True

Secondary level of detail on how this lead was created.

Record Source Detail 3 String True True

Tertiary level of detail on how this lead was created.

Record Creation Source ID String True True

Source ID from the internal RequestMeta that created this lead.

Record Source String True True

Text description of how this lead record was created.

Record Creation Source User ID Decimal True True

User ID from the internal RequestMeta that created this lead.

Lead owner calculated String True True

Calculated owner of the lead, based on the primary contact if available or the company otherwise.

Lead Pipeline String False True

Name of the pipeline that this lead currently belongs to.

Lead Pipeline Stage String False True

Current stage of the lead within its assigned pipeline.

Pipeline Stage Category String True True

Category type for the current pipeline stage of the lead.

Pipeline Stage Category Last Updated At Datetime True True

Timestamp of the most recent change to the lead's pipeline stage category.

Primary Associated Object Name String True True

Name of the lead's primary associated contact or company.

Primary Associated Company Object ID Decimal False True

Object ID of the lead's primary associated company.

Primary contact enrolled in sequence Bool True True

Indicates if the primary contact for this lead is currently active in a sequence.

Primary Associated Contact Object ID Decimal False True

Object ID of the lead's primary associated contact.

Read Only Object Bool True True

Indicates whether the object is read-only and cannot be edited.

Shared Team IDs String True True

Team IDs of all teams granted shared access to this lead.

Shared User IDs String True True

User IDs of all users granted shared access to this lead.

Lead tags String True True

List of tag IDs applied to the lead. Automatically managed by HubSpot.

Time in Attempting (Lead Pipeline) Decimal True True

Total time in seconds spent by the lead in the 'Attempting' stage of the Lead pipeline.

Time in Connected (Lead Pipeline) Decimal True True

Total time in seconds spent by the lead in the 'Connected' stage of the Lead pipeline.

Time in New (Lead Pipeline) Decimal True True

Total time in seconds spent by the lead in the 'New' stage of the Lead pipeline.

Time in Qualified (Lead Pipeline) Decimal True True

Total time in seconds spent by the lead in the 'Qualified' stage of the Lead pipeline.

Time in Disqualified (Lead Pipeline) Decimal True True

Total time in seconds spent by the lead in the 'Disqualified' stage of the Lead pipeline.

Unique creation key String True True

Property used to uniquely identify and safely retry create operations without duplication.

Updated by user ID Decimal True True

User ID of the person who last updated the lead. Automatically assigned by HubSpot.

User IDs of all notification followers String True True

User IDs of all users subscribed to notifications for changes on this lead.

User IDs of all notification unfollowers String True True

User IDs of all users who have opted out of notifications for this lead.

User IDs of all owners String True True

User IDs of all users assigned ownership of this lead.

Cumulative time in Attempting (Lead pipeline) Decimal True True

Cumulative time in seconds the lead has spent in the 'Attempting' stage across all entries into that stage.

Cumulative time in Connected (Lead pipeline) Decimal True True

Cumulative time in seconds the lead has spent in the 'Connected' stage across all entries into that stage.

Cumulative time in New (Lead pipeline) Decimal True True

Cumulative time in seconds the lead has spent in the 'New' stage across all entries into that stage.

Cumulative time in Qualified (Lead pipeline) Decimal True True

Cumulative time in seconds the lead has spent in the 'Qualified' stage across all entries into that stage.

Cumulative time in Disqualified (Lead pipeline) Decimal True True

Cumulative time in seconds the lead has spent in the 'Disqualified' stage across all entries into that stage.

Date entered Attempting (Lead pipeline) Datetime True True

Date and time when the lead entered the 'Attempting' stage in the Lead pipeline.

Date entered Connected (Lead pipeline) Datetime True True

Date and time when the lead entered the 'Connected' stage in the Lead pipeline.

Date entered New (Lead pipeline) Datetime True True

Date and time when the lead entered the 'New' stage in the Lead pipeline.

Date entered Qualified (Lead pipeline) Datetime True True

Date and time when the lead entered the 'Qualified' stage in the Lead pipeline.

Date entered Disqualified (Lead pipeline) Datetime True True

Date and time when the lead entered the 'Disqualified' stage in the Lead pipeline.

Date exited Attempting (Lead pipeline) Datetime True True

Date and time when the lead exited the 'Attempting' stage in the Lead pipeline.

Date exited Connected (Lead pipeline) Datetime True True

Date and time when the lead exited the 'Connected' stage in the Lead pipeline.

Date exited New (Lead pipeline) Datetime True True

Date and time when the lead exited the 'New' stage in the Lead pipeline.

Date exited Qualified (Lead pipeline) Datetime True True

Date and time when the lead exited the 'Qualified' stage in the Lead pipeline.

Date exited Disqualified (Lead pipeline) Datetime True True

Date and time when the lead exited the 'Disqualified' stage in the Lead pipeline.

Latest time in Attempting (Lead pipeline) Decimal True True

Duration in seconds of the most recent time the lead spent in the 'Attempting' stage.

Latest time in Connected (Lead pipeline) Decimal True True

Duration in seconds of the most recent time the lead spent in the 'Connected' stage.

Latest time in New (Lead pipeline) Decimal True True

Duration in seconds of the most recent time the lead spent in the 'New' stage.

Latest time in Qualified (Lead pipeline) Decimal True True

Duration in seconds of the most recent time the lead spent in the 'Qualified' stage.

Latest time in Disqualified (Lead pipeline) Decimal True True

Duration in seconds of the most recent time the lead spent in the 'Disqualified' stage.

Performed in an import Bool True True

Indicates whether the lead was created or updated as part of a data import.

Workflow updated lifecycle stage of company Bool False True

Indicates whether a workflow was responsible for updating the lifecycle stage of the lead's associated company.

Workflow updated lifecycle stage of contact Bool False True

Indicates whether a workflow was responsible for updating the lifecycle stage of the lead's associated contact.

Owner Assigned Date Datetime True True

The timestamp when an owner was most recently assigned to the lead. Automatically set by HubSpot.

Lead Owner String False True

Owner of the lead. Defaults to the owner of the primary contact, or the primary company if the contact is not available.

HubSpot Team String True True

Primary team of the lead owner. Automatically assigned by HubSpot.

lead custom field String False True

Custom field associated with the lead. Purpose varies depending on configuration.

Copyright (c) 2025 CData Software, Inc. - All rights reserved.
Build 25.0.9454