How do I get all closed tasks from a list using the ClickUp API?

1.5k Views Asked by At

I'm trying to get a list of completed tasks from a given list in a folder from the ClickUp API. I want tasks that have a status called complete.

The problem is, one task is being returned, but I know there are 40.

I know I have the right list ID because I've verified that it:

  • Is returned as a list with the correct name if I query /api/v2/space/${space_id_where_the_list_lives}/folder?archived=true;
  • Is the list ID I see when I just open ClickUp and go to that folder/list in my browser.

Here's my query string:

https://api.clickup.com/api/v2/list/${id}/task?archived=true&include_closed=true&statuses%5B%5D=complete

For debugging, I've tried varying the statuses, etc, and other things mentioned in this similar question. That gave me some insights to debug, but my problem is I seem to be scoping what I want correctly, but ClickUp is just not returning all of the results.

Am I using the wrong route altogether?

The way it's organized, we have:

(space)
   \----(folder)
            \--- List 1
            \--- List 2
            \--- List 3 (ID of 12345)
   \----(folder1)
            \--- List 1
            \--- List 2
            \--- List 3 (ID of 67890)

I want to get all tasks from List 3, after getting its ID from querying the space ID.

1

There are 1 best solutions below

0
On

Have you actually archived your completed tasks? Your GET request is only going to include archived tasks. Archiving does not mean the same as complete or closed. Archiving in ClickUp kind of hides tasks away and I think you would have to make separate GET requests to access archived and non-archived tasks.

Try this to get the other 39 tasks:

https://api.clickup.com/api/v2/list/${id}/task?archived=false&include_closed=true&statuses%5B%5D=complete

Another possibility is if the tasks you are trying to access are actually generated in a different list and then being added by an automation to the list to which you are making the request. So the tasks are in multiple lists, perhaps in different folders and/or spaces even. I recently noticed I would have to make a request to the original list to access these tasks.

Otherwise, do not be afraid to ask ClickUp directly. They are actually incredibly quick at responding and very helpful.