HubSpot, the beastly sales and marketing software, is almost ubiquitous. For teams using it it houses a lot a of data: contact lists, marketing funnels and sales pipelines, blog posts, landing pages, emails, successful deals, and so on. While HubSpot would love for you to keep your data in their platform you might want to get it out and into your own SQL database. In this scenario you’re left with a number of questions.

  1. How can you export your HubSpot data with minimal hassle?
  2. Is there some way you can have the data pre-defined into SQL syntax including TABLE and INSERT statements so you don’t need to manually do it?
  3. Can you somehow set up an automated pipeline for all future data exports?

The answer to those questions lies with APIs.

Part one: HubSpot APIs

As you might expect from such a vast tool, there are quite a few different HubSpot APIs. In fact, there are 34 APIs in total. Each one corresponds to a different part of HubSpot. For example, the Contacts API deals with contact information stored in HubSpot. Whereas the Keywords API works with the SEO tools of HubSpot.

All HubSpot APIs are organised around REST and therefore export to JSON, so despite dealing with different data they have a common thread which makes your life easier.

There are too many individual APIs with in-depth instruction to list here, and you might only be concerned with a specific HubSpot API, so we won’t list specific instructions on how to use HubSpot’s APIs. Besides, HubSpot have already written excellent guides. What we’ll do is provide links to the relevant sections of HubSpot so you can easily navigate to the section you need and get on with exporting JSON, converting to SQL, and adding data to your database.

You’ll find the list of APIs and their corresponding documents listed on the left-hand side of the page on any of the above links. And HubSpot limits its API usage on a daily basis, so make sure you know the limits before getting frustrated by errors.

Once you’ve wrapped your head around your particular API(s), you’re ready for SQLizer!

Part two: SQLizer API

Once you’ve navigated through the HubSpot export process, the hard part’s over. Now you need to convert JSON to SQL. That’s where the SQLizer API comes in.

The Sqlizer API is a simple REST interface that gives you programmatic access to our file conversion algorithm. The processes of converting a file with the API follows four steps:

  1. Initiate the file conversion
  2. Upload your file
  3. Monitor the conversion progress
  4. Download your converted file

See full docs for more detail.

Step 1: Initiate the file conversion

A JSON to SQL file conversion can be initiated with a POST request to and later accessed and updated at the endpoint{ID}/.

If the request is successful the server will respond with a HTTP 200 code and a JSON representation of the file conversion. The ID field is especially important as it is used in the url of all future requests for this file conversion.

Step 2: Upload your file

Once you have a file ID you can begin uploading your file data by sending POST requests to{ID}/data/.

The Sqlizer API allows you to upload your data in a single request or multiple requests. The latter is achieved by splitting the file into parts and sending each individually. Most files can be uploaded in a single request but if your file is larger than 100Mb or you have an unreliable connection an upload in multiple parts is recommended.

Check out the full API documentation for in-depth details on single and multiple requests.

Step 3: Monitor the conversion progress

Once your file upload is finalised it will be placed in a queue for processing. You can check on its progress with a GET request to{ID}/.

curl \ -H "Authorization: Bearer {API-KEY}"

You can see sample responses in full API documentation.

Step 4: Download your converted file

Once the file conversion process is complete you can download the converted file from the url specified in the returned ResultUrl parameter.

🎊 Success! 🎉

Part three: SQL file into SQL database

Now all that’s left to do is simply import/upload your new SQL file into your database. Because SQLizer has pre-defined TABLE and INSERT statements this step is simply waiting for your file to import/upload.

Automate and be done with it

With this setup you could potentially automate the entire process of exporting HubSpot data and getting it into your own database. You can even set up a large-scale pipeline with the SQLizer API, converting files en-masse.

Happy automating!

SQLizer converts files into SQL databases. With an API to help automate conversion tasks, it’s one of the best ways to transfer data between databases. Convert a file now.