Skip to content

Export HubSpot data to PostgreSQL or MySQL

Last updated: October 7, 2026

Available with any of the following subscriptions, except where noted:

Please note: if you're a Super Admin, opt your account into the Data Studio beta to use this feature.

HubSpot Credits required for certain features syncing data directly from a single warehouse source in Data Studio to the HubSpot CRM doesn't consume HubSpot Credits. If you prepare the data in Data Studio before syncing (for example, by creating calculated fields or joining it with other data sources), those actions consume HubSpot Credits.



Summary

Use Data Out to export selected HubSpot CRM data to a PostgreSQL or MySQL database that you manage. You can sync object, association, and event data to tables in your database, then query the data with SQL or use it with your business intelligence and analytics tools.

Each sync creates a full snapshot of the selected data. When a sync succeeds, it replaces the previous snapshot in the destination tables.

Before you get started

Understand requirements

  • Your PostgreSQL or MySQL database must be reachable from the HubSpot IP ranges for your account region.
  • Your database server must support SSL connections.
  • You must have a database user with the required permissions:
    • PostgreSQL: CREATE permission and write access to the target schema.
    • MySQL: CREATE permission on the database and write access.
  • Make sure your database user can create tables and write data.
  • Keep your HubSpot account and database consoles open in separate tabs.

Allow HubSpot IP addresses

Add the HubSpot IP range for your account region to your database server’s allowlist.

Region IP range
NA1 54.174.62.128/26
EU1 143.244.87.0/25
AP1 216.157.42.32/27
NA2 216.157.40.32/27
NA3 216.157.41.32/27

Understand limitations and considerations

  • Each sync run creates a full snapshot of the selected data.
  • A successful sync replaces the previous snapshot in the destination tables.
  • HubSpot doesn’t retain previous snapshots.
  • If a table fails during a sync, its previous data remains available until the next successful sync.
  • Each object type, event type, or association pair can be included in one recurring PostgreSQL sync and one recurring MySQL sync per account.
  • Each sync replaces the destination table. Table-level grants or settings added in your database provider aren’t preserved between syncs.
  • If you reconnect using a different database user, you must grant that user access to existing HubSpot-managed schemas, databases, or tables.

Connect HubSpot to PostgreSQL or MySQL

  1. In your HubSpot account, click More, then navigate to Data Management > Data Studio. If More doesn't appear in your account, navigate to Data Management > Data Studio directly.
  2. In the top right, click Connect external data source.
  3. In the Add a data source panel, search for or browse to the database provider.
  4. Click PostgreSQL or MySQL.
  5. Enter the database connection details:
    • Host
    • Port
    • SSL
    • Username
    • Password
  6. For PostgreSQL, enter the name of the database where HubSpot should create the schema.
  7. Click Connect to PostgreSQL or Connect to MySQL.

HubSpot uses the connected database user to create tables and load data into your database.

Configure the sync

  1. Select the data sources to export:
    • Objects
    • Associations
    • Events
  2. Select the objects, properties, associations, or events to include.
  3. Choose how often to run the sync and when to start it.
  4. Click Start sync.

The available sync frequencies may vary during the beta. Options can include once, every 6 hours, every 12 hours, daily, weekly, or monthly.

Access your exported data

HubSpot creates a HubSpot-managed schema or database for each destination.

PostgreSQL

PostgreSQL tables use the following format:

<database>.hubspot_data_out_<destination-id>.<table-name>

For example:

your_database.hubspot_data_out_456."OBJECT_WITH_OBJECT_PROPERTIES"
your_database.hubspot_data_out_456."EVENTS_VISITED_PAGE"
your_database.hubspot_data_out_456."ASSOCIATIONS_CONTACTS_TO_COMPANIES"

MySQL

MySQL tables use the following format:

hubspot_data_out_<destination-id>.<table-name>

For example:

hubspot_data_out_456.OBJECT_WITH_OBJECT_PROPERTIES
hubspot_data_out_456.EVENTS_VISITED_PAGE
hubspot_data_out_456.ASSOCIATIONS_CONTACTS_TO_COMPANIES

You can find the exact schema or database name on the sync configuration page.

Table and column names

Table and column names are based on the exported data. PostgreSQL identifiers can contain up to 63 characters. MySQL identifiers can contain up to 64 characters. Longer names are shortened to fit the applicable limit.

HubSpot creates PostgreSQL tables and columns with quoted, case-preserved names. When querying PostgreSQL, use double quotation marks and match the capitalization shown in the table name and column name.

For MySQL, use backticks and match the capitalization shown. Table-name case sensitivity can vary depending on your MySQL server configuration.

