Back

HubSpot API Essential Guide

Jul 17, 20246 minute read

What type of API does HubSpot provide?

HubSpot provides two types of APIs:

REST API

  • HubSpot's primary API type is REST (Representational State Transfer).
  • The REST API allows interaction with various HubSpot resources like contacts, companies, and deals.
  • It uses standard HTTP methods (GET, POST, PUT, DELETE) for operations.

GraphQL API

  • HubSpot also offers GraphQL support.
  • GraphQL provides more flexibility in querying data and can reduce the number of API requests needed.
  • It allows developers to request specific data fields and nested data in a single query.

REST remains the primary API type for most HubSpot operations, while GraphQL is particularly useful for complex queries that would require multiple REST API calls.

Does the HubSpot API have webhooks?

Yes, the HubSpot API does have webhooks. Here are the key points about HubSpot's webhook functionality:

Webhook Availability

HubSpot offers webhooks through their Webhooks API, which is available for all subscription levels from free to enterprise.

Types of Events You Can Subscribe To

The Webhooks API allows you to subscribe to various events occurring within any portal with your application installed. These events include:

  • Contact creations, deletions, and property updates
  • Company creations, deletions, and property updates
  • Deal creations, deletions, and property updates

Key Considerations

  1. You can create up to 1,000 subscriptions per application.

  2. There are different ways to implement webhooks in HubSpot depending on your subscription level and specific needs:

    • Webhooks API (Free and up)
    • Workflow Extensions (Professional and up)
    • Webhook action via bots/workflows (Operations Hub Professional only)
  3. When using the Webhooks API, you subscribe by registering a URL in your app that can receive notifications when the specific events you're subscribed to occur.

Best Practices

  • Select a limited data set when determining which events you want to subscribe to. Subscribing to all events or property updates for all CRM objects can overwhelm your system with updates.

  • Consider using webhooks in conjunction with APIs for more efficient and robust connections between systems.

In summary, HubSpot's webhook functionality provides a powerful way to receive real-time notifications about changes in your HubSpot data, allowing for efficient integrations and automations across your tech stack.

Rate Limits and other limitations

The HubSpot API has several rate limits that developers need to be aware of:

Daily and Secondly Limits

  • There are both daily and secondly (per-second) rate limits.
  • The daily limit resets at midnight based on your time zone setting.
  • If you exceed the limits, you'll receive 429 error responses.

Rate Limit Headers

Each API response includes the following headers:

  • X-HubSpot-RateLimit-Daily: Number of API requests allowed per day
  • X-HubSpot-RateLimit-Daily-Remaining: Remaining API requests for the current day
  • X-HubSpot-RateLimit-Interval-Milliseconds: Time window for the secondly limit
  • X-HubSpot-RateLimit-Max: Number of requests allowed in the secondly window
  • X-HubSpot-RateLimit-Remaining: Remaining API requests for the secondly window

Specific Limits

  • The CRM Search API has a rate limit of 4 requests per second per authentication token.
  • The unauthenticated Form Submissions endpoint has a limit of 50 requests per 10 seconds.

Additional Protection

  • After hitting standard rate limits, if a system makes 10 requests resulting in 429 errors within a second, it will be blocked for one minute.
  • This additional protection is based on IP address, not HubId.

Burst Rate Limit

  • HubSpot has a burst rate limit ranging from 100 to 200 concurrent requests, depending on your plan.

Key Points to Consider

  1. Cache data for repeat calls to reduce API usage.
  2. Use batch APIs when possible to update multiple records in a single request.
  3. Utilize smart lists and workflow starting conditions to automate processes.
  4. Use webhooks to get updated data from HubSpot instead of frequent API calls.
  5. Consider splitting HubSpot widgets across multiple dashboards to avoid concurrent requests.

Best Practices

  1. Monitor your API usage regularly.
  2. Implement proper error handling for rate limit errors.
  3. Design your application to respect rate limits and implement backoff strategies.
  4. Optimize your API calls to minimize unnecessary requests.
  5. Consider upgrading your HubSpot plan if you consistently hit rate limits.

