Sadly, sometimes requests to the API are not successful. Failures can occur for a wide range of reasons. In all cases, the API should return an HTTP Status Code that indicates the nature of the failure (below), with a response body in JSON format containing additional information.

In the event of a server error the response body will contain an error phrase. These phrases are automatically generated using the node-asana-phrase library and can be used by Asana support to quickly look up the incident that caused the server error.

Code Meaning Description
200 Success If data was requested, it will be available in the data field at the top level of the response body.
201 Success
(for object creation)
Its information is available in the data field at the top level of the response body. The API URL where the object can be retrieved is also returned in the Location header of the response.
400 Invalid request This usually occurs because of a missing or malformed parameter. Check the documentation and the syntax of your request and try again.
401 No authorization A valid API key was not provided with the request, so the API could not associate a user with the request.
403 Forbidden The API key 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.
404 Not found 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.
434 Deprecated An aspect of the request has been deprecated. See the response message for more details.
429 Rate Limit Enforced Asana imposes a limit on the rate at which users can make requests. The limit is currently around 100 requests per minute, but this is not guaranteed: it may vary with server load, and we may change it in the future. The Retry-After response header will specify the number of seconds until the user can make another request. Clients sending large bursts of requests should handle this error code to retry after the delay.
Rate limits are important to prevent abuse and keep the service available to everyone. If you definitely need a higher rate limit for your application, please contact developer support and we will look into granting an exception.
500 Server error There was a problem on Asana’s end.

In the event of an error, the response body will contain an errors field at the top level. This contains an array of at least one error object, described below:

Example Description
Message: project: Missing input Message providing more detail about the error that occurred, if available.
Phrase: 6 sad squid snuggle softly 500 errors only. A unique error phrase which can be used when contacting developer support to help identify the exact occurrence of the problem in Asana’s logs.

Some examples.

Missing authorization header

# Request
curl https://app.asana.com/api/1.0/users/me

# Response
HTTP/1.1 401
{
  "errors": [
  {
    "message": "Not Authorized"
  }
  ]
}

Bad request parameters

# Request
curl -H "Authorization: Bearer <personal_access_token>" https://app.asana.com/api/1.0/tasks

# Response
HTTP/1.1 400
{
  "errors": [
  {
    "message": "workspace: Missing input"
  }
  ]
}

Asana had a problem

# Request
curl -H "Authorization: Bearer <personal_access_token>" https://app.asana.com/api/1.0/users/me

# Response
HTTP/1.1 500
{
  "errors": [
  {
    "message": "Server Error",
    "phrase": "6 sad squid snuggle softly"
  }
  ]
}