Column types

Exported type PostgreSQL MySQL
String TEXT LONGTEXT
Number, 32-bit INTEGER INT
Number, 64-bit BIGINT BIGINT
Timestamp TIMESTAMP DATETIME(6)
Boolean BOOLEAN TINYINT(1)
Decimal NUMERIC DECIMAL

The PROPERTIES column in the OBJECT_WITH_OBJECT_PROPERTIES table is stored as a JSON-formatted string. It’s stored as TEXT in PostgreSQL and LONGTEXT in MySQL, not as a native JSON column type.

Object tables

If you select object data, HubSpot exports the following tables.

OBJECT_PROPERTIES

This table contains one row for each object property value.

Column Type Description
OBJECTTYPEID String The ID of the object type. For example, contacts use 0-1.
OBJECTID Number The ID of the record.
NAME String The property name.
VALUE String The property value.
UPDATEDAT Timestamp The date and time when the property value was last updated in HubSpot.
INGESTEDAT Timestamp The date and time when the data was last ingested into the export source.

OBJECT_WITH_OBJECT_PROPERTIES

This table contains one row for each object record. Selected property values are grouped in the PROPERTIES column.

Column Type Description
OBJECTTYPEID String The ID of the object type. For example, contacts use 0-1.
OBJECTID Number The ID of the record.
PROPERTIES Text (JSON) The selected property values for the record, stored as a JSON-formatted string.
UPDATEDAT Timestamp The date and time when the record’s selected properties were last updated in HubSpot.
INGESTEDAT Timestamp The date and time when the data was last ingested into the export source.

Object data for different object types is combined in this table. Filter by OBJECTTYPEID to read records for a specific object type.

  • Contacts: 0-1
  • Custom objects: 2-{unique_id}, such as 2-12345

OBJECT_PROPERTIES_HISTORY

This table contains property change history. It includes one row for each historical value of a property.

Column Type Description
OBJECTTYPEID String The ID of the object type.
OBJECTID Number The ID of the record.
NAME String The property name.
VALUE String The property value at that point in time.
UPDATEDAT Timestamp The date and time when the value was set in HubSpot.
INGESTEDAT Timestamp The date and time when the data was last ingested into the export source.

To view the full history for a specific record and property, order the results by UPDATEDAT.

Association tables

If you select association data, HubSpot exports association records and association definitions.

ASSOCIATIONS

This table contains one row for each selected association between two records.

Column Type Description
COMBINEDASSOCIATIONTYPEID String The unique identifier for the association definition.
ASSOCIATIONCATEGORY String The origin of the association type. Values can include HUBSPOT_DEFINED, USER_DEFINED, or INTEGRATOR_DEFINED.
ASSOCIATIONTYPEID Number The identifier for the association definition within its category.
FROMOBJECTID Number The ID of the source record.
TOOBJECTID Number The ID of the destination record.
INGESTEDAT Timestamp The date and time when the data was last ingested into the export source.

ASSOCIATION_DEFINITIONS

This table contains one row for each selected association definition.

Column Type Description
COMBINEDASSOCIATIONTYPEID String The unique identifier for the association definition.
CATEGORY String The origin of the association type.
ID Number The identifier for the association definition within its category.
FROMOBJECTTYPEID String The ID of the source object type.
TOOBJECTTYPEID String The ID of the destination object type.
NAME String The association definition’s name.
LABEL String The association definition’s label.
INGESTEDAT Timestamp The date and time when the data was last ingested into the export source.
ISMAINASSOCIATIONDEFINITION Boolean Whether HubSpot displays this association definition as the primary association on associated records.

Pair-specific association tables

For selected association pairs, HubSpot can also export tables with the following format:

ASSOCIATIONS_<FROM_OBJECT_TYPE>_TO_<TO_OBJECT_TYPE>

For example:

ASSOCIATIONS_CONTACTS_TO_COMPANIES

These tables contain association records and association definition metadata.

Column Type Description
COMBINEDASSOCIATIONTYPEID String The unique identifier for the association definition.
ASSOCIATIONCATEGORY String The origin of the association type.
ASSOCIATIONTYPEID Number The identifier for the association definition within its category.
[FROMOBJECTTYPE]_OBJECTID Number The ID of the source record. For example, CONTACT_OBJECTID.
[TOOBJECTTYPE]_OBJECTID Number The ID of the destination record. For example, COMPANY_OBJECTID.
INGESTEDAT Timestamp The date and time when the data was last ingested into the export source.
TOOBJECTTYPEID String The ID of the destination object type.
FROMOBJECTTYPEID String The ID of the source object type.
NAME String The association definition’s name.
LABEL String The association definition’s label.
ISMAINASSOCIATIONDEFINITION Boolean Whether HubSpot displays this association definition as the primary association on associated records.

