Back

Box API Essential Guide

Aug 2, 20246 minute read

What type of API does Box provide?

Box primarily uses a REST API. Here are the key points about Box's API:

Box's API Type

Box uses a REST API as its primary API type. REST (Representational State Transfer) is an architectural style for designing networked applications that has become very popular for web services and APIs.

Key Characteristics of Box's REST API

  • It uses standard HTTP methods like GET, POST, PUT, DELETE etc.
  • Resources are accessed via URLs
  • Data is typically exchanged in JSON format
  • It is stateless, meaning each request contains all the information needed to complete it
  • It supports authentication and authorization mechanisms

API Documentation

Box provides comprehensive REST API documentation for developers to integrate Box functionality into their applications. This includes details on endpoints, request/response formats, authentication, etc.

Other API Options

While REST is the primary API, Box may offer other API options for specific use cases:

  • WebHooks for real-time notifications
  • SDKs and libraries for easier integration in various programming languages

However, the core Box API that most developers will interact with is RESTful.

Does the Box API have webhooks?

Yes, the Box API has webhooks. Box offers V2 webhooks, which allow monitoring of Box content for events and receiving notifications to a specified URL when they occur.

Event Types

Box webhooks support various event types, including:

  • File and folder events (uploads, downloads, deletions)
  • Collaboration events
  • Comment events
  • Task events
  • Sign request events

Examples of event triggers:

  • FILE.UPLOADED
  • FILE.DOWNLOADED
  • FOLDER.CREATED
  • COLLABORATION.CREATED
  • COMMENT.CREATED
  • TASK.ASSIGNMENT.CREATED
  • SIGN_REQUEST.COMPLETED
  • SIGN_REQUEST.DECLINED
  • SIGN_REQUEST.EXPIRED

Key Features of V2 Webhooks

  1. Can be set on specific files/folders (not at the root level)
  2. Offer 30+ event triggers
  3. Provide full object response and additional context in the payload
  4. Include a retry mechanism (up to 10 times) after notification delivery failure
  5. Support payload verification
  6. Require HTTPS for the notification URL

Creating Webhooks

Webhooks can be created through the Developer Console or via API calls. Here's an example of creating a webhook using the API:

curl -i -X POST "https://api.box.com/2.0/webhooks" \ -H "authorization: Bearer <ACCESS_TOKEN>" \ -H "content-type: application/json" \ -d '{ "target": { "id": "234234", "type": "folder" }, "address": "https://example.com/webhooks", "triggers": [ "FILE.UPLOADED" ] }'

This example creates a webhook that listens for file upload events in a specified folder.

Rate Limits and other limitations

The Box API has several rate limits in place to prevent misuse and protect their infrastructure. Here are the key points about the Box API rate limits:

General API Rate Limits

  • 1000 API requests per minute, per user
  • This is the most common limit that applies to most API calls

Upload Rate Limits

  • 240 file upload requests per minute, per user

Search Rate Limits

  • 6 searches per second, per user
  • 60 searches per minute, per user
  • 12 searches per second, per enterprise

Box Sign Rate Limits

  • Create and resend sign request: 100 requests per minute, per user
  • Get sign request: 1000 requests per minute, per user

Additional Considerations

  1. These rate limits apply regardless of the method or application calling the API, including official Box SDKs.

  2. Rate limits are in place to protect the service's health and minimize the risk of overactive applications causing issues.

  3. Box may impose additional rate limits based on resource contention or to protect the quality of service.

  4. When an application hits a rate limit, the API will return a 429 Too Many Requests status code.

  5. The API response will include a "retry-after" header indicating how long to wait before retrying the request.

Best Practices

  • Implement exponential back-off strategies when retrying API calls after hitting rate limits.
  • Be aware of the different rate limits for specific API endpoints and adjust your application's behavior accordingly.
  • Monitor your API usage to ensure you're not approaching or exceeding the rate limits.

By understanding and respecting these rate limits, developers can build more robust applications that interact smoothly with the Box API while avoiding disruptions due to exceeding usage thresholds.

