HubSpot Source
The HubSpot source syncs CRM objects, engagements, associations, owners and the legacy v1 email-event and form-submission APIs.
Installation
Section titled “Installation”The HubSpot source ships with the core package; no extra is needed.
pip install bizonQuick Start
Section titled “Quick Start”name: hubspot-pipeline
source: name: hubspot stream: contacts sync_mode: full_refresh authentication: type: api_key params: token: ${env://HUBSPOT_TOKEN}
destination: name: bigquery config: project_id: my-project dataset_id: crm gcs_buffer_bucket: my-bucketAvailable Streams
Section titled “Available Streams”bizon stream list hubspot| Stream | Sync modes | Notes |
|---|---|---|
contacts, companies, deals | full refresh, incremental | v3 list API. Incremental goes through the search API on the last-modified property (cursor_field overrides it) |
custom_object | full refresh, incremental | Same as above for the object set by object_type (e.g. 2-1234567) |
contacts_search, companies_search, deals_search | full refresh, incremental | Search API only, with start_date, page_size (max 200) and full_scan |
engagements_emails | full refresh, incremental | Search on hs_lastmodifieddate, plus associated contact/company/deal/ticket ids |
engagements_notes, engagements_calls, engagements_tasks, engagements_meetings | full refresh | Inline contact/company/deal associations, paged past HubSpot’s 100 per type |
line_items, deal_pipelines, properties_contacts, properties_companies, properties_deals | full refresh | |
owners | full refresh | Active then archived owners; the record id is <id>:<active|archived> |
archived_contacts, archived_deals, archived_companies | full refresh, incremental | Whole archived list filtered on archivedAt; use incremental to accumulate history |
association_deals, association_new_contacts | full refresh | v4 associations, one row per (id, associated id, association type) |
contacts_merged_audit | full refresh | Merged contacts with their v1 merge-audit trail |
email_events, form_submissions | full refresh, incremental | v1 APIs, re-reading the last 6 hours on each incremental run |
Search-based streams page by hs_object_id rather than the search after cursor, so they are not capped at HubSpot’s 10,000 search results. Their window ends at the job’s start time, so consecutive incremental runs tile.
Configuration
Section titled “Configuration”| Field | Default | Description |
|---|---|---|
properties.strategy | all | all fetches the whole property catalog; selected sends properties.selected_properties, which must exist |
properties.selected_properties | [] | Properties to fetch with strategy: selected |
start_date | unset | ISO-8601 lower bound for a full refresh or a first incremental run, on streams that take it (*_search, engagements_emails, archived_*, email_events, form_submissions). Unset fetches everything |
max_requests_per_second | unset | Client-side pacing across every call of a run (must be > 0). Set it when other clients share the app’s rate budget: search endpoints are rate limited per account and send no rate-limit headers |
object_type | - | Object type id for the custom_object stream |
associations_types | [] | Object types whose associated ids are inlined on contacts/companies/deals/custom_object records. Full refresh only |
page_size | 200 | Search page size on *_search streams (max 200) |
full_scan | false | On *_search streams, ignore the date window and re-fetch every record on every run |
http | 50 retries, backoff 1, (10, 60) timeout | HTTP policy. A partial block is merged over this default |
Authentication
Section titled “Authentication”HubSpot supports a private app token or OAuth.
Private app token:
source: name: hubspot stream: contacts authentication: type: api_key params: token: ${env://HUBSPOT_TOKEN}To get your token:
- Go to HubSpot Settings > Integrations > Private Apps
- Create a new private app
- Grant required scopes (crm.objects.contacts.read, etc.)
- Copy the access token
OAuth:
source: name: hubspot stream: contacts authentication: type: oauth params: token_refresh_endpoint: https://api.hubapi.com/oauth/v1/token client_id: ${env://HUBSPOT_CLIENT_ID} client_secret: ${env://HUBSPOT_CLIENT_SECRET} refresh_token: ${env://HUBSPOT_REFRESH_TOKEN}The access token is refreshed 120 seconds before it expires (set params.expiry_skew_seconds to change this). A request rejected with 401 EXPIRED_AUTHENTICATION mid-run forces a refresh and is replayed once.
Sync Modes
Section titled “Sync Modes”Full Refresh
Section titled “Full Refresh”Syncs all records from scratch:
source: name: hubspot stream: contacts sync_mode: full_refreshIncremental
Section titled “Incremental”Syncs records modified since the last successful run:
source: name: hubspot stream: contacts sync_mode: incrementalOn contacts, companies, deals and custom_object, an incremental run searches on the last-modified property (lastmodifieddate for contacts, hs_lastmodifieddate otherwise) from last_run minus a 5-minute overlap up to the job’s start time. Duplicates from the overlap share the record id. The first run fetches everything.
Example Configurations
Section titled “Example Configurations”Contacts to BigQuery
Section titled “Contacts to BigQuery”name: hubspot-contacts
source: name: hubspot stream: contacts sync_mode: incremental authentication: type: api_key params: token: ${env://HUBSPOT_TOKEN}
destination: name: bigquery config: project_id: my-project dataset_id: crm dataset_location: US gcs_buffer_bucket: my-staging-bucket unnest: true record_schemas: - destination_id: my-project.crm.contacts record_schema: - name: id type: STRING mode: REQUIRED - name: email type: STRING mode: NULLABLE - name: firstname type: STRING mode: NULLABLE - name: lastname type: STRING mode: NULLABLE - name: createdate type: TIMESTAMP mode: NULLABLE - name: lastmodifieddate type: TIMESTAMP mode: NULLABLEDeals via Search, Past the 10k Cap
Section titled “Deals via Search, Past the 10k Cap”name: hubspot-deals-search
source: name: hubspot stream: deals_search sync_mode: incremental start_date: "2025-01-01T00:00:00Z" max_requests_per_second: 5 authentication: type: oauth params: token_refresh_endpoint: https://api.hubapi.com/oauth/v1/token client_id: ${env://HUBSPOT_CLIENT_ID} client_secret: ${env://HUBSPOT_CLIENT_SECRET} refresh_token: ${env://HUBSPOT_REFRESH_TOKEN}
destination: name: bigquery config: project_id: my-project dataset_id: crm gcs_buffer_bucket: my-staging-bucketCustom Object
Section titled “Custom Object”source: name: hubspot stream: custom_object object_type: "2-1234567" # from GET /crm/v3/schemas associations_types: - companies - contacts authentication: type: api_key params: token: ${env://HUBSPOT_TOKEN}Multiple Objects
Section titled “Multiple Objects”Run separate pipelines for each stream:
bizon run contacts.ymlbizon run companies.ymlbizon run deals.ymlRate Limiting
Section titled “Rate Limiting”Retries on 429 and 5xx are handled by the session, using HubSpot’s default of 50 retries with a backoff factor of 1. Tune them with source.http:
source: name: hubspot stream: contacts max_requests_per_second: 5 http: retries: total: 20Data Structure
Section titled “Data Structure”HubSpot object records include:
| Field | Description |
|---|---|
id | HubSpot object ID |
properties | Object properties (email, name, etc.) |
createdAt | Record creation timestamp |
updatedAt | Last modification timestamp |
archived | Whether record is archived |
Transforms
Section titled “Transforms”Flatten HubSpot properties:
transforms: - label: flatten-properties python: | props = data.get('properties', {}) data = { 'id': data.get('id'), 'email': props.get('email'), 'firstname': props.get('firstname'), 'lastname': props.get('lastname'), 'company': props.get('company'), 'created_at': data.get('createdAt'), 'updated_at': data.get('updatedAt') }Next Steps
Section titled “Next Steps”- Sources Overview - Learn about source connectors
- Sync Modes - Understand incremental sync
- Authentication - Configure API keys and OAuth