API for /tasks -- explorer doesn't match api call for getting tasks in a section


I’m trying to make an API call to get the open tasks within a section of a project.

When I build my /tasks query using the API explorer, it works fine:
GET /tasks?limit=10completed_since=now&section=xxx&project=xxx

When I click the “View Raw Response” or try to make the call via the API call it doesn’t work. I get the following:
URL: https://app.asana.com/api/1.0/tasks?limit=10&completed_since=now&section=xxx&project=xxx
"{“errors”:[{“message”:“Must specify exactly one of project, tag, or assignee + workspace”,“help”:"For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors

Am I doing something wrong?


Hi @John_Craven ,

My colleague @MattBramlage may be able to point you in the right direction. :slight_smile:


Hi @John_Craven,

It took me a bit to actually reproduce what you were seeing - our API explorer doesn’t make it easy to get into that query you were using! (I expect you added an additional field for section manually in the API explorer?)

Filtering on section is actually not documented; if you check out the third example under the documentation on querying for tasks, you can see that specifying section isn’t supported. I think it’s fairly accidental that it works for you, so it’s unfortunately an unreliable thing to do.

The difference you’re seeing between when it works and when it doesn’t is actually due to something else entirely than simply where the query is being constructed - we’re rolling out a new version of the API that is a complete rewrite, but much faster. I verified that if you happen to hit the older version of the API, it works, but if you hit the newer version, it tells you that you can’t filter on section, only projects, tags, or assignee and workspace. This is actually the expected behavior. (The reason you were seeing it as different between querying in the explorer and in a console is because we authorize users differently in the browser and in a console, and auth credentials is what we’re using to partition requests to do our incremental roll-out.) In general, a query in the API explorer and in the console should do the same thing.

To filter to section, unfortunately, the right thing to do right now is to get all of the tasks in the project, then filter client-side on the section. To do that, you have to construct the query to ask for the sections information in the tasks ‘memberships’ field to be shipped back (when you query for tasks on a project, you normally get the compact representation of only name and ID). For instance, you can construct the url with opt_fields like this:


(note also that I specified task name should come back as well: when we ask for specific fields, we no longer return the compact representation, but only those fields that you specifically ask for. Similarly, for illustration purposes, I asked for the section name; without that, you only see the ID, which is really what you should be filtering on client side)

We have an outstanding opportunity for implementing filtering on sections, so perhaps in the near future, we’ll officially support the kind of query you’re looking for.

I hope this makes sense! Good luck!


@MattBramlage Makes sense. Thanks for the reply!