Delete closed ticket based on creation date

I am currently working on the creation of a custom app which has a feature to delete single tickets after a certain time, since ticket was created, and only for close tickets. I want somehow to include the following automation that I have in place into the custom app,

Now I are facing the issue that in the API documentation we only can filter tickets based on creation date, but we don’t know when the ticket was created so we can not setup a date to start checking and comparing. We want to have something similar as the automation. Which API request should we use?

Hi Sara,

You could GET all tickets “/api/v2/tickets”, there you can see the created_at date.

Then you could build a queue system in the app that captures all tickets and then check for tickets that match the status and type critera.

Hi,

Thank you for your answer. I though of that but my problem is that with custom apps we have a limit on 300 tickets. So in one call we can not get more than 300, so for sure I will miss always some tickets.

For that you can build a queueingsystem.
First you get 300 tickets, put them in the queue, then you get 300 more, put them in the queue as well and so on.

Through this you can gradually get all of the tickets, keep them in the queue and then match them against your critera

but the problem will come if I get like 2000 ticket in total or more, it will take long to analyze all I think

Maybe you can already match them against the critera before you add the tickets to the queue.
So that you only end up with the tickets that you want in the queue

yes, I think that will be the solution. Is there an API request to exclude tickets? no, right?