Overview
The Box API gives you access to a set of secure content management features for use in your own app, such as file storage, preview, search, commenting, and metadata. It strives to be RESTful and is organized around the main resources from the Box web interface.
Suppressing Notifications
CORS
Pagination
Offset-based Paging
Marker-based Paging
Errors
The Box API communicates errors through standard HTTP status codes with details supplied in JSON objects. Generally the following pattern applies:
Fields
If-Match
The Box API supports the HTTP If-Match and If-None-Match headers for certain methods in the files and folders endpoints (Supported methods are listed below). If-Match headers let you ensure that your app only alters files/folders on Box if you have the current version; similarly, If-None-Match headers ensure that you don’t retrieve unnecessary data if you already have the most current version on-hand.
As-User
The As-User header is used by enterprise administrators to make API calls for their managed users. It can also be used by a Service Account to make API calls for managed users or app users.
You will have to pass in the header As-User: USER_ID
to impersonate the user within the enterprise. These API calls require the requests to come from an Admin, a Co-admin, or a Service Account to be successful.
To enable this functionality for applications using OAuth2, please file a support ticket with your API key.
To enable this functionality for applications using OAuth2 with JWT, please navigate to the Advanced Features section in the developer console and enable the "Perform actions on behalf of users" permission.
Rate Limiting
In certain cases, Box needs to enforce rate-limiting in order to prevent abuse by third-party services and/or users. In the event that an excessive level of usage is reached, a standard 429 Too Many Requests
error will be returned, with an indication of when to retry the request. In the event that back-to-back 429s are received, an exponential backoff algorithm is recommended.
OAuth 2
Token
Revoke
File Object
Get File Info
Get information about a file.
Download File
Retrieves the actual data of the file. An optional version parameter can be set to download a previous version of the file.
Upload File
Use the Upload API to allow users to add a new file. The user can then upload a file by specifying the destination folder for the file. If the user provides a file name that already exists in the destination folder, the user will receive an error.
A different Box URL, https://upload.box.com/api/2.0/files/content, handles uploads. This API uses the multipart post method to complete all upload tasks. You can optionally specify a Content-MD5
header with the SHA-1 hash of the file to ensure that the file is not corrupted in transit.
Upload File Version
Uploading a new file version is performed in the same way as uploading a file. This method is used to upload a new version of an existing file in a user’s account. Similar to regular file uploads, these are performed as multipart form uploads. An optional If-Match header can be included to prevent race conditions. The filename on Box will remain the same as the previous version. To update the file’s name, you can specify a new name for the file in the POST by setting the name field in the body.
Preflight Check
Update File Info
Update the information about a file, including renaming or moving the file.
Delete File
Move a file to the trash.
Copy File
Copy a file.
Lock and Unlock
Lock or unlock a file.
Get Thumbnail
Get a thumbnail image for a file.
Get Embed Link
Get a URL for creating an embedded preview session.
Get File Collaborations
Get all of the collaborations on a file (i.e. all of the users that have access to that file).
Get File Comments
Get all of the comments on a file.
Get File Tasks
Get all of the tasks for a file.
File Version Object
Get Versions
Get information on prior versions of a file.
Promote Version
Copy a previous file version and make it the current version of the file. This create a copy of the old file version and puts it on the top of the versions stack. The file will have the exact same contents, the same SHA-1/etag, and the same name as the original. Other properties such as comments do not get updated to their former values.
Delete Old Version
Discards a file version to the trash.
Folder Object
Get Folder Info
Get information about a folder.
Get Folder Items
Gets all of the files, folders, or web links contained within this folder.
Create Folder
Create a new folder.
Update Folder
Update a folder.
Delete Folder
Move a folder to the trash. The recursive
parameter must be included in order to delete folders that aren't empty.
Copy Folder
Used to create a copy of a folder in another folder. The original version of the folder will not be altered.
Get Folder Collaborations
Use this to get a list of all the collaborations on a folder i.e. all of the users that have access to that folder.
Get Trashed Items
Gets the files, folders and web links that are in the user's trash.
Get Trashed Item
Geta an item that has been moved to the trash.
Restore Item
Restores an item that has been moved to the trash.
Permanently Delete Item
Permanently delete an item that is in the trash. The item will no longer exist in Box. This action cannot be undone.
Searching for Content
The search endpoint provides a powerful way to find Box content. Use the parameters described in this section to control what you search for.
Overview
Metadata Templates
Get Metadata Template
Get information about a metadata template.
Create Metadata Template
Create a new metadata template with the specified schema.
Update Metadata Template
Update a metadata template.
Get Enterprise Templates
Used to retrieve all metadata templates within a user's enterprise. Only the enterprise
scope is supported.
Metadata Object
Get All Metadata on File
Used to retrieve all metadata associated with a given file
Get Metadata on File
Get the metadata instance for a file.
Create Metadata on File
Create a metadata instance for a file.
Update Metadata on File
Update a metadata instance on a file.
Delete Metadata on File
Delete the template instance on a file.
Get All Metadata on Folder
Used to retrieve all metadata associated with a given folder
Get Metadata on Folder
Get the metadata instance for a folder.
Create Metadata on Folder
Create a metadata instance for a folder.
Update Metadata on Folder
Update the metadata instance for a folder. Updates can be either add
, replace
, remove
, or test
. The template instance can only be updated if the template instance already exists. When editing metadata, only values that adhere to the metadata template schema will be accepted.
Delete Metadata on Folder
Delete the metadata instance for a folder.
User Object
Get Current User
Get information about the user who is currently logged in (i.e. the user for whom this auth token was generated).
Get User
Get information about a user in the enterprise. Requires enterprise administration authorization.
Create User
Create a new managed user in an enterprise. This method only works for enterprise admins.
Create App User
Create a new app user in an enterprise. This method only works for service accounts.
An App User is a Box account that belongs to your Box Platform application, not an end-user of Box. Unlike typical Box accounts, these accounts do not have an associated login and can only be accessed through the Box API. For more information about users, please visit this page.
Update User
Update the information for a user.
Delete User
Delete a user.
Get Enterprise Users
Returns all of the users for the Enterprise. Only available to admin accounts or service accounts.
Invite User
Invite an existing user to join an Enterprise.
Move Owned Items
Move all of the items owned by a user into a new folder in another user’s account.
Change User's Login
Used to convert one of the user’s confirmed email aliases into the user’s primary login.
Get Email Aliases
Retrieves all email aliases for this user. The collection of email aliases does not include the primary login for the user; use GET /users/USER_ID
to retrieve the login email address.
Create Email Alias
Adds a new email alias to the given user’s account.
Delete Email Alias
Removes an email alias from a user.
Group Object
Get Group
Get information about a group.
Create Group
Create a new group.
Update Group
Update a group.
Delete Group
Delete a group.
Get Enterprise Groups
Returns all of the groups for given enterprise. Must have permissions to see an enterprise's groups.
Membership Object
Get Membership
Fetches a specific group membership entry.
Create Membership
Add a member to a group.
Update Membership
Update a group membership.
Delete Membership
Delete a group membership.
Get Memberships for Group
Returns all of the members for a given group if the requesting user has access (see Group Object member_viewability_level
).
Get Memberships for User
Returns all of the group memberships for a given user. Note this is only available to group admins. To retrieve group memberships for the user making the API request, use the users/me/memberships endpoint.
Get Collaborations for Group
Returns all of the group collaborations for a given group. Note this is only available to group admins.
Collaboration Object
Get Collaboration
Get information about a collaboration.
Create Collaboration
Create a new collaboration that grants a user or group access to a file or folder in a specific role.
Update Collaboration
Update a collaboration.
Delete Collaboration
Delete a collaboration.
Pending Collaborations
Get all pending collaboration invites for a user.
Comment Object
Get Comment
Get information about a comment.
Create Comment
Create a new comment.
Update Comment
Update a comment.
Delete Comment
Delete a comment.
Web Link Object
Web links are objects that point to URLs. These objects are also known as bookmarks within the Box web application. Web link objects are treated similarly to file objects, so they will also support shared links, copy, permanent delete, and restore with the format /web_links/{WEB_LINK_ID}
in place of /files/{FILE_ID}
.
Get Web Link
Get information about a web link.
Create Web Link
Create a new web link.
Update Web Link
Update a web link.
Delete Web Link
Move a web link to the trash.
Events Overview
User Events
Enterprise Events
Event Object
User Events
Use this to get events for a given user. A chunk of event objects is returned for the user based on the parameters passed in. Parameters indicating how many chunks are left as well as the next stream_position are also returned.
Enterprise Events
Retrieves up to a year' events for all users in an enterprise. Upper and lower bounds as well as filters can be applied to the results. A list of valid values for event_type
can be found here.
The max number of events that can be returned from this endpoint is 500.
Long polling
To get real-time notification of activity in a Box account you can use the long poll feature of the /events API.
Overview of Webhooks V2
Event Triggers
Webhook Notifications
The Notification Payload
Handling Notifications
The Webhook Object
Signatures
Deleting a Webhook
Using the API
Limitations and Restrictions
Error Codes
Get Webhooks
Get all webhooks in an enterprise.
Get Webhook
Get information about a webhook.
Create Webhook
Create a new webhook.
Update Webhook
Update a webhook.
Delete Webhook
Delete a webhook.
Watermarking Overview
Get Watermark on File
Used to retrieve the watermark for a corresponding Box file.
Apply Watermark on File
Used to apply or update the watermark for a corresponding Box file. The endpoint accepts a JSON body describing the watermark to apply.
Remove Watermark on File
Used to remove the watermark for a corresponding Box file.
Get Watermark on Folder
Used to retrieve the watermark for a corresponding Box folder.
Apply Watermark on Folder
Used to apply or update the watermark for a corresponding Box folder. The endpoints accepts a JSON body describing the watermark to apply.
Remove Watermark on Folder
Used to remove the watermark for a corresponding Box folder.
Device Pin Object
Get Device Pin
Gets information about an individual device pin.
Delete Device Pin
Delete individual device pin.
Get Enterprise Device Pins
Gets all the device pins within a given enterprise. Must be an enterprise admin with the manage enterprise scope to make this call.
Collection Object
Collections contain information about the items contained inside of them, including files and folders. The only collection available is the “Favorites” collection. The contents of the collection are discovered in a similar way in which the contents of a folder are discovered.
Get Collections
Retrieves the collections for the given user. Only the Favorites
collection is supported.
Get Collection Items
Retrieves the files and/or folders contained within this collection. Collection item lists behave a lot like getting a folder’s items.
Add or Delete Items From a Collection
To add or remove an item from a collection, you do a PUT on that item and change the list of collections it belongs to. Philosophically, this is similar to the way “move” operations work on files and folders: you do a PUT on the item and change its parent. It’s the same idea with collections, except you’re changing which collection(s) the item belongs to instead of the folder it belongs to. The only collection available is the "Favorites" collection, and you’ll need to know it’s ID for the user that is making the API call, since every user has a different favorites collection_id.
The Add/Remove API handling will check all IDs passed in before performing any add/removal operations. If any collection IDs are malformed or do not exist in the user’s account, the API call will throw a 400. Only if all of the collection IDs are valid will the adds and removals be carried out.
Task Object
Get Task
Fetches a specific task.
Create Task
Used to create a single task for single user on a single file.
Update Task
Updates a specific task.
Delete Task
Permanently deletes a specific task.
Get Task Assignment
Fetches a specific task assignment.
Create Task Assignment
Used to assign a task to a single user. There can be multiple assignments on a given task.
Update Task Assignment
Used to update a task assignment.
Delete Task Assignment
Deletes a specific task assignment.
Get Task Assignments
Retrieves all of the assignments for a given task.
Retention Policy Object
Get Retention Policy
Used to retrieve information about a retention policy
Create Retention Policy
Used to create a new retention policy.
Update Retention Policy
Used to update a retention policy.
Get Retention Policies
Retrieves all of the retention policies for the given enterprise.
Retention Assignment Object
Get Retention Policy Assignment
Used to retrieve information about a retention policy assignment.
Create Retention Policy Assignment
Returns a list of all retention policy assignments associated with a specified retention policy.
Get Retention Policy Assignments
Returns a list of all retention policy assignments associated with a specified retention policy.
File Version Retention Object
Get File Version Retention
Used to retrieve information about a file version retention
Get File Version Retentions
Retrieves all file version retentions for the given enterprise.
Legal Hold Object
Get Legal Hold Policy
Get information about a legal hold policy.
Create Legal Hold Policy
Create a new legal hold policy.
Update Legal Hold Policy
Update a legal hold policy.
Delete Legal Hold Policy
Sends a request to delete an existing legal hold policy. Note that this is an asynchronous process - the policy will not be fully deleted yet when the response comes back.
Get Legal Hold Policies
Get all of the legal hold policies for the enterprise.
Legal Hold Assignment Object
Get Policy Assignment
Get information about a policy assignment.
Create New Policy Assignment
Create a new policy assignment, which applies the legal hold policy to the target of the assignment.
Delete Policy Assignment
Sends a request to delete an existing policy assignment. Note that this is an asynchronous process - the policy assignment will not be fully deleted yet when the response comes back.
Get Policy Assignments
Get all of the assignments for a legal hold policy.
File Version Legal Hold Object
Get File Version Legal Hold
Get information about a file version legal hold.
Get File Version Legal Holds
Get all of the non-deleted legal holds for a single legal hold policy.