# API query to get open tickets

**URL:** <https://community.hubspot.com/t/api-query-to-get-open-tickets/79045>\
**Category:** APIs & Integrations\
**Tags:** timeline-and-extensions-apis\
**Created:** [April 11, 2023, 9:55am UTC](https://community.hubspot.com/t/api-query-to-get-open-tickets/79045 "2023-04-11T09:55:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![RyanClark](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ryanclark/32/62359_2.png) [@RyanClark](https://community.hubspot.com/u/RyanClark)\
**Post date:** [April 11, 2023, 9:55am UTC](https://community.hubspot.com/t/api-query-to-get-open-tickets/79045/1 "2023-04-11T09:55:27Z")

</div>

I am looking to use MS Flow to get a count of the open tickets from each pipeline every day. We already have Flow connected and running some tasks, but the query to get open tickets from a pipeline is more complex that I would have hoped. Does anyone have an example of how I would submit the request to get the open tickets by Flow?

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [April 11, 2023, 9:06pm UTC](https://community.hubspot.com/t/api-query-to-get-open-tickets/79045/2 "2023-04-11T21:06:20Z")

</div>

Hey, @RyanClark 👋 Thanks for reaching out. I do not have an MS Flow-specific example. I can provide an example of how to structure a similar request using the Search API.

We’ll also leave this open in case there are community members who have the app-specific steps you are looking for.

Best,

Jaycee

---

<div class="post-metadata">

**Author:** ![RyanClark](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ryanclark/32/62359_2.png) [@RyanClark](https://community.hubspot.com/u/RyanClark)\
**Post date:** [April 13, 2023, 9:13am UTC](https://community.hubspot.com/t/api-query-to-get-open-tickets/79045/3 "2023-04-13T09:13:37Z")

</div>

Hi, it doesn’t have to be Flow specific, but if someone can put an example together in cURL I can probably adapt that.

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [April 13, 2023, 11:00pm UTC](https://community.hubspot.com/t/api-query-to-get-open-tickets/79045/4 "2023-04-13T23:00:52Z")

</div>

Hey, @RyanClark 👋 Here’s my example using Postman:

I have a pipeline with open tickets

 ![CleanShot 2023-04-13 at 16.58.55.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/0/b/0b7ec15156f58a2b68cf55387530e1eaa439024b.png)

Request

`POST https://api.hubapi.com/crm/v3/objects/tickets/search`

Body

```lia-code-sample
{
 "filterGroups": [
 {
 "filters": [
 {
 "propertyName": "hs_pipeline",
 "operator": "EQ",
 "value": "19625033"
 },
 {
 "propertyName": "hs_pipeline_stage",
 "operator": "NEQ",
 "value": "47925265"
 }
 ]
 }
 ]
}

```

Response

```lia-code-sample
{
 "total": 3,
 "results": [
 {
 "id": "1500746054",
 "properties": {
 "content": null,
 "createdate": "2023-03-16T15:48:45.014Z",
 "hs_lastmodifieddate": "2023-03-16T15:48:46.290Z",
 "hs_object_id": "1500746054",
 "hs_pipeline": "19625033",
 "hs_pipeline_stage": "47925262",
 "hs_ticket_category": null,
 "hs_ticket_priority": null,
 "subject": "Testerr 1"
 },
 "createdAt": "2023-03-16T15:48:45.014Z",
 "updatedAt": "2023-03-16T15:48:46.290Z",
 "archived": false
 },
 {
 "id": "1500746070",
 "properties": {
 "content": null,
 "createdate": "2023-03-16T15:49:04.683Z",
 "hs_lastmodifieddate": "2023-03-16T15:49:06.041Z",
 "hs_object_id": "1500746070",
 "hs_pipeline": "19625033",
 "hs_pipeline_stage": "47925262",
 "hs_ticket_category": null,
 "hs_ticket_priority": null,
 "subject": "Testerr 2"
 },
 "createdAt": "2023-03-16T15:49:04.683Z",
 "updatedAt": "2023-03-16T15:49:06.041Z",
 "archived": false
 },
 {
 "id": "1503346867",
 "properties": {
 "content": null,
 "createdate": "2023-03-17T22:27:14.029Z",
 "hs_lastmodifieddate": "2023-03-17T22:27:14.967Z",
 "hs_object_id": "1503346867",
 "hs_pipeline": "19625033",
 "hs_pipeline_stage": "47925262",
 "hs_ticket_category": null,
 "hs_ticket_priority": "HIGH",
 "subject": "Cats and ninjas"
 },
 "createdAt": "2023-03-17T22:27:14.029Z",
 "updatedAt": "2023-03-17T22:27:14.967Z",
 "archived": false
 }
 ]
}

```

My underlying thinking:

- we can do this _per_ pipeline
- our request will look for all tickets that are **not** Closed
- you could also filter by thinking of it the other way around, i.e. use all stages _except_ Closed. Whatever meets your needs.

Have fun building! — Jaycee

---

<div class="post-metadata">

**Author:** ![RyanClark](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ryanclark/32/62359_2.png) [@RyanClark](https://community.hubspot.com/u/RyanClark)\
**Post date:** [April 19, 2023, 11:47am UTC](https://community.hubspot.com/t/api-query-to-get-open-tickets/79045/5 "2023-04-19T11:47:51Z")

</div>

Hi, thanks very much for this. I have managed to get it into Flow and it is working. The only issue I have is that we have a pipeline with 3 closed states. If I try the query to search on that pipeline and exclude those 3 states. I get this error. Is there a way round that?

Invalid input JSON on line 1, column 299: too many filters per filterGroup (count: 4, max allowed: 3)

One last thing, can I also search on dates like ‘Today’ or ‘Yesterday’ as I can with ticket views?
