Sample - Asana API
GET/workspaces/{workspace_gid}/tasks/search

Search tasks in a workspace

Required scope: tasks:read

To mirror the functionality of the Asana web app's advanced search feature, the Asana API has a task search endpoint that allows you to build complex filters to find and retrieve the exact data you need.

Premium access

Like the Asana web product's advance search feature, this search endpoint will only be available to premium Asana users. A user is premium if any of the following is true:

  • The workspace in which the search is being performed is a premium workspace
  • The user is a member of a premium team inside the workspace

Even if a user is only a member of a premium team inside a non-premium workspace, search will allow them to find data anywhere in the workspace, not just inside the premium team. Making a search request using credentials of a non-premium user will result in a 402 Payment Required error.

Pagination

Search results are not stable; repeating the same query multiple times may return the data in a different order, even if the data do not change. Because of this, the traditional pagination available elsewhere in the Asana API is not available here. However, you can paginate manually by sorting the search results by their creation time and then modifying each subsequent query to exclude data you have already seen. Page sizes are limited to a maximum of 100 items, and can be specified by the limit query parameter.

Eventual consistency

Changes in Asana (regardless of whether they’re made though the web product or the API) are forwarded to our search infrastructure to be indexed. This process can take between 10 and 60 seconds to complete under normal operation, and longer during some production incidents. Making a change to a task that would alter its presence in a particular search query will not be reflected immediately. This is also true of the advanced search feature in the web product. Because of this delay, the search endpoint is not suited for use cases that require immediate consistency after writes. If you need read-your-write behavior or strongly consistent results, we recommend using Get multiple tasks instead.

Rate limits

You may receive a 429 Too Many Requests response if you hit any of our rate limits.

Custom field parameters

Parameter nameCustom field typeAccepted type
custom_fields.{gid}.is_setAllBoolean
custom_fields.{gid}.valueTextString
custom_fields.{gid}.valueNumberNumber
custom_fields.{gid}.valueEnumEnum option ID
custom_fields.{gid}.valueDateISO 8601 date string (yyyy-mm-dd)
custom_fields.{gid}.starts_withText onlyString
custom_fields.{gid}.ends_withText onlyString
custom_fields.{gid}.containsText onlyString
custom_fields.{gid}.less_thanNumber onlyNumber
custom_fields.{gid}.greater_thanNumber onlyNumber
custom_fields.{gid}.beforeDate onlyISO 8601 date string (yyyy-mm-dd)
custom_fields.{gid}.afterDate onlyISO 8601 date string (yyyy-mm-dd)

For example, if the gid of the custom field is 12345, the query parameter to find tasks where it is set would be custom_fields.12345.is_set=true. To match an exact value for an enum custom field, use the gid of the desired enum option and not the name of the enum option: custom_fields.12345.value=67890. To find tasks with a date custom field before April 21, 2026, use custom_fields.12345.before=2026-04-21.

Not Supported: searching for multiple exact matches of a custom field, searching for multi-enum custom field

Custom task type parameters

Parameter nameAccepted type
custom_types.{gid}.custom_type_status_option.gidEnum option GID

This parameter filters tasks by their custom task status option. The {gid} is the GID of the custom task type, and the value is the GID of a valid status option for that type's status field.

Requirements:

  • resource_subtype=custom must be set when using this parameter.
  • Only one custom_types.* parameter may be specified per request.
  • The provided custom task type GID must reference a valid custom object type.
  • The status option GID must be a valid option for the custom type's status field.
  • Cannot be combined with custom_fields.{status_field_gid}.value when {status_field_gid} is the status field belonging to the same custom task type.

For example, to find custom tasks of type 12345 with status option 67890: custom_types.12345.custom_type_status_option.gid=67890&resource_subtype=custom.

Note: If you specify projects.any and sections.any, you will receive tasks for the project and tasks for the section. If you're looking for only tasks in a section, omit the projects.any from the request.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

1 parameter
opt_fieldsarray<string>optional
This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. Properties can include nested fields. To learn more, see the [input/output options guide](/docs/inputoutput-options#selecting-nested-fields).

6 status codes
200Successfully retrieved the section's tasks.
dataarray<object>optional
400This usually occurs because of a missing or malformed parameter. Check the documentation and the syntax of your request and try again.
errorsarray<object>optional
401A valid authentication token was not provided with the request, so the API could not associate a user with the request.
errorsarray<object>optional
403The authentication and request syntax was valid but the server is refusing to complete the request. This can happen if you try to read or write to objects or properties that the user does not have access to.
errorsarray<object>optional
404Either the request method and path supplied do not specify a known action in the API, or the object specified by the request does not exist.
errorsarray<object>optional
500There was a problem on Asana’s end. In the event of a server error the response body should contain an error phrase. These phrases can be used by Asana support to quickly look up the incident that caused the server error. Some errors are due to server load, and will not supply an error phrase.
errorsarray<object>optional

Error handling

A 400 is returned: This usually occurs because of a missing or malformed parameter. Check the documentation and the syntax of your request and try again. A 401 is returned: A valid authentication token was not provided with the request, so the API could not associate a user with the request. A 403 is returned: The authentication and request syntax was valid but the server is refusing to complete the request. This can happen if you try to read or write to objects or properties that the user does not have access to. A 404 is returned: Either the request method and path supplied do not specify a known action in the API, or the object specified by the request does not exist. A 500 is returned: There was a problem on Asana’s end. In the event of a server error the response body should contain an error phrase. These phrases can be used by Asana support to quickly look up the incident that caused the server error. Some errors are due to server load, and will not supply an error phrase.