Latest API Version

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

API Versioning Strategy

  1. Box uses a calendar year-based versioning system for its API.

  2. The most recent stable version of the Box API is named after the year it was released. For example, if a new version was released in 2025, it would be named 2025.0.

  3. Box can introduce a new breaking change to certain endpoints once per year.

Current API Version

While the search results don't explicitly state the current version number, we can infer the following:

  1. The most recent version mentioned in the search results is 2025.0.

  2. However, this appears to be used as an example rather than the actual current version.

  3. The search results mention that if no version is specified, the API defaults to the "V2 Box API version".

Key Points to Consider

  1. Box supports versioning in both URL path and header.

  2. To use a specific version, include the box-version header in your API requests.

  3. Each stable version is supported for a minimum of 12 months.

  4. When a new version is released, the previous version becomes deprecated but remains available for use.

  5. Box recommends updating your apps to use the latest stable API version.

Best Practices

  1. Always specify the API version with every request to ensure consistent behavior.

  2. Monitor the Box Developer Changelog for updates on new versions and deprecations.

  3. Keep your email address current in the Developer Console's App Info section to receive important updates.

  4. When using Box SDKs, be aware that they introduce new methods for each new version of an endpoint.

In conclusion, while the exact current version number is not provided in the search results, Box uses a year-based versioning system for its API. To ensure you're using the most up-to-date version, it's best to check the official Box API documentation or contact Box support for the most recent version number.

How to get a Box developer account and API Keys?

Here's how to get a developer account for Box to create an API integration:

Create a Box Developer Account

  1. Go to the Box Developer website (developer.box.com) and click "Sign Up" in the top right corner.

  2. Fill out the registration form with your details, including your name, email address, and password.

  3. Verify your email address by clicking on the link sent to you by Box.

  4. Once verified, you'll be logged in to your Box developer account.

Next Steps

  1. Once logged in, you can access the Box Developer Console to manage your applications, API keys, and other development resources.

  2. Choose the appropriate application type (Custom App, Web App, Mobile App) based on your development needs.

  3. Select an authentication method (OAuth 2.0, JWT, or Client Credentials Grant) that best fits your use case.

  4. Configure your app settings, set up application scopes, and generate a developer token to start making API calls.

What can you do with the Box API?

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

Files and Folders

  • Upload, download, update, and delete files and folders
  • Manage file and folder metadata
  • Set permissions and access controls
  • Create shared links for files and folders
  • Search for files and folders using full-text search queries

Users

  • Create, update, and delete users
  • Manage user roles and permissions
  • Provision and deprovision users

Groups

  • Create and manage groups of users
  • Assign permissions to groups

Comments

  • Add, edit, and delete comments on files

Tasks

  • Create and manage tasks associated with files

Collaborations

  • Invite users to collaborate on files and folders
  • Manage collaboration roles and permissions

Events

  • Access logs of user and enterprise actions (over 100 different event types)

Metadata

  • Add, update, and delete custom metadata on files and folders
  • Use metadata for advanced search capabilities

Webhooks

  • Set up webhooks to receive real-time notifications of events

Authentication

  • Supports OAuth 2.0, JSON Web Token (JWT), Client Credentials, and App Token authentication methods

Enterprise Settings

  • Manage enterprise-wide settings and policies
  • Place and manage legal holds on content

Retention Policies

  • Create and manage retention policies for content

Box Sign (E-signature)

  • Create and manage e-signature workflows

Box AI

  • Leverage AI capabilities to extract metadata and insights from content

Custom Apps

  • Create custom applications using Box Platform APIs and SDKs

Key points to consider:

  • Box Platform provides a comprehensive set of APIs and developer tools to interact with these data models
  • The Box API allows for secure integration of Box content management capabilities into custom applications
  • Developers can use various SDKs, CLI tools, and UI components to build applications on top of Box
  • Box Platform supports enterprise-grade security and compliance standards