Skip to main content

HubSpot Setup

Sync all your HubSpot CRM data to your database in real-time. Rapidly build your integration using SQL, ORMs, and the Sequin Proxy.

This guide walks you through setting up a real-time sync between HubSpot and your database using Sequin.

In just a couple of minutes, you'll configure and start your sync, query your HubSpot data, and complete your data integration by updating a HubSpot object using the Sequin Proxy.

Create a HubSpot sync

Connect HubSpot and your database to Sequin to start your sync.

Connect HubSpot to Postgres with Sequin

Step 1: If you don't have one already, create a new Sequin account at

Step 2: Select HubSpot as the platform you want to sync.

Step 3: Now connect your HubSpot instance to Sequin by selecting Add new API key, clicking Connect to HubSpot, and entering your HubSpot credentials in the authentication modal.

Authenticate with HubSpot

Step 4: Select the HubSpot objects you want to sync to your database. Sequin syncs standard objects, custom objects, and associations to tables in your database.

Authenticate with HubSpot

Step 5: By default, Sequin syncs all the standard and custom properties of each HubSpot object to columns in your database. You can choose which properties will sync to your database and edit the column name for each property by clicking the gear icon.

Authenticate with HubSpot

Step 6: Connect to the destination database you want to sync your HubSpot data to. We suggest you sync to a database you host by choosing the Connect option and following the steps to connect to your database. Or, if you want to get up and running quickly, click the Launch option to spin up a demo database we host for you (on Amazon RDS).

Authenticate with HubSpot

Step 7: Click Create.

After you click Create, Sequin will begin backfilling all your data. We'll show you the progress we're making in the console. Within a minute or two, you can begin exploring your schema and querying your data in SQL. We'll send you an email when your backfill is complete.

Authenticate with HubSpot

Query your HubSpot data using SQL

Connect to your database and start querying HubSpot using SQL. We'll use psql as an example in this setup guide, but you can use any SQL client that works with Postgres.

Step 1: Copy the psql command to connect to your database by clicking View database credentials.

Authenticate with HubSpot

Step 2: Open your terminal, and paste the psql command. Press Enter. This will open a connection to your database so you can write your first query:

psql -d {your_connection_string_here}
psql (14.2, server 12.11)
Type "help" for help.


Step 3: To get a sense of your schema, list all the tables you're syncing to your database by typing the command \dt:

db7hea89oah3tas=> \dt

List of relations
Schema | Name | Type | Owner
public | _sync_event | table | postgres
public | _sync_event_cursor | table | postgres
public | associations_company_deal | table | postgres
public | company | table | postgres
public | contact | table | postgres
public | deal | table | postgres
(6 rows)

You'll see all the HubSpot objects you selected when setting up your sync are now tables in your database. You'll also see two _sync tables which Sequin uses to manage your sync.

Step 4: Now, write your first query. You can start with a simple select to get your bearings:

db7hea89oah3tas=> select count(*) from contact;

(1 row)

Now, pull the contact id, firstname, and lastname for a specific customer to use in the next step:

db7hea89oah3tas=> select id, firstname, lastname from contact where email='';

id | firstname | lastname
1001 | Eric | Goldman
(1 row)

Great, you can now use this id in the last step of this setup guide.

Write to HubSpot using the Sequin Proxy

To create, update, or delete objects in HubSpot, you'll write to the HubSpot API through the Sequin Proxy.

When you write through the Sequin Proxy, both HubSpot and your database update simultaneously. Additionally, Sequin will queue and batch your calls automatically to ensure you never need to think about the HubSpot rate limit.

In this example, you'll update the contact in the prior step by giving them a new first and last name.

Step 1: Find your sync's unique Proxy base URL in the Sequin Console by clicking on the Proxy writes button on your sync card. Copy the proxy URL:

Find the Sequin HubSpot Proxy base URL

Step 2: With your proxy base URL in hand, you can now construct a cURL command to update the contact.

Open a new tab in your terminal so you can return to psql in the next step.

You'll structure the PATCH request exactly as you would if you were using the HubSpot API directly. The only difference is you'll prepend the base URL with the Sequin Proxy prefix:

curl --request PATCH \
--url '{{your_sync_id}}/{{contact_id_from_prior_step}}' \
--header 'content-type: application/json' \
--header 'Authorization: Bearer {{your_access_token}}' \
--data '{
"properties": {
"firstname": "Sequin",
"lastname": "Setup"


This call will update the first and last name of contact 1001. The response indicates that the update was successful!

Step 3: Now, confirm the change in your database. Go back to psql and check the contact you just updated:

db7hea89oah3tas=> select firstname, lastname from contact where id='1001';

firstname | lastname
Sequin | Setup
(1 row)

Great, HubSpot and your database were updated in real-time.

Next steps

HubSpot and your database are now syncing in real-time. You can query for all your data using SQL, and mutate data via the Sequin Proxy. To build on this foundation, here are some next steps:

  • Setup your ORM to work with your synced tables.
  • Edit the HubSpot objects and properties you're syncing at any time.
  • Create views on your HubSpot data to tailor your schema to your needs.
  • Invite your team to your Sequin account and start building!

If you need assistance setting up your sync, just send us a note. We're around and would and eager to help.