Back

Hubspot Marketing Hub API Essential Guide

Aug 9, 20246 minute read

What type of API does Hubspot Marketing Hub provide?

REST API

HubSpot Marketing Hub primarily uses a REST API. This is evident from the following information:

  • All HubSpot APIs are built using REST conventions and designed to have a predictable URL structure.
  • They use standard HTTP features, including methods (POST, GET, PUT, DELETE) and error response codes.
  • All HubSpot API calls are made under https://api.hubapi.com and all responses return standard JSON.
  • The HubSpot API documentation explicitly states that "All of the HubSpot APIs are organized around REST".

Key Points to Consider

  • 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.
  • JSON is returned in all responses, including errors.

GraphQL Support

While REST is the primary API type, HubSpot also offers GraphQL support:

  • HubSpot provides GraphQL support for more flexibility in querying data.
  • GraphQL can reduce the number of API requests needed and allows developers to request specific data fields and nested data in a single query.
  • However, REST remains the primary API type for most HubSpot operations.

Best Practices

  • When integrating with HubSpot Marketing Hub, it's recommended to use the REST API for most operations.
  • For complex queries that would require multiple REST API calls, consider using the GraphQL API.
  • Always refer to the latest HubSpot API documentation, as they are continuously improving and updating their APIs.

In conclusion, while HubSpot Marketing Hub primarily uses a REST API, it also offers GraphQL support for more complex querying needs. The choice between REST and GraphQL would depend on the specific requirements of your integration.

Does the Hubspot Marketing Hub API have webhooks?

Webhook Support

Yes, the official HubSpot Marketing Hub API does support webhooks.

Types of Events

You can subscribe to the following types of events via webhooks:

  • CRM object events, including:
    • Contacts
    • Companies
    • Deals
    • Tickets
    • Products
    • Line items
  • Conversations events

Key Points

  • Webhooks are set up for a HubSpot app, not individual accounts. Any account that installs your app will be subscribed to its webhook subscriptions.

  • You need to set up a HubSpot app and specify a URL to receive webhook notifications.

  • The endpoint you specify must be publicly available, secure (HTTPS), and able to handle the webhook payloads.

  • Webhook payloads are sent as POST requests containing JSON formatted data.

  • HubSpot includes a signature header (X-HubSpot-Signature) to allow you to verify the requests are coming from HubSpot.

Webhook Payload Details

The webhook payloads include fields like:

  • objectId
  • propertyName (for property change events)
  • propertyValue (for property change events)
  • eventId
  • portalId (HubSpot account ID)
  • occurredAt timestamp
  • eventType
  • and more

Best Practices

  • Use webhooks instead of polling for more scalable integrations, especially for apps with many installs.

  • Validate the webhook signatures to ensure requests are coming from HubSpot.

  • Handle retries appropriately, as HubSpot will retry failed webhook deliveries.

In summary, HubSpot's Marketing Hub API provides robust webhook support for subscribing to various CRM and conversation events, allowing you to build real-time integrations with the platform.

Rate Limits and other limitations

Here are the key points about the API rate limits for the HubSpot Marketing Hub API:

  1. General rate limits:
  • Free & Starter tiers: 100 requests per 10 seconds, 250,000 requests per day
  • Professional & Enterprise tiers: 150 requests per 10 seconds, 500,000 requests per day
  • API add-on (any tier): 200 requests per 10 seconds, 1,000,000 requests per day
  1. OAuth apps:
  • Limited to 100 requests every 10 seconds per HubSpot account that installs the app
  • Not subject to the API add-on limits
  1. Private apps:
  • Subject to the general rate limits based on account tier
  • With API add-on: 200 requests per 10 seconds, 1,000,000 requests per day
  1. Search API:
  • Limited to 4 requests per second per authentication token
  1. Other limits:
  • Batch requests to CRM object endpoints are limited to 100 records per request
  • Daily limits reset at midnight based on the HubSpot account's time zone setting
  1. Error responses:
  • Exceeding rate limits results in a 429 error response
  • Requests resulting in error responses should not exceed 5% of total daily requests
  1. Rate limit headers:
  • API responses include headers with information on remaining limits and time windows

To work within these limits, developers are advised to:

  • Cache data for repeat calls
  • Use batch APIs when possible
  • Utilize smart lists and workflow starting conditions
  • Use webhooks to get updated data from HubSpot

These rate limits ensure fair usage of the HubSpot API while allowing for scalability based on account tiers and add-ons.

Latest API Version

Based on the search results provided, there is no specific mention of the most recent version number for the HubSpot Marketing Hub API. However, I can provide some key information about the current state of HubSpot's APIs:

  1. HubSpot launched the next generation of their API in early 2020 [1].

  2. The APIs are currently in a transition period, with some endpoints updated to the latest version while others are still using older versions [1].

  3. Not every endpoint or API has been updated to the latest version, and older endpoints are still stable and supported [1].

