Task Count Not Returning Expected Result

Hi All -

I’m trying to use the sample code located here.

I have picked a gid # that I know has multiple tasks (some completed and some not) but I’m getting the return of:


So my understanding is that it’s connecting fine to the workspace via my ASANA TOKEN and it’s finding the project fine via the GID but it’s failing to actually find the tasks in that project.

Suggestions appreciated!


Can you share the exact code you are using?

curl -X GET https://app.asana.com/api/1.0/projects/{project_gid}/task_counts \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

Obviously with my access token and the GID of the project.


Look again at the doc, you’ll see
All fields are excluded by default. You must opt in using opt_fields to get any information from this endpoint.

Definitely see that now but I’m struggling to figure out where/how to put in the ?opt_fields in a simple curl command. I don’t see any straightforward examples. If I literally just want the total # of unfinished tasks for a project, can someone give me an example? Thanks again.

You can look at the “Input/Output options” section of the doc