Querying Hubspot

Learn how to query Hubspot data from Pocus

Pocus pulls data directly in from the Hubspot API. In practice, this involves writing JSON requests in the shape outlined by their API documentation. Don’t get scared!! We’ll share the most common patterns.

Getting data from Hubspot

  1. Determine what Hubspot object you want to pull data from (e.g., deals, companies, contacts), and replace the string after “name” with that object. In the example above, we are pulling from companies
  2. Determine the API name of the fields you are trying to pull in. Add these API names in quotes to the properties array with commas to separate them (e.g., “any_other_notes”). You can always add to this list.
{
  "name": "companies",
  "type": "object",
  "searchParams": {
    "properties": [
      "field1",
      "field2",
      "any_other_notes",
      "title",
      "last_marketing_touch_date",
      "hubspot_owner_id",
      "pql"
    ]
  }
📘

Note:

By default Pocus pulls in the hs_object_id, hubspot_owner_id, and hubspot_owner_email for every record

Filtering for a specific record

If you need to query for a specific record or filter down, update the type from "object" to "search" and add a "filterGroups" parameter to the query. This example is searching for a record whose hs_object_id equals the value ####. Learn more about the filtering language in the Hubspot API Documentation.

{
  "name": "companies",
  "type": "search",
  "searchParams": {
    "properties": [
      "fieldname1",
			"fieldname2"
    ],
    "filterGroups":[
      {
        "filters":[
          {
            "propertyName": "hs_object_id",
            "operator": "EQ",
            "value": "#######"
          }
        ]
      }
    ]
  }
}
🚧

Volume limits

There are volume limits on how much data can be pulled from the Hubspot API. If you have > 1M contacts in your CRM, please reach out to your Pocus support team for additional solutions.

If using the type "search" to query Hubspot, please note that Hubspot limits the search endpoints to 10,000 total results for any given query. See Hubspot Search API documentation for full details.