# Task count from API endpoint doesn't match tasks count on Asana reporting

**URL:** <https://forum.asana.com/t/task-count-from-api-endpoint-doesnt-match-tasks-count-on-asana-reporting/365780>\
**Category:** API & Developers\
**Created:** [13 March 2023 03:25 UTC](https://forum.asana.com/t/task-count-from-api-endpoint-doesnt-match-tasks-count-on-asana-reporting/365780 "2023-03-13T03:25:48Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Triet\_Le](https://luna1.co/8d76cd.png) [@Triet\_Le](https://forum.asana.com/u/Triet_Le)\
**Post date:** [13 March 2023 03:25 UTC](https://forum.asana.com/t/task-count-from-api-endpoint-doesnt-match-tasks-count-on-asana-reporting/365780/1 "2023-03-13T03:25:48Z")

</div>

Hi all, I tried to retrieve the number of tasks on this project named `Engineer RoadMap` by sending a simple get requests to this endpoint (I believe this gets both complete and incomplete tasks)

```plaintext
curl --request GET \
     --url "https://app.asana.com/api/1.0/projects/${project_id}/tasks" \
     --header 'accept: application/json' \
     --header "authorization: Bearer ${api_token}" | jq '.data | length'

```

results:  
`231`

I double-checked with the Asana reporting, and turns out this number isn’t any close to the one I got

 ![image](https://us1.discourse-cdn.com/asana/original/3X/e/1/e1c892e7657cf6da18a87d42e968d81cd832ffef.png)  
(I can only upload 1 image. On Asana reporting, there’re ~8600 completed tasks, and ~1000 incomplete tasks)

I thought the Asana reporting might also include the sub-tasks. Hence I wrote a bash script to get all the subtasks, and eventually get this number  
`259`  
Adding up with the total tasks above, I only got ~500 tasks and subtasks in total via API call. Meanwhile, the Asana reporting shows up to ~1000 tasks incomplete, and ~8600 tasks completed.

Is there something wrong with the Asana API? Or this has something to do with the Asana reporting? Thank you!

---

<div class="post-metadata">

**Author:** ![Triet\_Le](https://luna1.co/8d76cd.png) [@Triet\_Le](https://forum.asana.com/u/Triet_Le)\
**Post date:** [13 March 2023 03:27 UTC](https://forum.asana.com/t/task-count-from-api-endpoint-doesnt-match-tasks-count-on-asana-reporting/365780/2 "2023-03-13T03:27:58Z")

</div>

Sorry for the confuse asana reporting title. Cannot edit so I re-up the report screenshot here

 ![image](https://us1.discourse-cdn.com/asana/original/3X/c/c/cccff56368c2b9e847031e22d288392dd3b48656.png)

---

<div class="post-metadata">

**Author:** ![Larry\_Berger\_lpb](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/larry_berger_lpb/32/276017_2.png) [@Larry\_Berger\_lpb](https://forum.asana.com/u/Larry_Berger_lpb)\
**Post date:** [13 March 2023 03:49 UTC](https://forum.asana.com/t/task-count-from-api-endpoint-doesnt-match-tasks-count-on-asana-reporting/365780/3 "2023-03-13T03:49:09Z")

</div>

Welcome, @Triet_Le,

I think the issue is that your request should be using pagination (probably easier via a client library than with cURL) so you’re not seeing all the results via your API call.

More info is found here:

> **[Pagination](https://developers.asana.com/docs/pagination)**
>
> Paginating requests for object sets that may be large is highly recommended. For requests that will return large result sets, the API may truncate the result or timeout attempting to gather the data. Pagination ensures a more reliable experience by...

Hope that helps,

Larry

---

<div class="post-metadata">

**Author:** ![Frederic\_Malenfant](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/frederic_malenfant/32/8358_2.png) [@Frederic\_Malenfant](https://forum.asana.com/u/Frederic_Malenfant)\
**Post date:** [13 March 2023 12:35 UTC](https://forum.asana.com/t/task-count-from-api-endpoint-doesnt-match-tasks-count-on-asana-reporting/365780/4 "2023-03-13T12:35:56Z")

</div>

If your projects are huge and you only need the count, not tasks, you can also use that endpoint, to get statistics about your project.

> **[Get task count of a project](https://developers.asana.com/reference/gettaskcountsforproject)**
>
> Get an object that holds task count fields. All fields are excluded by default. You must opt in using opt\_fields to get any information from this endpoint.This endpoint has an additional rate limit and each field counts especially high against our...

---

<div class="post-metadata">

**Author:** ![Triet\_Le](https://luna1.co/8d76cd.png) [@Triet\_Le](https://forum.asana.com/u/Triet_Le)\
**Post date:** [14 March 2023 03:19 UTC](https://forum.asana.com/t/task-count-from-api-endpoint-doesnt-match-tasks-count-on-asana-reporting/365780/5 "2023-03-14T03:19:04Z")

</div>

@Ipb  
Thanks for the info. I was quite aware of the pagination mechanism. I noticed for the above endpoint that I made, since I didn’t put the param `limit` into the query, all the tasks are returned already and no key-value `offset` is presented within my API call response.

 ![image](https://us1.discourse-cdn.com/asana/original/3X/c/5/c51dbdb28b8ec30f9c25d86b973ceb3f63ffac39.png)  
As you see, at the end of the response, there is no `offset` key-value.

---

<div class="post-metadata">

**Author:** ![Triet\_Le](https://luna1.co/8d76cd.png) [@Triet\_Le](https://forum.asana.com/u/Triet_Le)\
**Post date:** [14 March 2023 03:22 UTC](https://forum.asana.com/t/task-count-from-api-endpoint-doesnt-match-tasks-count-on-asana-reporting/365780/7 "2023-03-14T03:22:45Z")

</div>

@Frederic_Malenfant  
Thank you for letting me know about the above endpoint. I just tried it with my project\_id and seems like that API endpoint doesn’t work ☹ It returns no data

 ![SCR-20230314-eem](https://us1.discourse-cdn.com/asana/original/3X/f/4/f4594e2f9e44f6ae3c10da4036f5f253f737c595.png)

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [14 March 2023 12:36 UTC](https://forum.asana.com/t/task-count-from-api-endpoint-doesnt-match-tasks-count-on-asana-reporting/365780/8 "2023-03-14T12:36:38Z")

</div>

> [@Triet\_Le](#):
>
> since I didn’t put the param `limit` into the query, all the tasks are returned already

No, that’s not how Asana’s pagination works. As the docs say, if you don’t include a `limit` parameter, you will get partial and inconsistent results; that is, you’ll get some initial portion of the requested data but not all of it, and the amount of data returned is likely to be inconsistent between successive non-paginated calls.

You’ll only get back the pagination info (`next_page`) if you include the `limit` parameter.

Bottom line: if you want to get more than 50-100 tasks back, you **need** to use pagination and that means including the `limit` parameter.

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [14 March 2023 12:40 UTC](https://forum.asana.com/t/task-count-from-api-endpoint-doesnt-match-tasks-count-on-asana-reporting/365780/9 "2023-03-14T12:40:22Z")

</div>

> [@Triet\_Le](#):
>
> seems like that API endpoint doesn’t work ☹ It returns no data

You missed this part of the docs regarding the task counts endpoint:

> **All fields are excluded by default**. You must [opt in](https://developers.asana.com/docs/inputoutput-options) using `opt_fields` to get any information from this endpoint.

---

<div class="post-metadata">

**Author:** ![Triet\_Le](https://luna1.co/8d76cd.png) [@Triet\_Le](https://forum.asana.com/u/Triet_Le)\
**Post date:** [16 March 2023 03:29 UTC](https://forum.asana.com/t/task-count-from-api-endpoint-doesnt-match-tasks-count-on-asana-reporting/365780/10 "2023-03-16T03:29:16Z")

</div>

Hi Phil, thank you for clarifying. I tried filling in `limit` = 100 and keep using pagination to request the next page. Pagination didn’t go further 3 pages, and the total number of tasks seems like didn’t change much ☹

I tried again with the `tasks_count` endpoint by filling in `opt_fields` as what you told (sorry I missed this part)

> You missed this part of the docs regarding the task counts endpoint:

The result reflected what I’ve observed, it still showed a total of only 231 tasks - exactly what I got lately.  
 ![image](https://us1.discourse-cdn.com/asana/original/3X/8/5/856aacb8ff67599bd32bca49e3e260a720bd2173.png)

Back to the root issue, this API endpoint’s response is hugely deflected from the Asana reporting. Honestly, I’m not sure what has been wrong here. Is there something you could help me out with this?

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [16 March 2023 03:40 UTC](https://forum.asana.com/t/task-count-from-api-endpoint-doesnt-match-tasks-count-on-asana-reporting/365780/11 "2023-03-16T03:40:55Z")

</div>

I don’t use reporting or the task count endpoint so I’m not sure how either of those are calculated.

If you go to the actual project in the Asana web application, how many tasks are actually in the project? How many subtasks? Is it in the neighborhood of 250-260, or is it wayyyy bigger than that, in the neighborhood of 8000-9000 (though I don’t expect you to count all of them exactly if it’s that big).

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/system/32/276370_2.png) [@system](https://forum.asana.com/u/system)\
**Post date:** [30 May 2025 18:55 UTC](https://forum.asana.com/t/task-count-from-api-endpoint-doesnt-match-tasks-count-on-asana-reporting/365780/12 "2025-05-30T18:55:33Z")

</div>

Closed on 30 May 2025 18:55 UTC


