Use API to find open or new tickets - doesn't find the right tickets for me


Used Zammad version: 4.1.x
Installation method (source, package, …): apt Installation
Operating system: Ubuntu 18.04.6 LTS
Database + version: PostgreSQL 10.18
Elasticsearch version: 7.14.2
Expected behavior:

When using API to retrieve tickets, it would give me tickets list in JSON format with all open or new tickets
Actual behavior:

It shows only three tickets, which are closed
With …/search?query=state_id%3A1%20OR%20state_id%3A2 I get this output: “tickets”:[61,60,12],“tickets_count”:3 …}

In the web I see this:

If I search for the mentioned tickets above, the ticket status is 4 = closed:
{“id”:60,“group_id”:1,“priority_id”:2,“state_id”:4, … }

If I search an open ticket like 88 then I get the right output: {“id”:88,“group_id”:1,“priority_id”:2,“state_id”:2," … }

Steps to reproduce the behavior:

see “Actual behavior” section.
Yes I’m sure this is a bug and no feature request or a general question.

Would be great If someone can help me here!

Greets from Germany

Hi @idominiki

Try putting a space between: and your value.




Hi Gijs,

thanks for your answer! If I curl

I get the error “no matches found” :disappointed_relieved:


Hi @idominiki

I have tried both queries and both work for me:

GET /api/v1/tickets/search?

GET /api/v1/tickets/search?


Keep in mind that ID for e.g. states may differ from system to system.
You’ll want to check which IDs are correct in your specific system.

1 Like

Hi @ecomsilio,

thanks again for your help. With


the request works, but I only get the mentioned three tickets, not all five tickets.


@MrGeneration thanks for the info, but we use the standard ticket states

[{"id":1,"state_type_id":1,"name":"new","next_state_id":null,"ignore_escalation":false,"default_create":true,"default_follow_up":false,"note":null,"active":true,"updated_by_id":1,"created_by_id":1,"created_at":"2020-08-15T13:46:30.039Z","updated_at":"2020-08-15T13:46:30.054Z"},{"id":2,"state_type_id":2,"name":"open","next_state_id":null,"ignore_escalation":false,"default_create":false,"default_follow_up":true,"note":null,"active":true,"updated_by_id":1,"created_by_id":1,"created_at":"2020-08-15T13:46:30.051Z","updated_at":"2020-08-15T13:46:30.051Z"},{"id":3,"state_type_id":3,"name":"pending reminder","next_state_id":null,"ignore_escalation":true,"default_create":false,"default_follow_up":false,"note":null,"active":true,"updated_by_id":1,"created_by_id":1,"created_at":"2020-08-15T13:46:30.069Z","updated_at":"2020-08-15T13:46:30.069Z"},{"id":4,"state_type_id":5,"name":"closed","next_state_id":null,"ignore_escalation":true,"default_create":false,"default_follow_up":false,"note":null,"active":true,"updated_by_id":1,"created_by_id":1,"created_at":"2020-08-15T13:46:30.074Z","updated_at":"2020-08-15T13:46:30.074Z"},{"id":5,"state_type_id":6,"name":"merged","next_state_id":null,"ignore_escalation":true,"default_create":false,"default_follow_up":false,"note":null,"active":true,"updated_by_id":1,"created_by_id":1,"created_at":"2020-08-15T13:46:30.087Z","updated_at":"2020-08-15T13:46:30.087Z"},{"id":6,"state_type_id":7,"name":"removed","next_state_id":null,"ignore_escalation":true,"default_create":false,"default_follow_up":false,"note":null,"active":false,"updated_by_id":1,"created_by_id":1,"created_at":"2020-08-15T13:46:30.093Z","updated_at":"2020-08-15T13:46:30.093Z"},{"id":7,"state_type_id":4,"name":"pending close","next_state_id":4,"ignore_escalation":true,"default_create":false,"default_follow_up":false,"note":null,"active":true,"updated_by_id":1,"created_by_id":1,"created_at":"2020-08-15T13:46:30.108Z","updated_at":"2020-08-15T13:46:30.108Z"}]

Any other thoughts on this problem?

Thanks and Greets

Hi @idominiki

You might want to check your setting at “settings > overview” to see which status is selected for the view open/offen.

In my case (and I think it is the standard setting) the overview open does not only show new and open tickets but also pending tickets.

So you will need 3 instead of 2 status in your GET request.


Hi @ecomsilio

I checked the attributes for the open overview. Here are new and open selected.

Also If I’m search for three ticket attributes, I only get the three mentioned tickets.



Hi @idominiki

See if you can scroll. Usually you should see 6 states.

Also you are using “state:” and “state_id:”. I am not completely sure if this will work. Try “” and “”


Hi @ecomsilio,

you’re right, There is also the option pending reminder checked.

If I filter by


I got the following output:


If I filter by state_id


I got the same three tickets.


I don’t know where the issue is.

Thanks again for your support.


Ok, in that case I can’t help you. I can’t look into your Zammad installation and I am not a developer. Maybe @MrGeneration can help.


That’s correct because it’s not available in that context.

This would be a correct search if you must - you could also use (see: Advanced Search — Zammad User Documentation documentation )

So if your overview shows the correct number of tickets but your API search not (expecting you’re using eithert the exact same group permissions or the same user to do so!) then I’d guess your searchindex is off for whatever reason.

You could cross check that by running the exact same search within Zammads UI.
It has to return the same number of tickets.

1 Like

Hi @MrGeneration

Thanks for your answer. The Update to Zammad v5 fixes all problems for me.


1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.