Back

Dropbox API Essential Guide

Aug 1, 20246 minute read

What type of API does Dropbox provide?

Dropbox uses a REST API.

Key points to consider:

  1. The Dropbox API v2 is described as "a set of HTTP endpoints", which is characteristic of REST APIs.

  2. The API documentation mentions using HTTP methods like GET and POST, as well as JSON for request and response formats. These are typical features of REST APIs.

  3. The API uses OAuth 2.0 for authorization, which is commonly used with REST APIs.

  4. The API is structured around resources and uses standard HTTP methods (GET, POST, PUT, DELETE) to interact with those resources, which aligns with REST principles.

  5. The API is hosted on domains like api.dropboxapi.com and content.dropboxapi.com, following the convention of having a dedicated API domain that is common for REST APIs.

While Dropbox's API has some specific features and conventions, its overall architecture and design principles align closely with REST. It does not use SOAP or GraphQL, which have distinctly different characteristics from what is described in the Dropbox API documentation.

Does the Dropbox API have webhooks?

Yes, the official Dropbox API does have webhooks. Here are the key points about Dropbox webhooks:

Webhook Support

  • Dropbox provides webhook functionality for real-time notifications when users' files change.

Event Types

  • Webhooks notify your app about file changes, but do not provide granular control over specific event types.
  • The webhook notifications inform you which users have changes, but not the specific types of changes.

Webhook Payload

  • The webhook payload includes a list of account IDs that had changes, but not details about the changes themselves.
  • The payload format looks like this:
{ "list_folder": { "accounts": [ "dbid:AAH4f99T0taONIb-OurWxbNQ6ywGRopQngc", ... ] }, "delta": { "users": [ 12345678, 23456789, ... ] } }

Getting Change Details

  • After receiving a webhook notification, your app needs to call the /files/list_folder/continue API endpoint to get the actual file changes for each user.

Limitations

  • Currently, there is no way to subscribe to only specific event types via webhooks.
  • You cannot filter for only certain events like new file/folder creation and ignore others like file updates.

Best Practices

  • Respond quickly to webhook requests (within 10 seconds).
  • Process notifications asynchronously using threads or queues.
  • Manage concurrency to avoid processing the same changes multiple times.

In summary, while Dropbox does offer webhooks, they provide notifications about general file changes rather than allowing subscriptions to specific event types. To get detailed information about the changes, you'll need to make additional API calls after receiving a webhook notification.

Rate Limits and other limitations

Here are the key points about Dropbox API rate limits:

API Rate Limits

  • Rate limits are enforced on a per-authorization basis:

    • For user-linked apps, limits apply per user who has linked the app
    • For team-linked apps, limits apply per team for Business API endpoints, or per team member for User API endpoints
  • Exact rate limit numbers are not published, but the limits are designed to be very generous and not inhibit normal usage

  • If rate limited, the API will return a 429 HTTP error with a "too_many_requests" reason

  • Rate limited responses include a Retry-After header indicating how long to wait before retrying

Key Considerations

  • Rate limits are not intended to restrict normal usage, only prevent abuse

  • Handling 429 errors properly by respecting the Retry-After header is important

  • Inefficient API call patterns like excessive polling can lead to rate limiting

  • For large-scale operations, consult Dropbox's large deployments guidelines

  • Using a single "service account" for large amounts of content is generally not recommended for team-linked apps

Other Limits

  • Some Dropbox Business plans have a "data transport limit" for upload calls

  • File upload size limits:

    • Up to 150 MB per file for basic uploads
    • Up to 350 GB per file using upload sessions

The key takeaway is that while specific numbers aren't published, the rate limits are designed to be very generous for normal usage patterns. Proper error handling and efficient API usage are more important than worrying about hitting hard limits in most cases.

Latest API Version

The most recent version of the Dropbox API is v2. Here are the key points:

  1. The current version of the Dropbox API is v2.

  2. Key points to consider:

    • The Dropbox API v2 is a set of HTTP endpoints that help integrate apps with Dropbox.

    • It supports OAuth 2.0 for authorization.

    • There are different types of endpoints:

      • RPC endpoints on api.dropboxapi.com
      • Content-upload endpoints on content.dropboxapi.com
      • Content-download endpoints on content.dropboxapi.com
  3. Dropbox offers official SDKs for several popular programming languages, including Swift, Objective-C, Python, .NET, Java, and JavaScript.

  4. Best practices:

    • Use one of the officially supported SDKs when possible.

    • Treat access tokens as opaque and support variable token sizes up to 1KB.

    • Use the API Explorer to prototype and test API calls.

    • Check the changelog regularly for updates and new features.

The Dropbox API v2 provides a comprehensive set of tools for developers to integrate Dropbox functionality into their applications, with support for various programming languages and platforms.

How to get a Dropbox developer account and API Keys?

Here are the steps to get a developer account for Dropbox and create an API integration:

  1. Create a Dropbox account: If you don't already have one, sign up for a free Dropbox account at dropbox.com.

  2. Access the Dropbox Developer Console: Go to www.dropbox.com/developers and log in with your Dropbox account credentials.

  3. Create a new app:

    • In the App Console, click "Create app".
    • Select the API type (Dropbox API or Scoped access)
    • Choose the type of access you need (Full Dropbox or App folder)
    • Give your app a name (following the naming guidelines)
    • Click "Create app"
  4. Configure your app settings:

    • Set permissions and access scopes as needed for your integration
    • Add allowed redirect URIs if using OAuth
    • Generate an access token for testing
  5. Get your API key:

    • Your app's API key (also called app key or client ID) will be displayed in the app settings
    • You'll also get an app secret to use for OAuth flows
  6. Start developing:

    • Use the API documentation and SDKs to integrate Dropbox functionality
    • Test API calls using the API Explorer

What can you do with the Dropbox API?

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

Files and Folders

  • List, create, modify, and delete files and folders
  • Download and upload file content
  • Get file metadata and thumbnails
  • Search for files and folders
  • Access file revisions and restore previous versions

Sharing

  • Create and manage shared links
  • Share files and folders with other users
  • Manage permissions and access for shared content

Team Management (for Business API)

  • Manage team members and groups
  • Access team member content using Select-User header
  • Manage team folders and team spaces
  • List and traverse team namespaces

Paper Documents (Deprecated)

  • Create, edit, and manage Paper documents
  • Note: Paper API is being deprecated in favor of using Files and Sharing endpoints

Authentication and Authorization

  • Implement OAuth 2.0 for API authorization
  • Use access tokens for authenticated requests

Namespaces and Path Roots

  • Access different namespaces using the Dropbox-API-Path-Root header
  • Work with team folders and team spaces
  • Determine team configuration (team folders vs. team space)

Team Features

  • Check enabled features for a team using /team/features/get_values endpoint
  • Determine organizational model (team folders vs. team space)

User Features

  • Check user-specific features using /users/features/get_values endpoint

Key Points to Consider:

  1. The API supports both personal and team Dropbox accounts, with additional functionality for Business API users.
  2. Path handling is case-insensitive but case-preserving.
  3. Different endpoints are used for content upload/download vs. RPC operations.
  4. Team-linked applications have additional capabilities for managing team content.
  5. The Paper API is being deprecated, and developers should migrate to using Files and Sharing endpoints for Paper content.

By understanding these data models and their capabilities, developers can effectively leverage the Dropbox API to build applications that interact with files, sharing, and team management features.