Key points to consider:

  • HubSpot strongly recommends upgrading integrations to the latest available version of each API for better consistency and additional functionality [1].

  • The updated APIs can be found on HubSpot's new API reference documentation [1].

  • All HubSpot APIs are built using REST conventions and are designed to have a predictable URL structure [2].

  • API calls to HubSpot should be made to the https://api.hubapi.com base domain [2].

Best practices:

  1. Check the API reference documentation for the most up-to-date information on specific endpoints.

  2. Use the latest available version of each API when building new integrations.

  3. Consider upgrading existing integrations to use the latest API versions where possible.

  4. Stay informed about API changes and updates by subscribing to the Changelog blog [2].

While there isn't a single "version number" for the entire Marketing Hub API, it's important to note that HubSpot is continuously updating and improving their APIs. Developers should refer to the official documentation for the most current information on specific endpoints and features they plan to use.

How to get a Hubspot Marketing Hub developer account and API Keys?

Here's how to get a developer account for HubSpot Marketing Hub to create an API integration:

Key Steps:

  1. Create an app developer account
  2. Set up a developer test account
  3. Create a new app and configure OAuth
  4. Start building your integration

Detailed Process:

  1. Create an app developer account:

    • Go to the HubSpot developers website (https://developers.hubspot.com/)
    • Click "Create a developer account"
    • Authenticate using your Google or Microsoft account, or enter your email
    • Follow the setup instructions to complete account creation
  2. Set up a developer test account:

    • Within your app developer account, you can create up to 10 developer test accounts
    • These test accounts allow you to test your app without affecting real HubSpot data
    • They provide a 90-day trial of many enterprise features
  3. Create a new app and configure OAuth:

    • In your app developer account, create a new app
    • Configure OAuth settings for your app
  4. Start building your integration:

    • Use the HubSpot APIs to build your integration
    • Refer to the API reference documentation for details on available endpoints

Key Points to Consider:

  • App developer accounts are free and intended for creating and managing apps, integrations, and developer test accounts
  • You can create public apps (for multiple HubSpot users) or private apps (for internal use within your organization)
  • HubSpot provides client libraries in various programming languages to help you interact with their APIs

What can you do with the Hubspot Marketing Hub API?

To answer your question about the data models you can interact with using the HubSpot Marketing Hub API, I'll provide a list of bullet points covering the key data models and what's possible for each. Here's an overview:

Contacts

  • Create, update, and delete contact records
  • Retrieve contact properties and property groups
  • Search for contacts based on various criteria
  • Manage contact lists and list memberships
  • Update contact properties in bulk
  • Merge duplicate contacts

Companies

  • Create, update, and delete company records
  • Retrieve company properties and property groups
  • Search for companies based on various criteria
  • Associate contacts with companies
  • Update company properties in bulk

Deals

  • Create, update, and delete deal records
  • Retrieve deal properties and property groups
  • Search for deals based on various criteria
  • Associate contacts and companies with deals
  • Update deal stages and pipelines
  • Manage deal pipelines and stages

Marketing Emails

  • Create and update marketing email content
  • Schedule and send marketing emails
  • Retrieve email performance metrics
  • Manage email templates
  • Access email subscription preferences

Forms

  • Create, update, and delete forms
  • Retrieve form submissions
  • Manage form fields and properties
  • Create and update form templates

Landing Pages

  • Create, update, and delete landing pages
  • Retrieve landing page performance metrics
  • Manage landing page templates
  • Publish and unpublish landing pages

Workflows

  • Create, update, and delete workflows
  • Enroll and unenroll contacts in workflows
  • Retrieve workflow performance metrics
  • Manage workflow actions and triggers

Lists

  • Create, update, and delete contact lists
  • Add and remove contacts from lists
  • Retrieve list membership information
  • Create dynamic and static lists

Blog Posts

  • Create, update, and delete blog posts
  • Manage blog authors and topics
  • Retrieve blog post performance metrics
  • Schedule blog post publications

Social Media

  • Create and schedule social media posts
  • Retrieve social media engagement metrics
  • Manage social media accounts and channels

Analytics

  • Retrieve website analytics data
  • Access marketing campaign performance metrics
  • Generate custom reports

Custom Objects

  • Create, update, and delete custom object records
  • Define custom object properties and associations
  • Search for custom object records

Events

  • Create and manage marketing events
  • Track event registrations and attendance
  • Retrieve event performance metrics

File Manager

  • Upload, update, and delete files
  • Organize files into folders
  • Retrieve file metadata and usage information

These bullet points cover the main data models and interactions possible with the HubSpot Marketing Hub API. Each of these models allows for various operations and data management tasks, enabling developers to integrate HubSpot's marketing functionality into their applications or automate marketing processes.