GET Tickets using API

I am using the PHP API that someone posted on this forum to try to make calls into our Zendesk system. However, in trying to grab ALL of the tickets we have in our system, it does not work.

Does anyone know how to make a curl call to grab all of the tickets in the system?


  • 0

    Dennis, why would you want to grab all the tickets from the API, out of interest?

  • 0

    I am trying to create system that will display them to the user. Its a sub system I am creating for work to help with message translations.

  • 0


    Have the same problem here, is there any way to get ALL tickets from the help desk without sending the id or view?

    I used search.xml but this is limited to 1000 records, which doesn't make sense because my help desk has 2200+ tickets. What can I do?

  • 0


        We're using GoodData for our data but the way they parse out the Zendesk imported content doesn't really make sense ("We import text, because if we import numbers it breaks things"), which I'm taking to assume the import things into Text in their backend vs. VARCHAR and doing isnumeric or some other function on their side...

    ANYWAYS....I'd like to get all the tickets in my system as well...this is due to a field that is numeric only (I know it is) so I can get things like call times and perform normal operators on them, SUM/AVG/Etc. I've already gotten in touch with GoodData and to say the least have a MQL Query that's 6 lines long vs. doing it in one line....

    Any suggestions?

  • 0

    @Shawn: That flew totally over my head :) Can you dumb it down for me a little please? If you tell me what you need I can probably do something.

    @Andres: Plus+ plan enables you to download absolutely everything in your account, which is far more convenient that doing it all by hand via the API.

  • 0


        When I spoke with GoodData previously I was told that they import Zendesk information as text vs. numeric data because they could format it easier and it "broke things" when they tried to import as numeric. I'm assuming in their database they're importing fields into TEXT specified fields vs. varchar (variable character) or even as INT (integer) based on fields specified by Zendesk.

         However they don't provide their data as 'real data' they provide their data as database objects, so there isn't any true database interaction. Thus when you attempt to query the data in regular SQL syntax it fails, and is very nebula in error response. 

    For example, a simple SELECT SUM(Call Time) turns out to be SELECT (SELECT #Tickets WHERE Call Time = x ) * x and this is for one call time NUMBER.

    I'm hoping by being able to access ALL my tickets through an API I can iterate through the fields I need and perform any operations I need on them.

  • 0

    I'd like to re-open and bump this request -  is there still no method for getting all tickets by filter (status, tags etc) ? I'm wanting to produce a high-level overview of ticket status for two help desks to place on an in-office statusboard. I'm sure others would find value in this.

    Can i propose something more RESTful like:

    URL: /tickets

    status (single) | /tickets?status=1

    Or perhaps an overview / count method for the API like:

    URL: /overview

    That produces a response similar to:







    </response> ...

  • 0

    I agree with Dan's comments regarding a means to filter our GET requests.  Currently we must cycle through to GET all tickets, and filter out the data we care about to generate some special reports, but generally speaking, we don't need to bother looking at tickets that have already CLOSED, so we would like to at least be able to run a GET command that only looks at ACTIVE tickets, rather than ALL Tickets.  Since you limit the number of tickets we can get with each poll, this causes a burden on our script to cycle more, and causes your side to have to service more API requests.  So it would be better for both sides if you could offer this level of filtering from the front end.

  • 0

    Forget all the fancy stuff, any progress on offering an easy API to download all tickets?

  • 1

    Hi everyone, please see:


    If you're interested in a real-time list of tickets that have been updated within a certain time period, see:


    Note the latter API functions very similarly to our CSV export in terms of the data that it exposes.

  • 0

    Note for ticket export: "You are only allowed to make 1 API call to this API end point every 5 minute and we will return up to 1000 tickets per request."

    Unclear how one goes backwards in time farther than 1000 tickets.

  • 1

    Dan, for the incremental ticket export, you supply a timestamp which is your start date.  If you want to start from the very beginning of your tickets, you would request something like:

    curl https://domain.zendesk.com/api/v2/exports/tickets.json?start_time=0 -u {email}:{password}

    In the response of this request, you would receive a next_page param that will instruct you what your next start_time will be.  You should use this request to retrieve the next batch of tickets until you're caught up to the most recently updated tickets.

    { "end_time": 1332034771, "next_page":"https://domain.zendesk.com/api/v2/exports/tickets.json?start_time=1332034771", "field_headers": { "group_name": "Group", "id": "Id", "created_at": "Created at", ... }, "results": [ { "group_name": "Support", "id": 2, "created_at": "2012-02-02T04:31:29Z", ... }, ... ] }

  • 0

    Great detail. Thanks!

  • 0

    @Steve The links you reference appear to be broken. 

  • 0

    @Steven, I am trying to get use the export all API as well. 

  • 0

    Hi everyone

    if my Json exced the limit, how can I limit this Json? I want a Json that return me 100 counts or less. I'm trying https://subdomain.zendesk.com/api/v2/exports/tickets.json?start_time=0&per_page=100

    but doesn't work. Anyone can Help me please??

  • 0

    Hi ZhiWen,

    The update links are below



    @Arlene, with the exports endpoint it is not currently possible to set a per_page parameter.  This is meant to dump a large volume of tickets.  Might I ask what your goal with using this endpoint and only dumping < 100 tickets is?  Perhaps it would be better to use tickets endpoint or search endpoint for your use case?

  • 0

    Hi James,

    I had a problem, so I wnated to put 100 tickets because I thought that putting 100 tickets or less could solve the problem. But I solved the problems. 

    Thanks anyway :) 

  • 0
    Hi Arlene, Glad to know you've found a solution!
  • 0

    Hi Everyone!!

    How can I get the start_time?? I know that appears in the Json as end_time. But I want to know how can I get that end_time. I need an example.

    I Hope you guys can help me.


  • 0

    Hi Arlene,

    You choose the start_time, which is in Unix epoch time.  So you may want to make an initial sync by starting from 0 and then making requests until you get to the present moment, or you may want to choose a date and convert it to Unix timestamp.  The choice is yours!


Please sign in to leave a comment.