By understanding and working within these rate limits, developers can create more efficient and reliable integrations with the HubSpot API.

Latest API Version

Based on the search results provided, here are the key points regarding the most recent version of the HubSpot API:

  1. The most recent stable version of the HubSpot API is v3. This is evident from the discussion about migrating from v2 to v3 of the Owners API.

  2. HubSpot is actively encouraging users to migrate to v3 APIs. For example, they are sunsetting the v2 Owners API on August 30, 2024, and recommending users to migrate to the v3 Owners API.

  3. While some v1 APIs are still stable and in use, HubSpot recommends using the latest stable versions of their APIs for app certification.

  4. There are some differences between v1, v2, and v3 APIs:

    • Some capabilities present in v1 may not be directly available in v3.
    • The structure and endpoints of the APIs can differ between versions. For example, the v3 Owners API has some differences in field names and pagination compared to v2.
  5. For specific functionalities that may not have a direct equivalent in v3, HubSpot often provides alternative methods. For instance, to get a contact by email (which was available in v1), they recommend using the CRM API Search endpoint in v3.

  6. HubSpot maintains a list of deprecated APIs that developers should be aware of.

In summary, while v3 is the most recent stable version of the HubSpot API, some v1 and v2 endpoints may still be in use. However, HubSpot is actively encouraging migration to v3 for all functionalities and is sunsetting older versions of certain APIs.

How to get a HubSpot developer account and API Keys?

Create a HubSpot Developer Account

  1. Go to the HubSpot Developers website at https://developers.hubspot.com/

  2. Click on "Create a developer account"

  3. Fill out the registration form to create your free HubSpot developer account

Get API Keys

  1. Log into your developer account

  2. Go to the "Apps" section

  3. Click "Create app" to set up a new OAuth app

  4. Configure the app settings, including scopes and redirect URL

  5. Once created, you'll receive your Client ID and Client Secret, which serve as your API keys

  6. Use these credentials to authenticate and make API requests to HubSpot

What can you do with the HubSpot API?

Based on the search results provided, here is a list of data models you can interact with using the HubSpot API, along with what is possible for each:

Contacts

  • Store vital information such as names, email addresses, and phone numbers
  • Record interactions like website visits or engagement with marketing campaigns
  • Allow for personalized communication and segmentation for targeted marketing efforts

Companies

  • Represent business entities or organizations that a user's business interacts with
  • Link contacts to companies for a more comprehensive view of business relationships
  • Facilitate account-based marketing strategies

Deals

  • Track potential sales and revenue opportunities
  • Move through various stages of a sales pipeline
  • Enable effective sales pipeline management and forecasting

Tickets

  • Manage customer service inquiries and issues
  • Track and organize customer support requests
  • Enhance customer service efficiency and satisfaction

Engagements

  • Encompass all interactions between a business and its contacts
  • Include emails, meetings, phone calls, and other communication activities
  • Offer insights into communication patterns and customer engagement

Custom Objects

  • Create and manage custom objects to fit unique business needs
  • Associate custom objects with standard objects (like Contacts, Companies, and Deals)
  • Enhance the relational aspect of the database

Data Model Overview

  • Visualize and structure data within HubSpot
  • Display relationships between different CRM entities, including standard and custom objects
  • Provide insights into data usage, connections, and the overall customer journey

Key Points:

  • The HubSpot API allows interaction with these data models to streamline data management, enhance customer insights, and facilitate decision-making
  • The API enables customization and flexibility, allowing businesses to tailor the data model to their specific needs
  • Integration with other business tools is possible, enhancing data flow and operational efficiency
  • The Data Model Overview feature provides a visual representation of how data is organized and connected within HubSpot

By leveraging these data models through the HubSpot API, businesses can effectively manage their customer relationships, streamline their sales and marketing processes, and gain valuable insights from their data.