Event tables

If you select event data, HubSpot exports one table for each event type. Event table names use the following format:

EVENTS_<EVENT_NAME>

For example:

EVENTS_VISITED_PAGE

Each event table contains standard event columns and one column for each selected event property.

Column Type Description
EVENTTYPEID String The event type ID.
ID String The unique event ID.
OBJECTTYPEID String The ID of the object type associated with the event.
OBJECTID Number The ID of the record associated with the event.
INGESTEDAT Timestamp The date and time when the event was ingested into the export source.
OCCURREDATDATEINT Number The event date as an integer in YYYYMMDD format.
OCCURREDAT Timestamp The date and time when the event occurred.
PROPERTY_<PROPERTY_NAME> String A selected event property. For example, a property named page_title is exported as PROPERTY_PAGE_TITLE.

Monitor your sync

  1. In your HubSpot account, click More, then navigate to Data Management > Data Integration. If More doesn't appear in your account, navigate to Data Management > Data Integration directly.
  2. On the left, click App Syncs.
  3. Search for or select the PostgreSQL or MySQL sync.

From the sync details page, you can view the sync status, last sync time, errors, sync activity, and sync history. You can also pause, archive, or manually run the sync.

Sync statuses

Status Description
Syncing A sync run is currently in progress.
Synced The last sync run completed successfully.
Failed The last sync run encountered an error.
Archived The sync configuration was archived or removed.

Resolve sync failures

When a sync fails:

  • The HubSpot UI shows a Failed status and table-level details indicating which tables succeeded or failed.
  • A table is updated only after HubSpot finishes loading all of its data.
  • If a table fails, its previous data remains in place until the next successful sync.
  • The next scheduled sync automatically attempts the full sync again.
  • You can manually run a sync from the sync details page.

Tables that succeeded during an earlier run aren’t modified when a later run fails.

FAQs

How do I query the exported data?

Query the tables in the destination schema or database with SQL.

PostgreSQL

-- Read all contact records
SELECT *
FROM your_database.hubspot_data_out_456."OBJECT_WITH_OBJECT_PROPERTIES"
WHERE "OBJECTTYPEID" = '0-1';

-- Read a property from the PROPERTIES column
SELECT
  "OBJECTID",
  json_extract_path_text("PROPERTIES"::json, 'email') AS email
FROM your_database.hubspot_data_out_456."OBJECT_WITH_OBJECT_PROPERTIES"
WHERE "OBJECTTYPEID" = '0-1';

MySQL

-- Read all contact records
SELECT *
FROM `hubspot_data_out_456`.`OBJECT_WITH_OBJECT_PROPERTIES`
WHERE `OBJECTTYPEID` = '0-1';

-- Read a property from the PROPERTIES column
SELECT
  `OBJECTID`,
  JSON_EXTRACT(`PROPERTIES`, '$.email') AS email
FROM `hubspot_data_out_456`.`OBJECT_WITH_OBJECT_PROPERTIES`
WHERE `OBJECTTYPEID` = '0-1';

Can I export one data type in multiple syncs?

Each object type, event type, or association pair can be included in one recurring PostgreSQL sync and one recurring MySQL sync per HubSpot account.

For example, if contacts are already exported to a recurring PostgreSQL destination, you can’t add contacts to another recurring PostgreSQL configuration until you archive the first configuration. You can still export contacts to a recurring MySQL configuration at the same time.

Are object-specific tables supported?

Object-specific tables, such as OBJECTS_CONTACTS, aren’t currently supported. Use OBJECT_WITH_OBJECT_PROPERTIES and filter by OBJECTTYPEID to retrieve records for a specific object type.

Is Sensitive Data supported?

Sensitive Data isn’t currently supported for Data Out. Sensitive properties may be excluded from exports.

Does HubSpot keep previous snapshots?

No. Each successful sync replaces the destination table with the latest snapshot. HubSpot doesn’t retain previous snapshots.

If a table fails during a sync, its previous data remains in place until that table is successfully updated.

Does HubSpot use a staging bucket that I manage?

No. HubSpot exports the data as Parquet and manages staging internally. You don’t need to provide a customer-owned staging bucket for PostgreSQL or MySQL.

What happens if I change the database user?

If you reconnect using a different database user, you must grant the new user access to existing HubSpot-managed schemas, databases, or tables.

Was this article helpful?
This form is used for documentation feedback only. Learn how to get help with HubSpot.