Back

Asana API Essential Guide

Aug 1, 20246 minute read

What type of API does Asana provide?

Type of API

Asana uses a RESTful API

Key characteristics of Asana's REST API

  • It has predictable resource-oriented URLs
  • Accepts JSON or form-encoded requests
  • Returns JSON responses
  • Uses standard HTTP features like verbs and response codes
  • The base URL is https://app.asana.com/api/1.0

Does the Asana API have webhooks?

Yes, the official Asana API does have webhooks. Here are the key points about Asana's webhook functionality:

Webhook Support

  • Asana provides webhook support as part of their API.
  • Webhooks allow applications to be notified of changes in Asana without having to repeatedly poll for updates.

Event Types

You can subscribe to the following types of events with Asana webhooks:

  • Task events: added, changed, removed
  • Section events: added, changed, removed
  • Project events (implied from task/section events)

Key Considerations

  • Webhooks require setting up a server that is accessible over the internet to receive events.
  • There is an initial handshake process to establish the webhook connection.
  • Asana uses a security mechanism with a shared secret (X-Hook-Secret) to verify webhook requests.
  • Events are typically delivered within a minute, with most arriving within 10 minutes.
  • Asana uses a "heartbeat" system to keep webhooks active, sending empty payloads every 8 hours.

Filtering Events

  • You can set filters on webhooks to only receive specific event types (e.g. only task added events).

Best Practices

  • Implement proper security verification using the X-Hook-Secret and X-Hook-Signature headers.
  • Be prepared to handle multiple events for a single action, as some actions may trigger multiple webhook calls.
  • Respond with a 200 OK status to acknowledge receipt of webhook events.

In summary, Asana's webhook system provides a robust way to receive real-time updates about changes in Asana, with support for various event types related to tasks, sections, and projects. Proper implementation requires attention to security, filtering, and handling of events.

Rate Limits and other limitations

The Asana API has several rate limits and restrictions in place to protect the stability of the API and ensure fair usage. Here are the key points regarding the API rate limits:

Standard Rate Limits

  1. Rate limits are allocated per authorization token. Different tokens have independent limits.

  2. The limits are based on minute-long windows and differ depending on the domain type:

    • Free domains: 150 requests per minute
    • Premium/Business/Enterprise domains: 1500 requests per minute
  3. Requests that hit the rate limits will receive a 429 Too Many Requests response, which includes a Retry-After header indicating how long to wait before retrying.

Additional Limits

  1. Search API: Limited to 60 requests per minute.

  2. Duplication endpoints: Limited to 5 concurrent jobs.

  3. Cost limits: An additional limit based on the computational cost of requests is imposed to protect against expensive requests that require extensive traversal of the data graph.

Webhook Limits

  1. 1,000 limit per resource in Asana (including /events streams).

  2. 10,000 per user-app (An app can have 10,000 webhooks for each user).

Best Practices

  1. Use paginated requests: Specify a value for the 'limit' parameter to ensure requests can be served regardless of factors like server load and network latency.

  2. Use the Batch API: For cases where you want to accomplish multiple tasks with minimal HTTP requests.

  3. Handle rate limit responses: Implement proper handling of 429 responses, including respecting the Retry-After header.

  4. Use client libraries: Official Asana client libraries respect rate-limited responses and automatically retry requests after waiting the appropriate time.

Summary

The Asana API implements a multi-tiered rate limiting system to ensure fair usage and API stability. By adhering to these limits and following best practices like using pagination and the Batch API, developers can build robust integrations with Asana while minimizing the risk of hitting rate limits.

Latest API Version

Based on the search results provided, here are the key points regarding the most recent version of the Asana API:

No Versioning System

The Asana API does not currently use a versioning system. This means there is no specific "latest version" in the traditional sense.

API Changes and Backwards Compatibility

  • Asana does make backwards-incompatible changes to the API periodically.
  • They follow guidelines for making these changes to minimize disruption.

Change Management

Asana uses HTTP headers to manage changes and backwards compatibility:

  • Asana-Change: Indicates changes to the API
  • Asana-Enable: Allows clients to opt-in to new features
  • Asana-Disable: Allows clients to opt-out of changes temporarily

Staying Updated

To stay informed about API changes and new features:

  1. Follow the Asana developer forum for announcements.
  2. Check the Changelog, which is the single source of truth for API updates.

Best Practices

  • Regularly check the Changelog for updates.
  • Use the provided HTTP headers to manage your integration's compatibility with API changes.
  • Participate in the developer forum to provide feedback and stay informed.

In summary, while Asana doesn't have traditional API versions, they maintain backwards compatibility and provide mechanisms for developers to adapt to changes. The most up-to-date information about the API can always be found in their official documentation and Changelog.

How to get a Asana developer account and API Keys?

Here are the key steps to get a developer account for Asana to create an API integration:

  1. Create an Asana account if you don't already have one. You can sign up for a free account at asana.com.

  2. Once logged in, access the developer console by:

    • Clicking on your profile photo in the top right
    • Selecting "My Settings" > "Apps" > "Manage Developer Apps"
  3. In the developer console, you can create a new app and get API credentials:

    • Click "Create New App"
    • Give your app a name and description
    • You'll receive a Client ID and Client Secret for OAuth authentication
  4. For quick testing, you can also create a Personal Access Token (PAT):

    • In the developer console, go to "Personal access tokens"
    • Click "Create new token"
    • Copy and securely store the token - you'll only see it once
  5. With your credentials (OAuth or PAT), you can now make API requests to Asana endpoints.

  6. Review the API documentation at developers.asana.com for details on available endpoints and how to use them.

  7. Consider using the API explorer or Postman collection provided by Asana to test API calls.

Key things to note:

  • There's no separate "developer account" - you use your regular Asana account
  • The developer console is where you manage your API integrations
  • Personal access tokens are quickest for testing, OAuth is recommended for production apps
  • Review rate limits and best practices in the API documentation

What can you do with the Asana API?

Based on the search results, here are the key data models you can interact with using the Asana API, along with what is possible for each:

Tasks

  • Create new tasks
  • Read task details
  • Update task properties (e.g. name, assignee, due date)
  • Delete tasks
  • Add/remove attachments
  • Add comments
  • Set custom fields

Projects

  • Create new projects
  • Read project details
  • Update project properties
  • Delete projects
  • Add/remove tasks to projects

Workspaces

  • Read workspace details
  • Get list of workspaces user has access to

Users

  • Read user details
  • Get currently authenticated user

Teams

  • Read team details
  • Add/remove users from teams

Sections

  • Create sections within projects
  • Read section details
  • Update section properties
  • Delete sections

Portfolios (Business/Enterprise only)

  • Create portfolios
  • Read portfolio details
  • Update portfolio properties
  • Add/remove projects from portfolios

Custom Fields

  • Create custom fields
  • Read custom field details
  • Update custom field properties
  • Delete custom fields
  • Set custom field values on tasks

Attachments

  • Upload attachments to tasks
  • Read attachment details
  • Delete attachments

Comments

  • Add comments to tasks
  • Read comment details
  • Delete comments

Tags

  • Create tags
  • Read tag details
  • Update tag properties
  • Delete tags
  • Add/remove tags from tasks

Events

  • Get activity feed of changes in a workspace
  • Search for tasks, projects, etc. across workspace

The API aims to provide access to most of the core functionality available in the Asana web application, with the capabilities generally mirroring what is possible in the UI for a given pricing tier. Some advanced features like Portfolios are only available on higher tier plans.