Total number of tasks of a project

Hi everyone :slight_smile:

Is there a way to get the total tasks count via an API call ?

Currently I’m using Get task count of a project but num_tasks only gives me the parent tasks and not the subtasks.

As a result that number is often lower than the total number of tasks from the admin console (where both parent and subtasks are counted).

Thank you for your help! :pray:

You have to remember that by default (unless someone explicitly adds it), a subtask is not attached to the project of its parent. So “# of tasks in a project” will not include most subtasks since they’re not technically in the project.

1 Like

Hi Phil,

thanks for the quick reply!
yes I’m aware that they are not directly part of the project, though with the search API Asana is able to return all subtasks, so I was hoping for

  • either an API call on a project / workspace level that returns ALL tasks
  • either an API call that returns the same number as you find in the admin console, returning tasks under your owned workspaces / organisations (see screenshot)

I’m not 100% sure but I don’t think there’s any type of call that will return you that info.

@Frederic_Malenfant, do you have any other thoughts on this?

2 Likes

@Willem_Dewulf I am surprised this number (538) includes subtasks!
Because in the API, a subtask is not member of a project until it is specifically assigned to it.

They never “inherits” from the parent project, as they can be member of another project, or no project (by default).

And, you are right, the api call to get number of tasks by project does not includes subtasks, except if you set a project on all of these subtasks manually. But, I don’t suggest to do that, because they will now appear directly on your lists when you query the project in API or Asana UI !

1 Like

Hi @Frederic_Malenfant ,

I did a check 2 day ago by adding 1 task and 1 subtask and the total in the admin dashboard did increase from 538 to 540 so I do think that number has all tasks.

But so as far as you know, there is no API call on an account level to see how many tasks are under your premium organizations (as to reflect the same number you see in the admin console)?

1 Like

Hi @Willem_Dewulf,
It’s interesting to hear that the admin console counts subtasks too!

I needed to update task description of all tasks in a project before, and I looped through tasks to get their subtasks.
I assume that method is all what we have for counting subtasks through API.
It’s not ideal because the for loop of GET requests was really slow, it sometimes takes an hour.

Edit: I found this discussion relevant.

1 Like