---
title: "How to Fetch Open Tickets from the HubSpot API"
description: "Learn how to retrieve open tickets from the HubSpot API using CRM v3 endpoints. This guide covers prerequisites, endpoints, code examples, common pitfalls, and FAQs for reliable ticket data extraction."
source_url: "https://www.getknit.dev/blog/how-to-fetch-open-tickets-from-the-hubspot-api"
page_type: "blog"
---

_This is an educational blog post from Knit's blog: “How to Fetch Open Tickets from the HubSpot API”._

# How to Fetch Open Tickets from the HubSpot API

## Introduction

This article is part of a broader series that breaks down the [HubSpot API](https://www.getknit.dev/blog/hubspot-api-directory-oD0RSt) in a practical, use-case-driven way. The focus here is narrow and execution-oriented: **retrieving open support tickets from [HubSpot](https://md.getknit.dev/mcp-servers/hubspot-mcp-server)** using the CRM v3 APIs.

If you’re building customer support dashboards, syncing ticket data into a data warehouse, or powering automation around unresolved issues, open tickets are a foundational dataset. This guide walks through exactly how to fetch them.

If you’re looking for a deeper dive into CRM guides across authentication, rate limits, or other CRM objects, refer to the comprehensive [CRM API guide](https://www.getknit.dev/blog/full-list-of-knits-crm-api-guides).

### Prerequisites

Before you start, make sure the basics are in place:

*   A valid [HubSpot](https://md.getknit.dev/mcp-servers/hubspot-mcp-server) API Key **or** OAuth access token with the required CRM scopes
*   Access to a HubSpot account with ticket (CRM) permissions enabled
*   A Python environment with the `requests` library installed

Without the right scopes or permissions, ticket data will simply not resolve—no partial credit here.

### API Endpoints

You’ll be working with two primary endpoints:

*   **Retrieve all tickets**  
    `/crm/v3/objects/tickets`
*   **Retrieve ticket properties**  
    `/crm/v3/properties/tickets`

The first pulls ticket records; the second helps you identify which property represents ticket status or pipeline stage.

### 1\. Retrieve Ticket Properties

Start by fetching ticket properties. This allows you to confirm which field is used to represent ticket status (for example, `hs_pipeline_stage`).

```
import requests

url = "https://api.hubapi.com/crm/v3/properties/tickets"
headers = {
}

response = requests.get(url, headers=headers)
print(response.json())
```

This step is critical. Hard-coding assumptions about status fields is one of the fastest ways to ship a broken integration.

### 2\. Retrieve Open Tickets for All Customers

Once you’ve identified the correct status property, retrieve tickets and filter for open ones.

```
url = "https://api.hubapi.com/crm/v3/objects/tickets"
params = {
    "properties": "subject,hs_pipeline_stage",
    "limit": 100
}

response = requests.get(url, headers=headers, params=params)

open_tickets = [
    ticket for ticket in response.json()["results"]
    if ticket["properties"]["hs_pipeline_stage"] == "open"
]

print(open_tickets)
```

At scale, this pattern work —but only if you handle pagination and rate limits properly (more on that below).

### 3\. Retrieve Open Tickets for a Specific Customer

To pull open tickets for a single customer, you first need to fetch ticket associations for a given contact ID.

```
contact_id = "CONTACT_ID"
url = f"https://api.hubapi.com/crm/v3/objects/contacts/{contact_id}/associations/tickets"

response = requests.get(url, headers=headers)
ticket_ids = [
    assoc["id"] for assoc in response.json()["results"]
    if assoc["type"] == "ticket"
]
```

Then retrieve each ticket and filter for open status:

```
open_tickets_for_contact = []

for ticket_id in ticket_ids:
    url = f"https://api.hubapi.com/crm/v3/objects/tickets/{ticket_id}"
    response = requests.get(url, headers=headers)
    ticket = response.json()

    if ticket["properties"]["hs_pipeline_stage"] == "open":
        open_tickets_for_contact.append(ticket)

print(open_tickets_for_contact)
```

## Common Pitfalls

Most HubSpot ticket integrations fail for predictable reasons. Avoid these:

1.  **Missing or incorrect API scopes**  
    CRM access is mandatory; partial scopes won’t work.
2.  **Ignoring rate limits**  
    HubSpot enforces strict per-interval limits. Burst traffic will get throttled.
3.  **Hard-coding ticket status values**  
    Pipeline stages vary across accounts. Always confirm property values dynamically.
4.  **Not handling pagination**  
    The default limit caps results. Large ticket volumes require paging via the `after` parameter.
5.  **Using deprecated or outdated endpoints**  
    CRM v3 is the standard. Anything older is technical debt.
6.  **Assuming properties are always present**  
    Null or missing fields are common, defensive checks are non-negotiable.
7.  **Skipping error handling**  
    Silent failures lead to bad data downstream. Always inspect response codes.

## FAQs

**Q: How do I authenticate with the HubSpot API?**  
A: Use either an API key or an OAuth access token with the required CRM scopes.

**Q: What are the HubSpot API rate limits?**  
A: HubSpot allows 100 requests per 10 seconds per app by default.

**Q: How do I paginate through large ticket datasets?**  
A: Use the `after` parameter returned in the response to fetch the next page of results.

**Q: How do I identify the correct ticket status property?**  
A: Call the ticket properties endpoint and inspect the available fields and enums.

**Q: Can I filter tickets using custom properties?**  
A: Yes. Custom properties can be requested and filtered like standard properties.

**Q: What’s the best way to handle API errors?**  
A: Check HTTP status codes and log error payloads. Retry selectively, not blindly.

**Q: Can I retrieve historical changes to ticket properties?**  
A: Yes. Use the `propertiesWithHistory` parameter when retrieving ticket objects.

## Knit for HubSpot API Integration

If you want to skip the overhead of building and maintaining a direct HubSpot integration, Knit provides a faster path. With a single integration, Knit handles authentication, authorization, pagination, and long-term maintenance for the [HubSpot API.](https://www.getknit.dev/integration/hubspot)


## Related pages

- [How Knit works](https://md.getknit.dev/how-knit-works)
- [Unified API product](https://md.getknit.dev/products/unified-api)
