Box Developers

Suggest Edits

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.

 

Box API 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.

Before you do anything, you should create a free Box account that you can test the API against and register for an API key so that you can make API calls.

If you are building custom applications for users with a Box account, you can follow the authentication instructions using OAuth 2.

If you are building custom applications and wish to leverage the Box API without requiring a Box account, you will need to use Box Platform. You can find a tutorial for building with Box Platform here.

Example Requests

Sample API calls are provided next to each method using cURL, a standard command line tool. All you need to do is drop in your specific parameters, and you can test the calls from the command line. If the command line isn’t your preference, a great alternative is Postman, an easy-to-use Chrome extension for making HTTP requests. Or you can always use one of our SDKs instead of making direct API calls.

Input/Output Format

Both request body data and response data are formatted as JSON. Extremely large numbers (for example the folder size) are returned in IEEE754 format (the same way doubles are stored in Java), e.g. 1.2318237429383e+31.

Date Format

All timestamps (both those sent in requests and those returned in responses) should be formatted as shown in our examples. We support RFC 3339 timestamps. The preferred way to pass in a date is by converting the time to UTC such as this: 2013-04-17T09:12:36-00:00.

In cases where timestamps are rounded to a given day, you may omit the time component. So instead of 2013-04-17T13:35:01+05:00 you can use 2013-04-17. If a time (and not just a date) however, is specified in a request then the calendar date in the Pacific timezone at the moment specified is the day that is accepted.

Box supports the subset of dates after the start of the Unix epoch: 1970-01-01T00:00:00+00:00 (00:00:00 UTC on January 1, 1970).

As a note, the timestamp you receive from the Box API is based on the settings in the Admin console. If you are a part of an enterprise, it will be the default user settings set by your admin.

gzip

If you would like responses from Box to be compressed for faster response times, simply include an Accept-Encoding header with a value of gzip, deflate, and responses will be gzipped.

Getting Help

If you have any questions or feedback, please post on the Box developer forum.

Suggest Edits

Suppressing Notifications

 

If you are making administrative API calls (that is, your application has “Manage an Enterprise” scope, and the user signing in is a co-admin with the correct "Edit settings for your company" permission) then you can suppress both email and webhook notifications by including a Box-Notifications header with the value off. This can be used, for example, for a virus-scanning tool to download copies of everyone’s files in an enterprise, without every collaborator on the file getting an email saying “The Acme-Virus-scanner just downloaded your “Acme exploding tennis balls instructions”. All actions will still appear in users updates feed and the audit-logs.

Notification suppression is available to be turned on for approved applications only. Contact us to explain your application’s use of notification suppression.

Note

User creation, comment, collaboration creation, change user's login, and task assignment notifications cannot be suppressed using this header.

CORS, or cross-origin resource sharing, is a mechanism that allows a web page to make XMLHttpRequests to another domain (i.e. a domain different from the one it was loaded from). CORS is supported in a specific set of modern browsers. The Box API supports CORS on an app-by-app basis. You can add a comma separated list of origins that can make CORS requests to the API, through the developer console.

A quick tutorial can be found here.

CORS Downloads

CORS is not supported for downloading content.

CORS-Like Errors

Some browsers will return a CORS-like error, even when CORS is enabled for your application. In these scenarios, an HTTP response code will often be included (e.g. 400 or 401) which will provide further direction where you may want to focus troubleshooting. No further CORS enablement is done in the Box backend.

Suggest Edits

Pagination

 

APIs that can return large numbers of objects return the results using a paging mechanism. Some APIs use offset-based paging and some use marker-based paging.

Suggest Edits

Offset-based Paging

 

APIs that use offset-based paging use the offset and limit query parameters. The API returns an object that contains the set of results in the entries array, as well as returning the offset, limit, and total_count fields.

To fetch the first set of entries, call the API with offset = 0 and limit = <your-limit>.

To fetch the next set of entries, call the API with offset = <previous-offset> + <previous-limit>. Note that you should increment the offset by the previous limit -- not by the size of the entries array (which may be less than limit). Use the value of limit that is returned in the response object rather than the value you passed in the query parameter.

If <previous-offset> + <previous-limit> >= total_count, then you have retrieved all of the entries and there are no more to fetch. The total number of entries in the entire collection may be less than total_count. Note that the total_count may change between API calls, so always use the most recent value.

Query Parameters:

offset

integer

The 0-based offset of the first entry to return. The default is 0.

limit

integer

The maximum number of entries to return. Each API has a default and maximum value. If the value exceeds the maximum, then the maximum value will be used and returned in the limit field in the response.

Response Object:

entries

array

The array of objects for the current set of results. It will be an empty array if there are no results.

offset

integer

The 0-based offset of the first entry in this set. This will be the same as the offset query parameter.

limit

integer

The limit that was used for these entries. This will be the same as the limit query parameter unless that value exceeded the maximum value allowed. The maximum value varies by API.

total_count

integer

One greater than the offset of the last entry in the entire collection. The total number of entries in the collection may be less than total_count.

Suggest Edits

Marker-based Paging

 

APIs that use marker-based paging use the marker and limit query parameters. The API returns an object that contains the set of results in the entries array, as well as returning the next_marker and limit fields.

To fetch the first set of entries, call the API with limit = <your-limit>.

To fetch the next set of entries, call the API with marker = <next_marker> and limit = <your-limit>.

If next_marker is empty, then you have retrieved all of the entries and there are no more to fetch. Note that you have reached the end if the next_marker is not present, equal to null, or equal to "".

With marker-based paging there is no way to determine the total number of entries in the collection except by fetching them all. Applications should not retain the markers long-term, since the internal implementation of the markers may change over time.

Query Parameters:

marker

string

The position to return results from. This should be a value that was returned in next_marker in a previous call to this API.

limit

integer

The maximum number of entries to return. Each API has a default and maximum value. If the value exceeds the maximum, then the maximum value will be used and returned in the limit field in the response.

Response Object:

entries

array

The array of objects for the current set of results. It will be an empty array if there are no results.

next_marker

string

The value to pass as the marker query parameter to fetch the next set of entries. If the next_marker field is not present or equal to null or "" then there are no more entries.

limit

integer

The limit that was used for these entries. This will be the same as the limit query parameter unless that value exceeded the maximum value allowed. The maximum value varies by API.

Suggest Edits

Errors

The Box API communicates errors through standard HTTP status codes with details supplied in JSON objects. Generally the following pattern applies:

 
  • 2xx - Box received, understood, and accepted a request.
  • 3xx - The user agent must take further action in order to complete the request.
  • 4xx - An error occurred in handling the request. The most common cause of this error is an invalid parameter.
  • 5xx- Box received and accepted the request, but an error occurred in the Box service while handling it.

HTTP Status Codes

200 success
201 created
202 accepted
204 no_content
302 redirect
304 not_modified
400 bad_request
401 unauthorized
403 forbidden
404 not_found
405 method_not_allowed
409 conflict
412 precondition_failed
429 too_many_requests
500 internal_server_error
503 unavailable

Error Code Response

Name
Error

type

string

"error" in error responses.

status

int

The HTTP status of the response.

code

string

A specific Box error code listed here

context_info

object

Additional context information describing the error.

context_info.errors

array

An array of error objects giving context for the error; each object includes reason, name, and message properties.

help_url

string

A URL that links to more information about why the error occurred.

message

string

A human-readable message describing the error.

request_id

string

A unique ID that identifies this request. The ID can be helpful when troubleshooting requests.

EXAMPLE ERROR

{
    "type": "error",
    "status": 409,
    "code": "conflict",
    "context_info": {
        "errors": [
            {
                "reason": "invalid_parameter",
                "name": "group_tag_name",
                "message": "Invalid value 'All Box '. A resource with value 'All Box ' already exists"
            }
        ]
    },
    "help_url": "http://developers.box.com/docs/#errors",
    "message": "Resource with the same name already exists",
    "request_id": "2132632057555f584de87b7"
}

Detailed Error Codes

The following table lists the most common error responses you are likely to see when developing Box applications. This list is not exhaustive; additional errors can occur. If your application handles all of these responses, though, then it's likely to be a robust application that gracefully handles the majority of user interactions and internet issues.

Box recommends that you begin by handling the most generic errors (for example, error codes 401 and 403), and then gradually add handling for more and more specific errors.

status
error_code
message

400

bad_request

400

item_name_invalid

Item name invalid

400

terms_of_service_required

User must accept custom terms of service before action can be taken

400

requested_preview_unavailable

Requested preview unavailable

400

folder_not_empty

Cannot delete – folder not empty

400

invalid_request_parameters

Invalid input parameteres in request

400

user_already_collaborator

User is already a collaborator

400

cannot_make_collaborated_subfolder_private

Cannot move a collaborated subfolder to a private folder unless the new owner is explicitly specified

400

item_name_too_long

Item name too long

400

collaborations_not_available_on_root_folder

Root folder cannot be collaborated

400

sync_item_move_failure

Cannot move a synced item

400

requested_page_out_of_range

Requested representation page out of range

400

cyclical_folder_structure

Folder move creates cyclical folder structure

400

bad_digest

The specified Content-MD5 did not match what we received

400

invalid_collaboration_item

Item type must be specified and set to ‘folder’

400

task_assignee_not_allowed

Assigner does not have sufficient privileges to assign task to assignee

400

invalid_status

You can change the status only if the collaboration is pending

401

unauthorized

Unauthorized

403

forbidden

403

storage_limit_exceeded

Account storage limit reached

403

access_denied_insufficient_permissions

Access denied – insufficient permission

403

access_denied_item_locked

Access denied – item locked

403

file_size_limit_exceeded

File size exceeds the folder owner’s file size limit

403

incorrect_shared_item_password

403

access_from_location_blocked

You’re attempting to log in to Box from a location that has not been approved by your admin. Please talk to your admin to resolve this issue.

404

not_found

404

preview_cannot_be_generated

Preview cannot be generated

404

trashed

Item is trashed

404

not_trashed

Item is not trashed

405

method_not_allowed

Method Not Allowed

409

item_name_in_use

Item with the same name already exists

409

conflict

A resource with this value already exists

409

user_login_already_used

User with the specified login already exists

409

recent_similar_comment

A similar comment has been made recently

409

operation_blocked_temporary

The operation is blocked by another ongoing operation.

412

sync_state_precondition_failed

The resource has been modified. Please retrieve the resource again and retry

412

precondition_failed

The resource has been modified. Please retrieve the resource again and retry

429

rate_limit_exceeded

Request rate limit exceeded, please try again later

500

internal_server_error

Internal Server Error

503

unavailable

Unavailable

Each object has "standard" and "mini" formats, which include a certain set of fields:

  • The standard format is returned when you request a specific object (e.g. GET /files/{id}).
  • The mini format is returned when the object is part of a set of items (e.g. GET /files/{id}/comments).
  • Less-frequently used fields are not included in either the standard or mini format. These are listed in italics in the object definitions.

In addition to the standard and mini formats, you can have the API return a specific set of fields using the fields query parameter. Specify a comma-separated list of the field names (with no spaces after the commas). Only the fields you request are returned, as well as the type and id fields (which are always returned). For example, if you call GET /files/{id}?fields=modified_at,path_collection,name, it will return the type, id, modified_at, path_collection, and name fields.

EXAMPLE REQUEST

curl https://api.box.com/2.0/files/FILE_ID?fields=modified_at,path_collection,name
-H "Authorization: Bearer ACCESS_TOKEN"

EXAMPLE RESPONSE

{
    "type": "file",
    "id": "3447956798",
    "etag": "1",
    "modified_at": "2012-10-04T12:34:05-07:00",
    "path_collection": {
        "total_count": 2,
        "entries": [
            {
                "type": "folder",
                "id": "0",
               	"sequence_id": null,
              	"etag": null,
                "name": "All Files"
           },
           {
               "type": "folder",
               "id": "423404344",
               "sequence_id": "15",
               "etag": "15",
               "name": "General Info"
           }
       ]
   },
   "name": "Org Chart.PDF"
}

Supported APIs

The fields parameter is not supported for the GET /events, POST /files/content, and POST /files/{id}/content APIs.

Suggest Edits

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.

 

Etags

Every files and folders object has an etag attribute that is unique across every version of that file or folder. Etags are unique across versions of items, but not across different items. For example, the first version of File XYZ can have an etag value of “1”, and the first version of File ABC “1”, but any other version of File XYZ must have an etag value that is not “1”.

Etag:

You should make no assumptions about the value of etags outside of the fact that they are unique for each version of particular file or folder relative to other versions of that file or folder.

Using If-(None-)Match

The methods that can be used with If-Match are listed on the right. The following tables summarize the behavior you can expect when using If-Match:

If-Match Header Has Most Current Etag

RESOURCE EXISTS

HTTP Status of Response: 200

RESOURCE DOES NOT EXIST

HTTP Status of Response: 412

If-Match Header Does Not Have Most Current Etag

RESOURCE EXISTS

HTTP Status of Response: 412

RESOURCE DOES NOT EXIST

HTTP Status of Response: 404

The following behavior will be found with the If-None-Match header:

If-None-Match Header Has Most Current Etag

RESOURCE EXISTS

HTTP Status of Response: 304

RESOURCE DOES NOT EXIST

HTTP Status of Response: 404

If-None-Match Header Does Not Have Most Current Etag

RESOURCE EXISTS

HTTP Status of Response: 200

RESOURCE DOES NOT EXIST

HTTP Status of Response: 404

IF-MATCH SUPPORTED METHODS

POST /files/{id}/content
PUT /files/{id}
DELETE /files/{id}
PUT /folders/{id}
DELETE /folders/{id}

IF-NONE-MATCH SUPPORTED METHODS

GET /files/{id}
GET /folders/{id}
GET /shared_items
Suggest Edits

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.

 

Note:

Admins can use As-User to impersonate any managed users including co-admins. Co-admins can use As-User to impersonate managed users, but cannot impersonate any admin or co-admin. A 403 Forbidden error will be returned.

As-User has replaced the previous On-Behalf-Of functionality. As-User is more robust because it is tied to a static user_id instead of a dynamic email address that may change. On-Behalf-Of functionality will continue to be supported, but we recommend migrating to the As-User header.

EXAMPLE REQUEST (with standard OAuth 2.0)

curl https://api.box.com/2.0/folders/0?fields=item_collection,name \
-H "Authorization: Bearer ACCESS_TOKEN_OF_THE_ADMIN" \
-H "As-User: 10543463" 

EXAMPLE RESPONSE

{
 "type": "folder",
    "id": "0",
    "etag": null,
    "name": "All Files",
    "item_collection": {
        "total_count": 4,
        "entries": [
            {
                "type": "folder",
                "id": "494447198",
                "etag": "0",
                "name": "Archive"
            },
            {
                "type": "folder",
                "id": "611745226",
                "etag": "1",
                "name": "Customer Info"
            },
            {
                "type": "folder",
                "id": "329767175",
                "etag": "0",
                "name": "Vendors"
            },
            {
                "type": "folder",
                "id": "632559865",
                "etag": "0",
                "name": "Human Resources"
            }
        ],
        "offset": 0,
        "limit": 100,
        "order": [
            {
                "by": "type",
                "direction": "ASC"
            },
            {
                "by": "name",
                "direction": "ASC"
            }
        ]
    }
}
Suggest Edits

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.

 

RETRY HEADER

HTTP/1.1 429 Too Many Requests
Retry-After: {retry time in seconds}
 

Box uses OAuth 2.0 to authenticate connections that use the Box APIs. OAuth 2 is an open protocol for authentication used with web, mobile, and desktop applications. Every use of Box APIs requires authentication so that Box can ensure that only authorized users can interact with Box content. OAuth 2 is the protocol that Box uses for such authentication.

Box uses the standard OAuth 2 three-legged authentication process, which proceeds as follows:

  1. The application asks an authentication service to present a login request to a user.
  2. After a successful login, the authentication service returns an authorization code to the application.
  3. The application exchanges the authorization code for an access token.

The application can then use the access token with API requests to gain access to the user's resources by including the token in an authorization header named access_token.

The Box HTTP APIs provide full access to standard OAuth 2 authentication. You can use API calls to implement authentication for your applications. In addition, Box also provides several SDKs that manage OAuth 2 authentication for you, simplifying the authentication process for applications that are built on the SDKs.

For machine-to-machine use cases, such as applications that use Box services for back-end storage, but which provide their own user-inteface, Box extends OAuth 2 with JSON Web Tokens (JWT). Authentication using JWT enables your application to authenticate itself directly to Box without needing to display any Box user interface elements.

Whether you use plain OAuth 2 authentication and the Box login screen, or OAuth2 with JWT and your own user interface, and whether you use a Box SDK or build your authentication using direct API requests, your application uses the same authentication services used by Box products. You inherit all Box features, including the ability to work with single sign-on systems that support Box.

OAuth Endpoint

The HTTP endpoint for Box authentication is:

https://api.box.com/oauth2

Authorization Header

Following in the format of a Box authorization header:

Authorization: Bearer <MY_ACCESS_TOKEN>

You must replace <MY_ACCESS_TOKEN> with a valid access token returned to your application by Box.

Suggest Edits

Authorize

 

https://account.box.com/api/oauth2/authorize

This is the URL of the Box login endpoint. To begin the process of authenticating and authorizing an application to work with the Box APIs, send an HTTP request like the following:

https://account.box.com/api/oauth2/authorize?response_type=code&client_id=<MY_CLIENT_ID>&redirect_uri=<MY_REDIRECT_URL>&state=<MY_SECURITY_TOKEN>

This request passes the following parameters:

Parameter
Description
Description

response_type

String

The type of OAuth 2 grant you are requesting. Use the value code.

client_id

String

The client ID of the application requesting authentication. To get the client ID for your application, log in to your Box developer console and click the Edit Application link for the application you're working with. In the OAuth 2 Parameters section of the configuration page, find the item labeled "client_id". The text of that item is your application's client ID.

redirect_uri

URI

The URL to which Box redirects the browser when authentication completes. The user's actual interaction with your application begins when Box redirects to this URL. You must supply the redirect URL in the configuration page of your application. It must be a valid HTTPS URL that resolves to a valid IP address. The IP address must not be a Box address, and there must be a working web service or application accessible at the address that can correctly handle Box requests.

state

String

A text string that you choose. Box sends the same string to your redirect URL when authentication is complete. This parameter is provided for your use in protecting against hijacked sessions and other attacks.

scope optional

String

This optional parameter identifies the Box scopes available to the application once it's authenticated. If you don't supply this parameter then Box grants access to the default scopes configured for the application in its configuration page. You can limit the scopes available to the application by passing a space delimited list of Box scopes.

Note

The authorize endpoint uses a different URL from other Box API calls: account.box.com/api instead of api.box.com.

Example

Using the Authorize URL

https://account.box.com/api/oauth2/authorize?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&state=security_token%3DKnhMJatFipTAnM0nHlZA

Example Response

<MY_REDIRECT_URI>?code=<MY_AUTHORIZATION_CODE>

https://api.box.com/oauth2/token

This is the URL of the Box token endpoint, the endpoint that returns access tokens. An access token is a data string that enables Box to verify that a request belongs to an authorized session. In the normal order of operations you will begin by requesting authentication from the Box authorize endpoint and Box will send you an authorization code. You will then send the authorization code to the token endpoint in a request for an access token. You can then use the returned access token to make Box API calls.

To exchange an authorization code for an access token, send a request like the following:

curl https://api.box.com/oauth2/token \
-d 'grant_type=authorization_code' \
-d 'code=<MY_AUTH_CODE>' \
-d 'client_id=<MY_CLIENT_ID>' \
-d 'client_secret=<MY_CLIENT_SECRET>' \
-X POST

The parameters used in this request are as follows:

Parameter
Type
Description

grant_type

String

authorization_code

code

String

The authorization code returned by Box in response to a successfull authentication request.

client_id

String

The client ID of the application requesting authentication. To get the client ID for your application, log in to your Box developer console and click the Edit Application link for the application you're working with. In the OAuth 2 Parameters section of the configuration page, find the item labeled "client_id". The text of that item is your application's client ID.

client_secret

String

The client secret of the application requesting authentication. To get the client secret for your application, log in to your Box developer console and click the Edit Application link for the application you're working with. In the OAuth 2 Parameters section of the configuration page, find the item labeled "client_secret". The text of that item is your application's client secret.

Example

Using the Token URL

curl https://api.box.com/oauth2/token \
-d 'grant_type=authorization_code' \
-d 'code=<MY_AUTH_CODE>' \
-d 'client_id=<MY_CLIENT_ID>' \
-d 'client_secret=<MY_CLIENT_SECRET>' \
-X POST

Example Response

{
    "access_token": "T9cE5asGnuyYCCqIZFoWjFHvNbvVqHjl",
    "expires_in": 3600,
    "restricted_to": [],
    "token_type": "bearer",
    "refresh_token": "J7rxTiWOHMoSC1isKZKBZWizoRXjkQzig5C6jFgCVJ9bUnsUfGMinKBDLZWP9BgR"
}

https://api.box.com/oauth2/revoke

This is the URL of the Box revoke endpoint, the endpoint that revokes access tokens, or to put it another way, the endpoint that ends sessions, logging users out.

To revoke an access token, ending the session and loggingthe user out of Box, send a request like the following:

curl https://api.box.com/oauth2/revoke \
-d 'client_id=MY_CLIENT_ID' \
-d 'client_secret=MY_CLIENT_SECRET' \
-d 'token=MY_TOKEN' \
-X POST

The parameters sent with this request are as follows:

Parameter
Type
Description

client_id

String

The client ID of the application requesting revocation. To get the client ID for your application, log in to your Box developer console and click the Edit Application link for the application you're working with. In the OAuth 2 Parameters section of the configuration page, find the item labeled "client_id". The text of that item is your application's client ID.

client_secret

String

The client secret of the application requesting authentication. To get the client secret for your application, log in to your Box developer console and click the Edit Application link for the application you're working with. In the OAuth 2 Parameters section of the configuration page, find the item labeled "client_secret". The text of that item is your application's client secret.

token

String

An access token or refresh token supplied by Box in response to a token request. When either token is supplied with this request, both will be revoked.

Suggest Edits

File Object

 

File information describe file objects in Box, with attributes like who created the file, when it was last modified, and other information. The actual content of the file itself is accessible through the /files/{id}/content endpoint. Italicized attributes are not returned by default and must be retrieved through the fields parameter.

Supported Filenames:

Box only supports file names of 255 characters or less. Names that will not be supported are those that contain non-printable ascii, / or \, names with leading or trailing spaces, and the special names “.” and “..”.

type

string

file

id

string

The ID of the file object

file_version

object

The version information of the file

sequence_id

string

A unique ID for use with the /events endpoint

etag

string

The entity tag of this file object. Used with If-Match headers.

sha1

string

The SHA-1 hash of this file

name

string

The name of this file

description

string

The description of this file

size

integer

Size of this file in bytes

path_collection

object

The path of folders to this item, starting at the root

created_at

date-time

When this file was created on Box’s servers

modified_at

date-time

When this file was last updated on the Box servers

trashed_at

date-time

When this file was last moved to the trash

purged_at

date-time

When this file will be permanently deleted

content_created_at

date-time

When the content of this file was created (more info)

content_modified_at

date-time

When the content of this file was last modified (more info)

created_by

mini user object

The user who first created this file

modified_by

mini user object

The user who last updated this file

owned_by

mini user object

The user who owns this file

shared_link

object

The shared link object for this file. Will be null if no shared link has been created.

parent

mini folder object

The folder containing this file

item_status

string

Whether this item is deleted or not. Values include active, trashed if the file has been moved to the trash, and deleted if the file has been permanently deleted

version_number

string

The version number of this file

comment_count

integer

The number of comments on this file

permissions

object

An object containing the permissions that the current user has on this file. The keys are can_download, can_preview, can_upload, can_comment, can_rename, can_invite_collaborator, can_invite_collaborator,can_delete, can_share, can_invite_collaborator, and can_set_share_access. Each key has a boolean value.

tags

array of strings

All tags applied to this file

lock

object

The lock held on this file. null if there is no lock.

extension

string

Indicates the suffix, when available, on the file. By default, set to an empty string. The suffix usually indicates the encoding (file format) of the file contents or usage.

is_package

boolean

Whether the file is a package. Used for Mac Packages used by iWorks.

expiring_embed_link

string

An expiring URL for an embedded preview session in an iframe. This URL will expire after 60 seconds and the session will expire after 60 minutes.

watermark_info

object

Information about the watermark status of this file. See Watermarking for additional endpoints.

Fields:
is_watermarked (boolean): Whether the file is watermarked or not.

{
    "type": "file",
    "id": "5000948880",
    "file_version": {
        "type": "file_version",
        "id": "26261748416",
        "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc "
    },
    "sequence_id": "3",
    "etag": "3",
    "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc",
    "name": "tigers.jpeg",
    "description": "a picture of tigers",
    "size": 629644,
    "path_collection": {
        "total_count": 2,
        "entries": [
            {
                "type": "folder",
                "id": "0",
                "sequence_id": null,
                "etag": null,
                "name": "All Files"
            },
            {
                "type": "folder",
                "id": "11446498",
                "sequence_id": "1",
                "etag": "1",
                "name": "Pictures"
            }
        ]
    },
    "created_at": "2012-12-12T10:55:30-08:00",
    "modified_at": "2012-12-12T11:04:26-08:00",
    "trashed_at": null,
    "purged_at": null,
    "content_created_at": "2013-02-04T16:57:52-08:00",
    "content_modified_at": "2013-02-04T16:57:52-08:00",
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "modified_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "owned_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "shared_link": {
        "url": "https://www.box.com/s/rh935iit6ewrmw0unyul",
        "download_url": "https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg",
        "vanity_url": null,
        "is_password_enabled": false,
        "unshared_at": null,
        "download_count": 0,
        "preview_count": 0,
        "access": "open",
        "permissions": {
            "can_download": true,
            "can_preview": true
        }
    },
    "parent": {
        "type": "folder",
        "id": "11446498",
        "sequence_id": "1",
        "etag": "1",
        "name": "Pictures"
    },
    "item_status": "active",
    "tags": [
        "cropped",
        "color corrected"
    ],
    "lock": {
        "type": "lock",
        "id": "112429",
        "created_by": {
            "type": "user",
            "id": "18212074",
            "name": "Obi Wan",
            "login": "obiwan@box.com"
        },
        "created_at": "2013-12-04T10:28:36-08:00",
        "expires_at": "2012-12-12T10:55:30-08:00",
        "is_download_prevented": false
    }
}
 
{
    "sequence_id": "0",
    "etag": "0",
    "type": "file",
    "id": "2631999573",
    "name":"IMG_1312.JPG"
}
Suggest Edits

Get File Info

Get information about a file.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/files/file_id

Path Params

file_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response

Note

The shared_link.download_url is only returned for paid accounts.

Returns

A standard file object is returned if the ID is valid and if the user has access to the file.

curl https://api.box.com/2.0/files/FILE_ID
-H "Authorization: Bearer 
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "file",
    "id": "5000948880",
    "file_version": {
        "type": "file_version",
        "id": "26261748416",
        "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc"
    },
    "sequence_id": "3",
    "etag": "3",
    "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc",
    "name": "tigers.jpeg",
    "description": "a picture of tigers",
    "size": 629644,
    "path_collection": {
        "total_count": 2,
        "entries": [
            {
                "type": "folder",
                "id": "0",
                "sequence_id": null,
                "etag": null,
                "name": "All Files"
            },
            {
                "type": "folder",
                "id": "11446498",
                "sequence_id": "1",
                "etag": "1",
                "name": "Pictures"
            }
        ]
    },
    "created_at": "2012-12-12T10:55:30-08:00",
    "modified_at": "2012-12-12T11:04:26-08:00",
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "modified_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "owned_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "shared_link": {
        "url": "https://www.box.com/s/rh935iit6ewrmw0unyul",
        "download_url": "https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg",
        "vanity_url": null,
        "is_password_enabled": false,
        "unshared_at": null,
        "download_count": 0,
        "preview_count": 0,
        "access": "open",
        "permissions": {
            "can_download": true,
            "can_preview": true
        }
    },
    "parent": {
        "type": "folder",
        "id": "11446498",
        "sequence_id": "1",
        "etag": "1",
        "name": "Pictures"
    },
    "item_status": "active"
}
Suggest Edits

Download File

Retrieves the actual data of the file. An optional version parameter can be set to download a previous version of the file.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/files/file_id/content

Path Params

file_id
string
required

Query Params

version
string

Optional file version ID to download (defaults to the current version)

Headers

Range
string

The range value in bytes. Format should be bytes={start_range}-{end_range}

BoxApi
string

Use the format shared_link=SHARED_LINK_URL or shared_link=SHARED_LINK_URL&shared_link_password=PASSWORD

Returns

If the file is available to be downloaded, the response will be a 302 Found to a URL at dl.boxcloud.com. The dl.boxcloud.com URL is not persistent. Clients will need to follow the redirect in order to actually download the file. The raw data of the file is returned unless the file ID is invalid or the user does not have access to it.

If the file is not ready to be downloaded (i.e. in the case where the file was uploaded immediately before the download request), a response with an HTTP status of 202 Accepted will be returned with a Retry-After header indicating the time in seconds after which the file will be available for the client to download.

Sample Call:

For convenience, the sample cURL request includes a -L flag that will automatically follow the redirect to boxcloud.com. To change this behavior, simply remove the -L from the sample call.

curl -L https://api.box.com/2.0/files/FILE_ID/content
-H "Authorization: Bearer "
package com.box.sdk

public class BoxFile

public URL getDownloadURL()

public void downloadRange(OutputStream output, long rangeStart, long rangeEnd, ProgressListener listener)

public void download(OutputStream output, ProgressListener listener)
Files.prototype.getDownloadURL = function(fileID, qs, callback)

Files.prototype.getReadStream = function(fileID, qs, callback)
namespace Box.V2.Managers
class BoxFilesManager

public async Task<Stream> DownloadStreamAsync(string id, string versionId = null, TimeSpan? timeout = null)
  
public async Task<Uri> GetDownloadUriAsync(string id, string versionId = null)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Redirected to secured download at dl.boxcloud.com
Suggest Edits

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.

 
posthttps://upload.box.com/api/2.0/files/content

Body Params

name
string
required

The name of the file

parent
object
parent.id
string
required

The ID of the parent folder. Use "0" for the root folder.

content_created_at
date-time

The creation date of the file. See content times for formatting.

content_modified_at
date-time

The last modification date of the file

Headers

Content-MD5
string

The SHA-1 hash of the file

The request body uses the "multipart/form-data" format to transmit two "parts". The first part is called "attributes" and contains a JSON object with information about the file, including the name of the file and the ID of the parent folder. The second part contains the contents of the file. (Note that the name of the second "part" is ignored.)

Returns

A 201 will be received on successful upload. A file object is returned inside of a collection if the ID is valid and if the update is successful. Additionally, a 409 error is thrown when a name collision occurs.

Supported File Names:

Box only supports file names of 255 characters or less. Names that will not be supported are those that contain non-printable ascii, / or \, names with trailing spaces, and the special names “.” and “..”.

Name Collision

If you receive a name collision you can use the SHA-1 that is returned with the file to check if the existing file is identical to the one you are trying to upload.

Upload Limits

Upload limits are dictated by the type of account you have. More information can be found here

Note

For best performance, the "attributes" (JSON) part should come before the file part of the multipart form data.

curl https://upload.box.com/api/2.0/files/content \
  -H "Authorization: Bearer " -X POST \
  -F attributes='{"name":"tigers.jpeg", "parent":{"id":"11446498"}}' \
  -F file=@myfile.jpg
package com.box.sdk

public class BoxFolder

public BoxFile.Info uploadFile(FileUploadParams uploadParams)
Files.prototype.uploadFile = function(parentFolderID, filename, content, callback)
namespace Box.V2.Managers
class BoxFilesManager

public async Task<BoxFile> UploadAsync(BoxFileRequest fileRequest, Stream stream, List<string> fields = null, TimeSpan? timeout = null, byte[] contentMD5 = null, bool setStreamPositionToZero = true, Uri uploadUri = null)
  
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "total_count": 1,
    "entries": [
        {
            "type": "file",
            "id": "5000948880",
            "sequence_id": "3",
            "etag": "3",
            "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc",
            "name": "tigers.jpeg",
            "description": "a picture of tigers",
            "size": 629644,
            "path_collection": {
                "total_count": 2,
                "entries": [
                    {
                        "type": "folder",
                        "id": "0",
                        "sequence_id": null,
                        "etag": null,
                        "name": "All Files"
                    },
                    {
                        "type": "folder",
                        "id": "11446498",
                        "sequence_id": "1",
                        "etag": "1",
                        "name": "Pictures"
                    }
                ]
            },
            "created_at": "2012-12-12T10:55:30-08:00",
            "modified_at": "2012-12-12T11:04:26-08:00",
            "trashed_at": null,
            "purged_at": null,
            "content_created_at": "2013-02-04T16:57:52-08:00",
            "content_modified_at": "2013-02-04T16:57:52-08:00",
            "created_by": {
                "type": "user",
                "id": "17738362",
                "name": "sean rose",
                "login": "sean@box.com"
            },
            "modified_by": {
                "type": "user",
                "id": "17738362",
                "name": "sean rose",
                "login": "sean@box.com"
            },
            "owned_by": {
                "type": "user",
                "id": "17738362",
                "name": "sean rose",
                "login": "sean@box.com"
            },
            "shared_link": null,
            "parent": {
                "type": "folder",
                "id": "11446498",
                "sequence_id": "1",
                "etag": "1",
                "name": "Pictures"
            },
            "item_status": "active"
        }
    ]
}
Suggest Edits

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.

 
posthttps://upload.box.com/api/2.0/files/file_id/content

Path Params

file_id
string
required

Body Params

name
string

An optional new name for the file. If specified, the file will be renamed when the new version is uploaded.

content_modified_at
date-time

The last modification date of the file version. See content times for formatting.

Headers

If-Match
string

The etag field of the file object

Content-MD5
string

The SHA-1 hash of the file version

The request body uses the "multipart/form-data" format to transmit two "parts". The first part is called "attributes" and contains a JSON object with optional information about the file. The second part contains the contents of the file version. (Note that the name of the second "part" is ignored.)

Note that upload requests are processed by https://upload.box.com.

When uploading a new file version that has a different file type, use the name field to update the file extension. For example, when uploading Image.jpg as a new version of Image.png.

curl https://upload.box.com/api/2.0/files/FILE_ID/content \
-H "Authorization: Bearer " \
-H "If-Match: ETAG_OF_ORIGINAL" \
-F file=@FILE_NAME
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
  "total_count": 1,
  "entries": [
    {
      "type": "file",
      "id": "5000948880",
      "sequence_id": "3",
      "etag": "3",
      "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc",
      "name": "tigers.jpeg",
      "description": "a picture of tigers",
      "size": 629644,
      "path_collection": {
        "total_count": 2,
        "entries": [
          {
            "type": "folder",
            "id": "0",
            "sequence_id": null,
            "etag": null,
            "name": "All Files"
          },
          {
            "type": "folder",
            "id": "11446498",
            "sequence_id": "1",
            "etag": "1",
            "name": "Pictures"
          }
        ]
      },
      "created_at": "2012-12-12T10:55:30-08:00",
      "modified_at": "2012-12-12T11:04:26-08:00",
      "trashed_at": null,
      "purged_at": null,
      "content_created_at": "2013-02-04T16:57:52-08:00",
      "content_modified_at": "2013-02-04T16:57:52-08:00",
      "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
      },
      "modified_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
      },
      "owned_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
      },
      "shared_link": {
        "url": "https://www.box.com/s/rh935iit6ewrmw0unyul",
        "download_url": "https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg",
        "vanity_url": null,
        "is_password_enabled": false,
        "unshared_at": null,
        "download_count": 0,
        "preview_count": 0,
        "access": "open",
        "permissions": {
          "can_download": true,
          "can_preview": true
        }
      },
      "parent": {
        "type": "folder",
        "id": "11446498",
        "sequence_id": "1",
        "etag": "1",
        "name": "Pictures"
      },
      "item_status": "active"
    }
  ]
}
Suggest Edits

Preflight Check

 

OAuth2 Auth

 Authentication is required for this endpoint.
optionshttps://api.box.com/2.0/files/content

Body Params

name
string
required

The name of the file

parent
object
 
parent.id
string
required

The ID of the parent folder. Use "0" for the root folder.

size
int32

The size of the file in bytes

The Pre-flight check API will verify that a file will be accepted by Box before you send all the bytes over the wire. It can be used for both first-time uploads, and uploading new versions of an existing File (on /files/[id]/content). If the call returns a 200, then you can proceed with a standard upload call. Preflight checks verify all permissions as if the file was actually uploaded including:

  • Folder upload permission
  • File name collisions
  • File size caps
  • Folder and file name restrictions*
  • Folder and account storage quota

A 200 response does not guarantee that your upload call will succeed. In practice, it has been shown to reduce failed uploads by more than 99%. Highly active folders, common filenames, and accounts near their quota limits may get a 200 for the preflight, and then have a real conflict during the actual upload. Error handling is key to making your application behave well for your users. Errors returned are the same as for file uploads.

Supported File Names:

Box only supports file names of 255 characters or less. Names that will not be supported are those that contain non-printable ascii, / or \, names with trailing spaces, and the special names “.” and “..”.

Returns

A 200 is returned if the upload would be successful. An error is thrown when any of the preflight conditions are not met.

curl https://api.box.com/2.0/files/content \
-H "Authorization: Bearer " \
-d '{"name": "Wolves owners.ppt", "parent": {"id": "1523432"}, "size": 15243}' \
-X OPTIONS
package com.box.sdk

public class BoxFolder

public void canUpload(String name, long fileSize)

public class BoxFile

public void canUploadVersion(String name, long fileSize, String parentID)
Files.prototype.preflightUploadFile = function(parentFolderID, fileData, qs, callback)

Files.prototype.preflightUploadNewFileVersion = function(fileID, fileData, qs, callback)
namespace Box.V2.Managers
class BoxFilesManager

public async Task<BoxPreflightCheck> PreflightCheck(BoxPreflightCheckRequest preflightCheckRequest)
  
public async Task<BoxPreflightCheck> PreflightCheckNewVersion(string fileId, BoxPreflightCheckRequest preflightCheckRequest)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Try the API to see results
Suggest Edits

Update File Info

Update the information about a file, including renaming or moving the file.

 

OAuth2 Auth

 Authentication is required for this endpoint.
puthttps://api.box.com/2.0/files/file_id

Path Params

file_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response

Body Params

name
string

The new name for the file

description
string

The new description for the file

parent
object
 
parent.id
string

The ID of the parent folder

shared_link
object
 
shared_link.access
string

The level of access. Can be open ("People with the link"), company ("People in your company"), or collaborators ("People in this folder"). If you omit this field then the access level will be set to the default access level specified by the enterprise admin.

shared_link.password
string

The password required to access the shared link. Set to null to remove the password.

shared_link.unshared_at
date-time

The date-time that this link will become disabled. This field can only be set by users with paid accounts.

shared_link.permissions
object
 
shared_link.permissions.can_download
boolean

Whether the shared link allows downloads. Can only be set with access levels open and company (not collaborators).

tags
array of strings

All tags attached to this file. To add/remove a tag to/from a file, you can first get the file’s current tags (be sure to specify ?fields=tags, since the tags field is not returned by default); then modify the list as required; and finally, set the file’s entire list of tags.

Headers

If-Match
string

The etag of the file can be included as an ‘If-Match’ header to prevent race conditions.

To move a file, change the ID of its parent folder. An optional If-Match header can be included to prevent race conditions.

Note:

Editing passwords is not supported for shared links.

Returns

A standard file object is returned if the ID is valid and if the user has access to the file.

curl https://api.box.com/2.0/files/FILE_ID \
-H "Authorization: Bearer " \
-d '{"name":"new name.jpg"}' \
-X PUT
package com.box.sdk

public class BoxFile

public void updateInfo(BoxFile.Info info)
Files.prototype.update = function(fileID, options, callback)
namespace Box.V2.Managers
class BoxFilesManager

public async Task<BoxFile> UpdateInformationAsync(BoxFileRequest fileRequest, string etag = null, List<string> fields = null)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "file",
    "id": "5000948880",
    "sequence_id": "3",
    "etag": "3",
    "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc",
    "name": "new name.jpg",
    "description": "a picture of tigers",
    "size": 629644,
    "path_collection": {
        "total_count": 2,
        "entries": [
            {
                "type": "folder",
                "id": "0",
                "sequence_id": null,
                "etag": null,
                "name": "All Files"
            },
            {
                "type": "folder",
                "id": "11446498",
                "sequence_id": "1",
                "etag": "1",
                "name": "Pictures"
            }
        ]
    },
    "created_at": "2012-12-12T10:55:30-08:00",
    "modified_at": "2012-12-12T11:04:26-08:00",
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "modified_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "owned_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "shared_link": {
        "url": "https://www.box.com/s/rh935iit6ewrmw0unyul",
        "download_url": "https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg",
        "vanity_url": null,
        "is_password_enabled": false,
        "unshared_at": null,
        "download_count": 0,
        "preview_count": 0,
        "access": "open",
        "permissions": {
            "can_download": true,
            "can_preview": true
        }
    },
    "parent": {
        "type": "folder",
        "id": "11446498",
        "sequence_id": "1",
        "etag": "1",
        "name": "Pictures"
    },
    "item_status": "active"
}
Suggest Edits

Delete File

Move a file to the trash.

 

OAuth2 Auth

 Authentication is required for this endpoint.
deletehttps://api.box.com/2.0/files/file_id

Path Params

file_id
string
required

Headers

If-Match
string

The etag of the file. This is in the ‘etag’ field of the file object.

The etag of the file can be included as an ‘If-Match’ header to prevent race conditions.

Permanent Deletion

Depending on the enterprise settings for this user, the item will either be actually deleted from Box or moved to the trash.

Returns

An empty 204 response is sent to confirm deletion of the file. If the If-Match header is sent and fails, a 412 Precondition Failed error is returned.

curl https://api.box.com/2.0/files/FILE_ID  \
-H "Authorization: Bearer " \
-H "If-Match: a_unique_value" \
-X DELETE
package com.box.sdk

public class BoxFile

public void delete()
Files.prototype.delete = function(fileID, callback)
namespace Box.V2.Managers
class BoxFilesManager

public async Task<bool> DeleteAsync(string id, string etag=null)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Try the API to see results
Suggest Edits

Copy File

Copy a file.

 

OAuth2 Auth

 Authentication is required for this endpoint.
posthttps://api.box.com/2.0/files/file_id/copy

Path Params

file_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response

Body Params

parent
object
 
parent.id
string
required

The ID of the destination folder

version
string

An optional file version ID if you want to copy a specific file version

name
string

An optional new name for the file

The original version of the file will not be altered.

Returns

A file object is returned if the ID is valid and if the update is successful. Errors can be thrown if the destination folder is invalid or if a file name collision occurs.

A 409 will be returned if the intended destination folder is the same, as this will cause a name collision.

curl https://api.box.com/2.0/files/FILE_ID/copy \
-H "Authorization: Bearer " \
-d '{"parent": {"id" : FOLDER_ID}}' \
-X POST
package com.box.sdk

public class BoxFile

public BoxFile.Info copy(BoxFolder destination)
  
public BoxFile.Info copy(BoxFolder destination, String newName)
Files.prototype.copy = function(fileID, newParentID, callback)
namespace Box.V2.Managers
class BoxFilesManager

public async Task<BoxFile> CopyAsync(BoxFileRequest fileRequest, List<string> fields = null)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "file",
    "id": "5000948880",
    "sequence_id": "3",
    "etag": "3",
    "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc",
    "name": "tigers.jpeg",
    "description": "a picture of tigers",
    "size": 629644,
    "path_collection": {
        "total_count": 2,
        "entries": [
            {
                "type": "folder",
                "id": "0",
                "sequence_id": null,
                "etag": null,
                "name": "All Files"
            },
            {
                "type": "folder",
                "id": "11446498",
                "sequence_id": "1",
                "etag": "1",
                "name": "Pictures"
            }
        ]
    },
    "created_at": "2012-12-12T10:55:30-08:00",
    "modified_at": "2012-12-12T11:04:26-08:00",
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "modified_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "owned_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "shared_link": {
        "url": "https://www.box.com/s/rh935iit6ewrmw0unyul",
        "download_url": "https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg",
        "vanity_url": null,
        "is_password_enabled": false,
        "unshared_at": null,
        "download_count": 0,
        "preview_count": 0,
        "access": "open",
        "permissions": {
            "can_download": true,
            "can_preview": true
        }
    },
    "parent": {
        "type": "folder",
        "id": "11446498",
        "sequence_id": "1",
        "etag": "1",
        "name": "Pictures"
    },
    "item_status": "active"
}
Suggest Edits

Lock and Unlock

Lock or unlock a file.

 

OAuth2 Auth

 Authentication is required for this endpoint.
puthttps://api.box.com/2.0/files/file_id

Path Params

file_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response. Set to lock to get back lock information.

Body Params

lock
object
 
lock.type
string
required

The type of the lock object is "lock"

lock.expires_at
date-time

The time the lock expires

lock.is_download_prevented
boolean

Whether or not the file can be downloaded while locked

To lock and unlock files, you execute a PUT operation on the /files/{file id} endpoint and set or clear the lock properties on the file.

curl https://api.box.com/2.0/files/FILE_ID  \
-H "Authorization: Bearer " \
-d '{"lock": { "type": "lock","expires_at": "2015-12-12T10:55:30-08:00","is_download_prevented": false}}' \
-X PUT
curl https://api.box.com/2.0/files/FILE_ID  \
-H "Authorization: Bearer ACCESS_TOKEN" \
-d '{"lock": null}' \
-X PUT
package com.box.sdk

public class BoxFile

public BoxLock lock(Date expiresAt, boolean isDownloadPrevented)

public void unlock()
Not Supported
namespace Box.V2.Managers
class BoxFilesManager

public async Task<BoxFileLock> UpdateLockAsync(BoxFileLockRequest lockFileRequest, string Id)
  
public async Task<bool> UnLock(string id)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
  "type": "file",
  "id": "76017730626",
  "etag": "2",
  "lock": {
    "type": "lock",
    "id": "2126286840",
    "created_by": {
      "type": "user",
      "id": "277699565",
      "name": "Sanjay Padval",
      "login": "spadval+integration@box.com"
    },
    "created_at": "2017-03-06T22:00:53-08:00",
    "expires_at": null,
    "is_download_prevented": false
  }
}
Suggest Edits

Get Thumbnail

Get a thumbnail image for a file.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/files/file_id/thumbnail.extension

Path Params

file_id
string
required
extension
string
required

png or jpg with no "."

Query Params

min_height
int32

The minimum height of the thumbnail

min_width
int32

The minimum width of the thumbnail

max_height
int32

The maximum height of the thumbnail

max_width
int32

The maximum width of the thumbnail

Sizes of 32x32, 64x64, 128x128, and 256x256 can be returned in the .png format and sizes of 32x32, 94x94, 160x160, and 320x320 can be returned in the .jpg format. Thumbnails can be generated for the image and video file formats listed here.

Returns

The thumbnail image in the specified size and format.

Note:

Thumbnails are only available for images and video file formats. You can also specify min=max in order to guarantee the thumbnail size requested.

There are three success cases that your application needs to account for:

If the thumbnail isn’t available yet, a 202 Accepted HTTP status will be returned, including a Location header pointing to a placeholder graphic that can be used until the thumbnail is returned. A Retry-After header will also be returned, indicating the time in seconds after which the thumbnail will be available. Your application should only attempt to get the thumbnail again after Retry-After time.

If Box can’t generate a thumbnail for this file type, a 302 Found response will be returned, redirecting to a placeholder graphic in the requested size for this particular file type, e.g. this for a CSV file).

If the thumbnail is available, a 200 OK response will be returned with the contents of the thumbnail in the body

If Box is unable to generate a thumbnail for this particular file, a 404 Not Found response will be returned with a code of preview_cannot_be_generated. If there are any bad parameters sent in, a standard 400 Bad Request will be returned.

curl https://api.box.com/2.0/files/FILE_ID/thumbnail.png?min_height=256&min_width=256 \
-H "Authorization: Bearer "
package com.box.sdk

public class BoxFile

public byte[] getThumbnail(ThumbnailFileType fileType, int minWidth, int minHeight, int maxWidth, int maxHeight)
Files.prototype.getThumbnail = function(fileID, qs, callback)
namespace Box.V2.Managers
class BoxFilesManager

public async Task<Stream> GetThumbnailAsync(string id, int? minHeight = null, int? minWidth = null, int? maxHeight = null, int? maxWidth = null, bool throttle = true, bool handleRetry = true)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Contents of thumbnail
Suggest Edits

Get File Collaborations

Get all of the collaborations on a file (i.e. all of the users that have access to that file).

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/files/file_id/collaborations

Path Params

file_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response

marker
string

The position marker at which to begin the response. See marker-based paging for details.

limit
int32

The maximum number of items to return

Returns

Returns all of the file's collaborations using marker-based paging.

Each collaboration object has details on which user or group has access to the file and with what role.

curl https://api.box.com/2.0/files/FILE_ID/collaborations \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "next_marker": "ZmlQZS0xLTE%3D",
    "entries": [
        {
            "type": "collaboration",
            "id": "14176246",
            "created_by": {
                "type": "user",
                "id": "4276790",
                "name": "David Lee",
                "login": "david@box.com"
            },
            "created_at": "2011-11-29T12:56:35-08:00",
            "modified_at": "2012-09-11T15:12:32-07:00",
            "expires_at": null,
            "status": "accepted",
            "accessible_by": {
                "type": "user",
                "id": "755492",
                "name": "Simon Tan",
                "login": "simon@box.net"
            },
            "role": "editor",
            "acknowledged_at": "2011-11-29T12:59:40-08:00",
            "item": null
        }
    ]
}
Suggest Edits

Get File Comments

Get all of the comments on a file.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/files/file_id/comments

Path Params

file_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response

offset
int32

The offset of the item at which to begin the response. See offset-based paging for details.

limit
int32

The maximum number of items to return. The default is 100 and the maximum is 1,000.

Returns

Returns all of the comments on the file using offset-based paging.

curl https://api.box.com/2.0/files/FILE_ID/comments \
-H "Authorization: Bearer " \
package com.box.sdk

public class BoxFile

public List<BoxComment.Info> getComments()
Files.prototype.getComments = function(fileID, qs, callback)
namespace Box.V2.Managers
class BoxFilesManager

public async Task<BoxCollection<BoxComment>> GetCommentsAsync(string id, List<string> fields = null)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "total_count": 1,
    "entries": [
        {
            "type": "comment",
            "id": "191969",
            "is_reply_comment": false,
            "message": "These tigers are cool!",
            "created_by": {
                "type": "user",
                "id": "17738362",
                "name": "sean rose",
                "login": "sean@box.com"
            },
            "created_at": "2012-12-12T11:25:01-08:00",
            "item": {
                "id": "5000948880",
                "type": "file"
            },
            "modified_at": "2012-12-12T11:25:01-08:00"
        }
    ]
}
Suggest Edits

Get File Tasks

Get all of the tasks for a file.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/files/file_id/tasks

Path Params

file_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response

Returns

Returns all of the tasks for the file. This API does not support paging -- it always returns all of the tasks.

curl https://api.box.com/2.0/files/FILE_ID/tasks \
-H "Authorization: Bearer "
package com.box.sdk

public class BoxFile

public List<BoxTask.Info> getTasks()
Not Supported
Not Supported
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "total_count": 1,
    "entries": [
        {
            "type": "task",
            "id": "1786931",
            "item": {
                "type": "file",
                "id": "7026335894",
                "sequence_id": "6",
                "etag": "6",
                "sha1": "81cc829fb8366fcfc108aa6c5a9bde01a6a10c16",
                "name": "API - Persist On-Behalf-Of information.docx"
            },
            "due_at": null
        }
    ]
}
Suggest Edits

File Version Object

 

type

string

file_version

id

string

The ID of the file version object

sha1

string

The SHA-1 hash of the file version

name

string

The name of the file version

size

integer

Size of the file version in bytes

created_at

date-time

When the file version object was created

modified_at

date-time

When the file version object was last updated

content_modified_at

date-time

When the content of the file version was last modified (more info)

modified_by

mini user object

The user who last updated the file version

{
    "type": "file_version",
    "id": "26261748416",
    "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc",
    "name": "tigers.jpeg",
    "size": 629644,
    "created_at": "2012-12-12T10:55:30-08:00",
    "modified_at": "2012-12-12T11:04:26-08:00",
    "content_modified_at": "2013-02-04T16:57:52-08:00",
    "modified_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
}
{
    "sequence_id": "0",
    "etag": "0",
    "type": "file",
    "id": "2631999573",
    "name":"IMG_1312.JPG"
}
Suggest Edits

Get Versions

Get information on prior versions of a file.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/files/file_id/versions

Path Params

file_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response

offset
int32

The offset of the item at which to begin the response. See offset-based paging for details.

limit
int32

The maximum number of items to return. The default is 1,000 and the maximum is 1,000.

Returns

Returns all of the previous versions of the file using offset-based paging. The results do not include the current version of the file.

Alert:

Versions are only tracked for Box users with premium accounts.

Download Version

To download a specific file version, use the Download File Endpoint and specify the version needed.

curl https://api.box.com/2.0/files/FILE_ID/versions \
-H "Authorization: Bearer " \
package com.box.sdk

public class BoxFile

public Collection<BoxFileVersion> getVersions()
Not Supported
namespace Box.V2.Managers
class BoxFilesManager

public async Task<BoxCollection<BoxFileVersion>> ViewVersionsAsync(string id, List<string> fields = null)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
 "total_count": 1,
 "entries": [
    {
     "type": "file_version",
     "id": "672259576",
     "sha1": "359c6c1ed98081b9a69eb3513b9deced59c957f9",
     "name": "Dragons.js",
     "size": 92556,
     "created_at": "2012-08-20T10:20:30-07:00",
     "modified_at": "2012-11-28T13:14:58-08:00",
     "modified_by": {
       "type": "user",
       "id": "183732129",
       "name": "sean rose",
       "login": "sean+apitest@box.com"
     }
	 }
 ]
}
Suggest Edits

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.

 

OAuth2 Auth

 Authentication is required for this endpoint.
posthttps://api.box.com/2.0/files/file_id/versions/current

Path Params

file_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response

Body Params

type
string
required

file_version

id
string
required

The ID of the file version to make current

Alert:

Versions are only tracked for Box users with premium accounts.

Returns

The newly promoted file_version object is returned, along with a ‘201 Created’ status

curl https://api.box.com/2.0/files/FILE_ID/versions/current \
-H "Authorization: Bearer " \
-d '{"type": "file_version", "id" : "FILE_VERSION_ID"}' \
-X POST
package com.box.sdk

public class BoxFileVersion

public void promote()
Not Supported
Not Supported
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "file_version",
    "id": "871399",
    "sha1": "12039d6dd9a7e6eefc78846802e",
    "name": "Stark Family Lineage.doc",
    "size": 11,
    "created_at": "2013-11-20T13:20:50-08:00",
    "modified_at": "2013-11-20T13:26:48-08:00",
    "modified_by": {
        "type": "user",
        "id": "13711334",
        "name": "Eddard Stark",
        "login": "ned@winterfell.com"
    }
}
Suggest Edits

Delete Old Version

Discards a file version to the trash.

 

OAuth2 Auth

 Authentication is required for this endpoint.
deletehttps://api.box.com/2.0/files/file_id/versions/id

Path Params

file_id
string
required
id
string
required

Id of the file version

Headers

If-Match
string

The etag of the file. This is in the ‘etag’ field of the file object.

Trash:

Depending on the enterprise settings for this user, the item will either be actually deleted from Box or moved to the trash.

Returns

An empty 204 response is sent to confirm deletion of the file. If the If-Match header is sent and fails, a ‘412 Precondition Failed’ error is returned.

curl https://api.box.com/2.0/files/FILE_ID/versions/VERSION_ID  \
-H "Authorization: Bearer " \
-X DELETE
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Suggest Edits

Folder Object

 

Folders contain information about the items contained inside of them, including files and other folders. There is also a set of metadata such as who owns the folder and when it was modified that is also returned. When accessing other resources that make reference to folders, a ‘mini folder’ object will be used. The 'mini folder' object will return type, id, sequence_id, etag, and name.

Italicized attributes are not returned by default and must be retrieved through the fields parameter.

type

string

folder

id

string

The ID of the folder object

sequence_id

string

A unique ID for use with the /events endpoint.
May be null for some folders, such as root or trash.

etag

string

The entity tag of this folder object. Used with If-Match headers. May be null for some folders such as root or trash.

name

string

The name of the folder

created_at

date-time

The time the folder was created. May be null for some folders such as root or trash.

description

string

The description of the folder

size

integer

The folder size in bytes. Be careful parsing this integer, it can easily go into EE notation: see IEEE754 format.

path_collection

collection

The path of folders to this folder, starting at the root.

created_by

mini user object

The user who created this folder

modified_by

mini user object

The user who last modified this folder

trashed_at

date-time

The time the folder or its contents were put in the trash. May be null for some folders such as root or trash.

purged_at

date-time

The time the folder or its contents will be purged from the trash. May be null for some folders such as root or trash.

content_created_at

date-time

The time the folder or its contents were originally created (according to the uploader). May be null for some folders such as root or trash.

content_modified_at

date-time

The time the folder or its contents were last modified (according to the uploader). May be null for some folders such as root or trash.

owned_by

mini user object

The user who owns this folder

shared_link

object

The shared link object for this file. Will be null if no shared link has been created.

folder_upload_email

object

The upload email address for this folder. null if not set.

parent

mini folder object

The folder that contains this folder.
May be null for folders such as root, trash and child folders whose parent is inaccessible.

item_status

string

Whether this item is deleted or not. Values include active, trashed if the item has been moved to the trash, and deleted if the item has been permanently deleted

item_collection

collection

A collection of mini file and folder objects contained in this folder

sync_state

string

Whether this folder will be synced by the Box sync clients or not. Can be synced, not_synced, or partially_synced.

has_collaborations

boolean

Whether this folder has any collaborators

permissions

object

An object containing the permissions that the current user has on this folder. The keys are can_download, can_upload, can_rename, can_delete, can_share, can_invite_collaborator, and can_set_share_access. Each key has a boolean value.

tags

array of strings

All tags applied to this folder

can_non_owners_invite

boolean

Whether non-owners can invite collaborators to this folder

is_externally_owned

boolean

Whether this folder is owned by a user outside of the enterprise

allowed_shared_link_access_levels

array of strings

Access level settings for shared links set by administrator. Can include open, company, or collaborators.

allowed_invitee_roles

string

Folder collaboration roles allowed by the enterprise administrator

watermark_info

object

Information about the watermark status of this folder. See Watermarking for additional endpoints.

Fields:
is_watermarked (boolean): Whether the folder is watermarked or not.

{
    "type": "folder",
    "id": "11446498",
    "sequence_id": "1",
    "etag": "1",
    "name": "Pictures",
    "created_at": "2012-12-12T10:53:43-08:00",
    "modified_at": "2012-12-12T11:15:04-08:00",
    "description": "Some pictures I took",
    "size": 629644,
    "path_collection": {
        "total_count": 1,
        "entries": [
            {
                "type": "folder",
                "id": "0",
                "sequence_id": null,
                "etag": null,
                "name": "All Files"
            }
        ]
    },
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "modified_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "owned_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "shared_link": {
        "url": "https://www.box.com/s/vspke7y05sb214wjokpk",
        "download_url": null,
        "vanity_url": null,
        "is_password_enabled": false,
        "unshared_at": null,
        "download_count": 0,
        "preview_count": 0,
        "access": "open",
        "permissions": {
            "can_download": true,
            "can_preview": true
        }
    },
    "folder_upload_email": {
        "access": "open",
        "email": "upload.Picture.k13sdz1@u.box.com"
    },
    "parent": {
        "type": "folder",
        "id": "0",
        "sequence_id": null,
        "etag": null,
        "name": "All Files"
    },
    "item_status": "active",
    "item_collection": {
        "total_count": 1,
        "entries": [
            {
                "type": "file",
                "id": "5000948880",
                "sequence_id": "3",
                "etag": "3",
                "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc",
                "name": "tigers.jpeg"
            }
        ],
        "offset": 0,
        "limit": 100
    },
    "tags": [
        "approved",
        "ready to publish"
    ]
}
{
    "type":"folder",
    "id":"301415432",
    "sequence_id":"0",
    "etag":"0",
    "name":"my first sub-folder"
}
Suggest Edits

Get Folder Info

Get information about a folder.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/folders/folder_id

Path Params

folder_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response

The root folder of a Box account is always represented by the ID “0”.

Returns

A full folder object is returned, including the most current information available about it. An 404 error is thrown if the folder does not exist or a 4xx if the user does not have access to it.

curl https://api.box.com/2.0/folders/FOLDER_ID \
-H "Authorization: Bearer " \
package com.box.sdk

public class BoxFolder

public BoxFolder.Info getInfo()
Folders.prototype.get = function(folderID, qs, callback)
namespace Box.V2.Managers
class BoxFoldersManager

public async Task<BoxFolder> GetInformationAsync(string id, List<string> fields = null)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "folder",
    "id": "11446498",
    "sequence_id": "1",
    "etag": "1",
    "name": "Pictures",
    "created_at": "2012-12-12T10:53:43-08:00",
    "modified_at": "2012-12-12T11:15:04-08:00",
    "description": "Some pictures I took",
    "size": 629644,
    "path_collection": {
        "total_count": 1,
        "entries": [
            {
                "type": "folder",
                "id": "0",
                "sequence_id": null,
                "etag": null,
                "name": "All Files"
            }
        ]
    },
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "modified_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "owned_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "shared_link": {
        "url": "https://www.box.com/s/vspke7y05sb214wjokpk",
        "download_url": null,
        "vanity_url": null,
        "is_password_enabled": false,
        "unshared_at": null,
        "download_count": 0,
        "preview_count": 0,
        "access": "open",
        "permissions": {
            "can_download": true,
            "can_preview": true
        }
    },
    "folder_upload_email": {
        "access": "open",
        "email": "upload.Picture.k13sdz1@u.box.com"
    },
    "parent": {
        "type": "folder",
        "id": "0",
        "sequence_id": null,
        "etag": null,
        "name": "All Files"
    },
    "item_status": "active",
    "item_collection": {
        "total_count": 1,
        "entries": [
            {
                "type": "file",
                "id": "5000948880",
                "sequence_id": "3",
                "etag": "3",
                "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc",
                "name": "tigers.jpeg"
            }
        ],
        "offset": 0,
        "limit": 100
    }
}
Suggest Edits

Get Folder Items

Gets all of the files, folders, or web links contained within this folder.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/folders/folder_id/items

Path Params

folder_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response

offset
int32

The offset of the item at which to begin the response. See offset-based paging for details.

limit
int32

The maximum number of items to return. The default is 100 and the maximum is 1,000.

Any attribute in the full files or folders objects can be passed in with the fields parameter to get specific attributes, and only those specific attributes back; otherwise, the mini format is returned for each item by default. Multiple attributes can be passed in separated by commas e.g. fields=name,created_at.

Returns

Returns all of the items contained in the folder using offset-based paging.

An error is returned if the folder does not exist, or if any of the parameters are invalid. The total_count returned may not match the number of entries when using the enterprise scope, because external folders are excluded from the list of entries.

curl https://api.box.com/2.0/folders/FOLDER_ID/items?limit=2&offset=0 \
-H "Authorization: Bearer "
package com.box.sdk

public class BoxFolder

public Iterable<BoxItem.Info> getChildren(final String... fields)

public PartialCollection<BoxItem.Info> getChildrenRange(long offset, long limit, String... fields)

public Iterator<BoxItem.Info> iterator()
Folders.prototype.getItems = function(folderID, qs, callback)
namespace Box.V2.Managers
class BoxFoldersManager

public async Task<BoxCollection<BoxItem>> GetFolderItemsAsync(string id, int limit, int offset = 0, List<string> fields = null)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "total_count": 24,
    "entries": [
        {
            "type": "folder",
            "id": "192429928",
            "sequence_id": "1",
            "etag": "1",
            "name": "Stephen Curry Three Pointers"
        },
        {
            "type": "file",
            "id": "818853862",
            "sequence_id": "0",
            "etag": "0",
            "name": "Warriors.jpg"
        }
    ],
    "offset": 0,
    "limit": 2,
    "order": [
        {
            "by": "type",
            "direction": "ASC"
        },
        {
            "by": "name",
            "direction": "ASC"
        }
    ]
}
Suggest Edits

Create Folder

Create a new folder.

 

OAuth2 Auth

 Authentication is required for this endpoint.
posthttps://api.box.com/2.0/folders

Query Params

fields
string

Comma-separated list of fields to include in the response

Body Params

name
string
required

The desired name for the folder

parent
object
 
parent.id
string
required

The ID of the parent folder

Returns

A full folder object is returned if the parent folder ID is valid and if no name collisions occur.

Supported Folder Names:

Box supports folder names of 255 characters or less. Names contain non-printable ASCII characters, "/" or "\", names with trailing spaces, and the special names “.” and “..” are also not allowed.

curl https://api.box.com/2.0/folders \
-H "Authorization: Bearer " \
-d '{"name":"New Folder", "parent": {"id": "0"}}' \
-X POST
package com.box.sdk

public class BoxFolder
  
public BoxFolder.Info createFolder(String name)
Folders.prototype.create = function(parentFolderID, name, callback)
namespace Box.V2.Managers
class BoxFoldersManager

public async Task<BoxFolder> CreateAsync(BoxFolderRequest folderRequest, List<string> fields = null)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "folder",
    "id": "11446498",
    "sequence_id": "1",
    "etag": "1",
    "name": "Pictures",
    "created_at": "2012-12-12T10:53:43-08:00",
    "modified_at": "2012-12-12T11:15:04-08:00",
    "description": "Some pictures I took",
    "size": 629644,
    "path_collection": {
        "total_count": 1,
        "entries": [
            {
                "type": "folder",
                "id": "0",
                "sequence_id": null,
                "etag": null,
                "name": "All Files"
            }
        ]
    },
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "modified_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "owned_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "shared_link": {
        "url": "https://www.box.com/s/vspke7y05sb214wjokpk",
        "download_url": null,
        "vanity_url": null,
        "is_password_enabled": false,
        "unshared_at": null,
        "download_count": 0,
        "preview_count": 0,
        "access": "open",
        "permissions": {
            "can_download": true,
            "can_preview": true
        }
    },
    "folder_upload_email": {
        "access": "open",
        "email": "upload.Picture.k13sdz1@u.box.com"
    },
    "parent": {
        "type": "folder",
        "id": "0",
        "sequence_id": null,
        "etag": null,
        "name": "All Files"
    },
    "item_status": "active",
    "item_collection": {
        "total_count": 0,
        "entries": [],
        "offset": 0,
        "limit": 100
    }
}
Suggest Edits

Update Folder

Update a folder.

 

OAuth2 Auth

 Authentication is required for this endpoint.
puthttps://api.box.com/2.0/folders/folder_id

Path Params

folder_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response

Body Params

name
string

The name of the folder

description
string

The description of the folder

parent
object
 
parent.id
string

The ID of the parent folder

shared_link
object
 
shared_link.access
string

The level of access. Can be open ("People with the link"), company ("People in your company"), or collaborators ("People in this folder"). If you omit this field then the access level will be set to the default access level specified by the enterprise admin.

shared_link.password
string

The password required to access the shared link. Set to null to remove the password.

shared_link.unshared_at
date-time

The date-time that this link will become disabled. This field can only be set by users with paid accounts.

shared_link.permissions
object
 
shared_link.permissions.can_download
boolean

Whether the shared link allows downloads. For shared links on folders, this also applies to any items in the folder. Can only be set with access levels open and company (not collaborators).

folder_upload_email
object
 
folder_upload_email.access
string

Can be open or collaborators

owned_by
object
 
owned_by.id
string

The ID of the user (should be your own user ID)

sync_state
string

Whether Box Sync clients will sync this folder. Values of synced or not_synced can be sent, while partially_synced may also be returned.

tags
array of strings

All tags attached to this folder. To add/remove a tag to/from a folder, you can first get the folder’s current tags (be sure to specify ?fields=tags, since the tags field is not returned by default); then modify the list as required; and finally, set the folder’s entire list of tags.

Headers

If-Match
string

This is in the ‘etag’ field of the folder object.

To move a folder, update the ID of its parent. To enable an email address that can be used to upload files to the folder, update the folder_upload_email field. An optional If-Match header can be included to ensure that client only updates the folder if it knows about the latest version.

Returns

The updated folder is returned if the name is valid. Errors generally occur only if there is a name collision.

curl https://api.box.com/2.0/folders/FOLDER_ID \
-H "Authorization: Bearer " \
-d '{"name":"New Folder Name!"}' \
-X PUT
package com.box.sdk

public class BoxFolder
  
public void updateInfo(BoxFolder.Info info)
Folders.prototype.update = function(folderID, options, callback)
namespace Box.V2.Managers
class BoxFoldersManager

public async Task<BoxFolder> UpdateInformationAsync(BoxFolderRequest folderRequest, List<string> fields = null)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
   "type": "folder",
   "id": "11446498",
   "sequence_id": "1",
   "etag": "1",
   "name": "New Folder Name!",
   "created_at": "2012-12-12T10:53:43-08:00",
   "modified_at": "2012-12-12T11:15:04-08:00",
   "description": "Some pictures I took",
   "size": 629644,
 "path_collection": {
 	"total_count": 1,
 "entries": [
 {
   "type": "folder",
   "id": "0",
   "sequence_id": null,
   "etag": null,
   "name": "All Files"
 }
 ]
 },
 "created_by": {
   "type": "user",
   "id": "17738362",
   "name": "sean rose",
   "login": "sean@box.com"
 },
 "modified_by": {
   "type": "user",
   "id": "17738362",
   "name": "sean rose",
   "login": "sean@box.com"
 },
 "owned_by": {
   "type": "user",
   "id": "17738362",
   "name": "sean rose",
   "login": "sean@box.com"
 },
   "shared_link": {
   "url": "https://www.box.com/s/vspke7y05sb214wjokpk",
   "download_url": null,
   "vanity_url": null,
   "is_password_enabled": false,
   "unshared_at": null,
   "download_count": 0,
   "preview_count": 0,
   "access": "open",
   "permissions": {
   "can_download": true,
   "can_preview": true
 }
 },
 "folder_upload_email": {
   "access": "open",
   "email": "upload.Picture.k13sdz1@u.box.com"
 },
 "parent": {
   "type": "folder",
   "id": "0",
   "sequence_id": null,
   "etag": null,
   "name": "All Files"
 },
 "item_status": "active",
 "item_collection": {
 	"total_count": 1,
 "entries": [
 {
   "type": "file",
   "id": "5000948880",
   "sequence_id": "3",
   "etag": "3",
   "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc",
   "name": "tigers.jpeg"
 }
 ],
 "offset": 0,
 "limit": 100
 }
}
Suggest Edits

Delete Folder

Move a folder to the trash. The recursive parameter must be included in order to delete folders that aren't empty.

 

OAuth2 Auth

 Authentication is required for this endpoint.
deletehttps://api.box.com/2.0/folders/folder_id

Path Params

folder_id
string
required

Query Params

recursive
boolean

Whether to delete this folder if it has items inside of it.

Headers

If-Match
string

This is in the ‘etag’ field of the folder object.

An optional If-Match header can be included to ensure that client only deletes the folder if it knows about the latest version.

Trash:

Depending on the enterprise settings for this user, the item will either be actually deleted from Box or moved to the trash.

Returns

An empty 204 response will be returned upon successful deletion. An error is thrown if the folder is not empty and the ‘recursive’ parameter is not included.

curl https://api.box.com/2.0/folders/FOLDER_ID?recursive=true \
-H "Authorization: Bearer " \
-X DELETE
package com.box.sdk

public class BoxFolder

public void delete(boolean recursive)
Folders.prototype.delete = function(folderID, qs, callback)
namespace Box.V2.Managers
class BoxFoldersManager

public async Task<bool> DeleteAsync(string id, bool recursive = false)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Try the API to see results
Suggest Edits

Copy Folder

Used to create a copy of a folder in another folder. The original version of the folder will not be altered.

 

OAuth2 Auth

 Authentication is required for this endpoint.
posthttps://api.box.com/2.0/folders/folder_id/copy

Path Params

folder_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response

Body Params

parent
object
 
parent.id
string
required

The ID of the destination folder

name
string

An optional new name for the folder

Returns

A full folder object is returned if the ID is valid and if the update is successful. Errors can be thrown if the destination folder is invalid or if a file-name collision occurs. A 409 will be returned if the intended destination folder is the same, as this will cause a name collision.

curl https://api.box.com/2.0/folders/FOLDER_ID/copy \
-H "Authorization: Bearer " \
-d '{"parent": {"id" : DESTINATION_FOLDER_ID}}' \
-X POST
package com.box.sdk

public class BoxFolder

public BoxFolder.Info copy(BoxFolder destination, String newName)
Folders.prototype.copy = function(folderID, newParentID, callback)
namespace Box.V2.Managers
class BoxFoldersManager

public async Task<BoxFolder> CopyAsync(BoxFolderRequest folderRequest, List<string> fields = null)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "folder",
    "id": "11446498",
    "sequence_id": "1",
    "etag": "1",
    "name": "Pictures",
    "created_at": "2012-12-12T10:53:43-08:00",
    "modified_at": "2012-12-12T11:15:04-08:00",
    "description": "Some pictures I took",
    "size": 629644,
    "path_collection": {
        "total_count": 1,
        "entries": [
            {
                "type": "folder",
                "id": "0",
                "sequence_id": null,
                "etag": null,
                "name": "All Files"
            }
        ]
    },
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "modified_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "owned_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "shared_link": {
        "url": "https://www.box.com/s/vspke7y05sb214wjokpk",
        "download_url": null,
        "vanity_url": null,
        "is_password_enabled": false,
        "unshared_at": null,
        "download_count": 0,
        "preview_count": 0,
        "access": "open",
        "permissions": {
            "can_download": true,
            "can_preview": true
        }
    },
    "folder_upload_email": {
        "access": "open",
        "email": "upload.Picture.k13sdz1@u.box.com"
    },
    "parent": {
        "type": "folder",
        "id": "0",
        "sequence_id": null,
        "etag": null,
        "name": "All Files"
    },
    "item_status": "active",
    "item_collection": {
        "total_count": 1,
        "entries": [
            {
                "type": "file",
                "id": "5000948880",
                "sequence_id": "3",
                "etag": "3",
                "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc",
                "name": "tigers.jpeg"
            }
        ],
        "offset": 0,
        "limit": 100
    }
}
Suggest Edits

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.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/folders/folder_id/collaborations

Path Params

folder_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response

Returns

Returns all of the folder's collaborations. This API does not support paging -- it always returns all of the collaborations.

Each collaboration object has details on which user or group has access to the file and with what role.

curl https://api.box.com/2.0/folders/FOLDER_ID/collaborations \
-H "Authorization: Bearer "
package com.box.sdk

public class BoxFolder

public Collection<BoxCollaboration.Info> getCollaborations()
Folders.prototype.getCollaborations = function(folderID, qs, callback)
namespace Box.V2.Managers
class BoxFoldersManager

public async Task<BoxCollection<BoxCollaboration>> GetCollaborationsAsync(string id, List<string> fields = null)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "total_count": 1,
    "entries": [
        {
            "type": "collaboration",
            "id": "14176246",
            "created_by": {
                "type": "user",
                "id": "4276790",
                "name": "David Lee",
                "login": "david@box.com"
            },
            "created_at": "2011-11-29T12:56:35-08:00",
            "modified_at": "2012-09-11T15:12:32-07:00",
            "expires_at": null,
            "status": "accepted",
            "accessible_by": {
                "type": "user",
                "id": "755492",
                "name": "Simon Tan",
                "login": "simon@box.net"
            },
            "role": "editor",
            "acknowledged_at": "2011-11-29T12:59:40-08:00",
            "item": null
        }
    ]
}
Suggest Edits

Get Shared Item

Use this API to obtain the ID of a file or folder from a shared link URL. Pass the URL (and password, if needed) in the BoxApi header. Once you have the ID of the file or folder, you can call any API to access that file or folder a long as you also pass the BoxApi header to those APIs. The header must be passed in each API call since your account would not otherwise have permission to access the shared item. Passing the shared link URL validates that the item was shared with you (e.g. via email or any other channel).

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/shared_items

Query Params

fields
string
required

Comma-separated list of fields to include in the response

Headers

BoxApi
string
required

Use the format shared_link=SHARED_LINK_URL or shared_link=SHARED_LINK_URL&shared_link_password=PASSWORD

Returns

Returns the file object or folder object for the item associated with the shared link URL, subject to the access level and permissions of the shared link.

Errors

404 not_found is returned if the shared link URL is incorrect, has been removed, has expired, or the user does have permission to access the item based on the access level (company, collaborators) or permissions (can_preview, can_download) of the shared link.

403 incorrect_shared_item_password is returned if a password is required and it was not passed or is incorrect. Typically, you would try accessing the shared item without a password and prompt the user for the password if that returns incorrect_shared_item_password.

You can pass either the regular URL (url) or the Custom URL (vanity_url), but you cannot pass the Direct Link (download_url).

Interaction between shared link permissions and collaboration roles

If a user has access to an item independent of the shared link (e.g. they own the item or have access via a collaboration), then a password is not required even if is_password_enabled is true.

If a user has access to an item via a collaboration and also passes a shared link URL in the BoxApi header, the user can perform actions that are allowed by either the collaboration role or the shared link permissions. For example, if a user has access to an item with the viewer role, the user can still download the item if they pass a shared link URL that has the can_download permission. Similarly, if a user has access with the viewer role, then they can still download the item even if the shared link has can_download set to false.

A shared link on a folder provides access to all of the items in the folder. Use GET /folders/{id}/items to get the IDs of the items in the folder. You can then access any of those items by passing the shared link URL in the BoxApi header.

curl https://api.box.com/2.0/shared_items?fields=type,id
-H "Authorization: Bearer "
-H "BoxApi: shared_link=SHARED_LINK_URL&shared_link_password=PASSWORD"
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "folder",
    "id": "11446498",
}
Suggest Edits

Get Trashed Items

Gets the files, folders and web links that are in the user's trash.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/folders/trash/items

Query Params

fields
string

Comma-separated list of fields to include in the response

offset
int32

The offset of the item at which to begin the response. See offset-based paging for details.

limit
int32

The maximum number of items to return. The default is 100 and the maximum is 1,000.

Returns

Returns all of the items in the user's trash folder using offset-based paging.

curl https://api.box.com/2.0/folders/trash/items?limit=2&offset=0 \
-H "Authorization: Bearer "
package com.box.sdk

public class BoxTrash

public Iterator<BoxItem.Info> iterator()
Not Supported
namespace Box.V2.Managers
class BoxFoldersManager

public async Task<BoxCollection<BoxItem>> GetTrashItemsAsync(int limit, int offset = 0, List<string> fields = null)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "total_count": 49542,
    "entries": [
        {
            "type": "file",
            "id": "2701979016",
            "sequence_id": "1",
            "etag": "1",
            "sha1": "9d976863fc849f6061ecf9736710bd9c2bce488c",
            "name": "file Tue Jul 24 145436 2012KWPX5S.csv"
        },
        {
            "type": "file",
            "id": "2698211586",
            "sequence_id": "1",
            "etag": "1",
            "sha1": "09b0e2e9760caf7448c702db34ea001f356f1197",
            "name": "file Tue Jul 24 010055 20129Z6GS3.csv"
        }
    ],
    "offset": 0,
    "limit": 2
}
Suggest Edits

Get Trashed Item

Geta an item that has been moved to the trash.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/endpoint/id/trash

Path Params

endpoint
string
required

files, folders or web_links

id
string
required

The ID of the file, folder or web link

Query Params

fields
string

Comma-separated list of fields to include in the response

Returns

Returns the file object, folder object, or web link object of the trashed item, including information about when it was moved to the trash (trashed_at) and when it will be permanently deleted (purged_at).

Returns

404 not_trashed is returned if the item is not in the trash.

curl https://api.box.com/2.0/files/FILE_ID/trash \
-H "Authorization: Bearer "
package com.box.sdk

public class BoxTrash

public BoxFile.Info getFileInfo(String fileID)

public BoxFile.Info getFileInfo(String fileID, String... fields)
Not Supported
namespace Box.V2.Managers
class BoxFilesManager

public async Task<BoxFile> GetTrashedAsync(string id, List<string> fields = null)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "file",
    "id": "5859258256",
    "sequence_id": "2",
    "etag": "2",
    "sha1": "4bd9e98652799fc57cf9423e13629c151152ce6c",
    "name": "Screenshot_1_30_13_6_37_PM.png",
    "description": "",
    "size": 163265,
    "path_collection": {
        "total_count": 1,
        "entries": [
            {
                "type": "folder",
                "id": "1",
                "sequence_id": null,
                "etag": null,
                "name": "Trash"
            }
        ]
    },
    "created_at": "2013-01-30T18:43:56-08:00",
    "modified_at": "2013-01-30T18:44:00-08:00",
    "trashed_at": "2013-02-07T10:49:34-08:00",
    "purged_at": "2013-03-09T10:49:34-08:00",
    "content_created_at": "2013-01-30T18:43:56-08:00",
    "content_modified_at": "2013-01-30T18:44:00-08:00",
    "created_by": {
        "type": "user",
        "id": "181757341",
        "name": "sean test",
        "login": "sean+test@box.com"
    },
    "modified_by": {
        "type": "user",
        "id": "181757341",
        "name": "sean test",
        "login": "sean+test@box.com"
    },
    "owned_by": {
        "type": "user",
        "id": "181757341",
        "name": "sean test",
        "login": "sean+test@box.com"
    },
    "shared_link": {
        "url": null,
        "download_url": null,
        "vanity_url": null,
        "is_password_enabled": false,
        "unshared_at": null,
        "download_count": 0,
        "preview_count": 0,
        "access": "open",
        "permissions": {
            "can_download": true,
            "can_preview": true
        }
    },
    "parent": {
        "type": "folder",
        "id": "0",
        "sequence_id": null,
        "etag": null,
        "name": "All Files"
    },
    "item_status": "trashed"
}
Suggest Edits

Restore Item

Restores an item that has been moved to the trash.

 

OAuth2 Auth

 Authentication is required for this endpoint.
posthttps://api.box.com/2.0/endpoint/id

Path Params

endpoint
string
required

files, folders or web_links

id
string
required

The ID of the file, folder, or web link

Query Params

fields
string

Comma-separated list of fields to include in the response

Body Params

name
string

The new name for this item. Only used if the item can't be restored with its previous name due to a conflict.

parent
object
 
parent.id
string

The ID of the new parent folder. Only used if the previous parent folder no longer exists or the user doesn't have permission to restore the item there.

The default behavior is to restore the file to the folder it was in before it was moved to the trash. If that parent folder no longer exists or if there is now an item with the same name in that parent folder, the new parent folder and/or new name will need to be included in the request.

Returns

The full item will be returned with a 201 Created status. By default it is restored to the parent folder it was in before it was trashed.

Note:

Passing a parent parameter only changes the place the restored content goes when the original parent where the content previously lived has been deleted.

Errors

403

The user doesn’t have access to the folder the item is being restored to or the user doesn’t have permission to restore items from the trash

404

The item is not in the trash

409

There is an item with the same name in the folder the item is being restored to

curl https://api.box.com/2.0/files/FILE_ID \
-H "Authorization: Bearer " \
-d '{"name":"non-conflicting-name.jpg"}' \
-X POST
package com.box.sdk

public class BoxTrash

public BoxFile.Info restoreFile(String fileID)
  
public BoxFile.Info restoreFile(String fileID, String newName, String newParentID)
Not Supported
namespace Box.V2.Managers
class BoxFilesManager

public async Task<BoxFile> RestoreTrashedAsync(BoxFileRequest fileRequest, List<string> fields = null)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "file",
    "id": "5859258256",
    "sequence_id": "3",
    "etag": "3",
    "sha1": "4bd9e98652799fc57cf9423e13629c151152ce6c",
    "name": "Screenshot_1_30_13_6_37_PM.png",
    "description": "",
    "size": 163265,
    "path_collection": {
        "total_count": 1,
        "entries": [
            {
                "type": "folder",
                "id": "0",
                "sequence_id": null,
                "etag": null,
                "name": "All Files"
            }
        ]
    },
    "created_at": "2013-01-30T18:43:56-08:00",
    "modified_at": "2013-02-07T10:56:58-08:00",
    "trashed_at": null,
    "purged_at": null,
    "content_created_at": "2013-01-30T18:43:56-08:00",
    "content_modified_at": "2013-02-07T10:56:58-08:00",
    "created_by": {
        "type": "user",
        "id": "181757341",
        "name": "sean test",
        "login": "sean+test@box.com"
    },
    "modified_by": {
        "type": "user",
        "id": "181757341",
        "name": "sean test",
        "login": "sean+test@box.com"
    },
    "owned_by": {
        "type": "user",
        "id": "181757341",
        "name": "sean test",
        "login": "sean+test@box.com"
    },
    "shared_link": {
        "url": "https://seanrose.box.com/s/ebgti08mtmhbpb4vlp55",
        "download_url": "https://seanrose.box.com/shared/static/ebgti08mtmhbpb4vlp55.png",
        "vanity_url": null,
        "is_password_enabled": false,
        "unshared_at": null,
        "download_count": 0,
        "preview_count": 4,
        "access": "open",
        "permissions": {
            "can_download": true,
            "can_preview": true
        }
    },
    "parent": {
        "type": "folder",
        "id": "0",
        "sequence_id": null,
        "etag": null,
        "name": "All Files"
    },
    "item_status": "active"
}
Suggest Edits

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.

 

OAuth2 Auth

 Authentication is required for this endpoint.
deletehttps://api.box.com/2.0/endpoint/id/trash

Path Params

id
string
required

The ID of the file, folder or web link

endpoint
string
required

files, folders or web_links

Returns

An empty 204 No Content response will be returned upon successful deletion.

Errors

404 not_trashed is returned if the item is not in the trash.

curl https://api.box.com/2.0/files/FILE_ID/trash \
-H "Authorization: Bearer " \
-X DELETE
package com.box.sdk

public class BoxTrash

public void deleteFile(String fileID)
Not Supported
namespace Box.V2.Managers
class BoxFilesManager

public async Task<bool> PurgeTrashedAsync(string id)
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Try the API to see results
Suggest Edits

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.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/search

Query Params

query
string

The string to search for. Box matches the search string against object names, descriptions, text contents of files, and other data.

scope
string

The scope on which you want search. Can be user_content for a search limited to the current user or enterprise_content to search an entire enterprise. To enable the enterprise_content scope for an administrator, please contact us.

file_extensions
string

Limit searches to specific file extensions like pdf,png, or doc. The value can be a single file extension or a comma-delimited list of extensions. For example: png,md,pdf

created_at_range
date-time

The date when the item was created. Specify the date range using RFC3339 timestamps separated by a comma. For example: `2014-05-15T13:35:01-07:00,2014-05-17T13:35:01-07:00. Either the beginning date or the ending date may be empty, but the separating comma is required. For example, if you omit the beginning date, then the ending date must begin with a comma.

updated_at_range
date-time

The date when the item was last updated. Specify the date range using RFC3339 timestamps separated by a comma. For example: `2014-05-15T13:35:01-07:00,2014-05-17T13:35:01-07:00. Either the beginning date or the ending date may be empty, but the separating comma is required. For example, if you omit the beginning date, then the ending date must begin with a comma.

size_range
string

Return only files within a stated size range. Specify the range in bytes with lower and upper bounds separated by a comma, like so:lower_bound_size,upper_bound_size, where 1MB is 1,000,000 bytes. You can specify only the lower bound if you end this parameter with a comma. You can specify only the upper bound by placing a comma at the beginning of the number.

owner_user_ids
string

Search for objects by owner. Requires a user ID or a set of comma-delimited user IDs, like so: user_id_1,user_id_2,...

ancestor_folder_ids
string

Search for the contents of specific folders (and folders within them). Requires a folder ID or a set of comma-delimited folder IDs, like so: folder_id_1,folder_id_2,....

content_types
string

Search for objects of specified content types. The types can be name, description, file_content, comments, or tags. Requires a content type or a set of comma-delimited content_types, like so: content_type_1,content_type_2,....

type
string

The type of objects you want to include in the search results. The type can be file, folder, or web_link.

trash_content
string

Controls whether to search in the trash. The value can be trashed_only or non_trashed_only. Searches without this parameter default to searching non_trashed_only.

mdfilters
object

Searches for objects with a specific metadata object association. The filters must be placed in a single JSON object in a JSON array (see the tab labeled "Search with metadata" in the Request example). NOTE: For searches with the mdfilters parameter, a query string is not required.

 
mdfilters.scope
string

Specifies the scope of the template searched for. The enterprise and global scopes are supported.

mdfilters.templateKey
string

The key name of the template you want to search for. You can only search for one template at a time.

mdfilters.filters
string

Keys and values of the template you want to search within. For floats and dates, you can include an (inclusive) upper bound parameter lt or (inclusive) lower bound parameter gt or both bounds. An example filter for a “contractExpiration” on or before 08-01-16 UTC would be listed as {"contractExpiration":{"lt":"2016-08-01T00:00:00Z"}}.

fields
string

Comma-separated list of fields to include in the response

offset
int32

The offset of the item at which to begin the response. See offset-based paging for details. If specified, offset must be a multiple of limit.

limit
int32

The maximum number of items to return. The default is 30 and the maximum is 200.

Returns

Returns the search results using offset-based paging.

Errors

Error 404 is returned if not template with that name exists. If the template is hidden, then an error 500 is returned when it is being used.

Note:

If an item is added to Box then it becomes accessible through the search endpoint after ten minutes.

Limitation:

Queries which include special characters [!#$%&'()*+,-./:;<=>?@[\]^_`{|}~] are stripped from search queries in both the Box UI and Search endpoint. If the created_at_range value and/or the updated_at_range_value includes a time offset with a "+", this will need to be encoded as "%2B". For example, https://api.box.com/2.0/search?query=test&updated_at_range=2017-03-15T12:00:00%2B05:30.

curl https://api.box.com/2.0/search?query=sales&file_extensions=pdf&updated_at_range=2014-05-15T13:35:01-07:00,2014-05-17T13:35:01-07:00 \
-H "Authorization: Bearer "
##Request before URL Encoding

https://api.box.com/2.0/search?mdfilters=[{"templateKey":"marketingCollateral", "scope":"enterprise", "filters":{"documentType": "datasheet"}}]

##cURL Request after URL encoding

curl https://api.box.com/2.0/search?mdfilters=%5B%7B%22templateKey%22%3A%22marketingCollateral%22%2C%20%22scope%22%3A%22enterprise%22%2C%20%22filters%22%3A%7B%22documentType%22%3A%20%22datasheet%22%7D%7D%5D \
-H "Authorization: Bearer " 
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "total_count": 1,
    "entries": [
        {
            "type": "file",
            "id": "172245607",
            "sequence_id": "1",
            "etag": "1",
            "sha1": "f89d97c5eea0a68e2cec911s932eca34a52355d2",
            "name": "Box for Sales - Empowering Your Mobile Worker White paper 2pg (External).pdf",
            "description": "This is old and needs to be updated - but general themes still apply",
            "size": 408979,
            "path_collection": {
                "total_count": 2,
                "entries": [
                    {
                        "type": "folder",
                        "id": "0",
                        "sequence_id": null,
                        "etag": null,
                        "name": "All Files"
                    },
                    {
                        "type": "folder",
                        "id": "2150506",
                        "sequence_id": "1",
                        "etag": "1",
                        "name": "Marketing Active Work"
                    }
		 ]
            },
            "created_at": "2014-05-17T12:59:45-07:00",
            "modified_at": "2014-05-17T13:00:20-07:00",
            "trashed_at": null,
            "purged_at": null,
            "content_created_at": "2014-05-17T12:58:58-07:00",
            "content_modified_at": "2014-05-17T12:58:58-07:00",
            "created_by": {
                "type": "user",
                "id": "19551097",
                "name": "Ted Blosser",
                "login": "ted@box.com"
            },
            "modified_by": {
                "type": "user",
                "id": "19551097",
                "name": "Ted Blosser",
                "login": "ted@box.com"
            },
            "owned_by": {
                "type": "user",
                "id": "19551097",
                "name": "Ted Blosser",
                "login": "ted@box.com"
            },
            "shared_link": null,
            "parent": {
                        "type": "folder",
                        "id": "2150506",
                        "sequence_id": "1",
                        "etag": "1",
                        "name": "Marketing Active Work"
            },
            "item_status": "active"
        }
    ],
    "limit": 30,
    "offset": 0
}
{
    "total_count": 2,
    "entries": [
        {
            "type": "file",
            "id": "27201036412",
            "sequence_id": "0",
            "etag": "0",
            "sha1": "71402e9009892ceb7210558abbe720a8e068bd8a",
            "name": "boxdev.png",
            "description": "",
            "size": 6708,
            "path_collection": {
                "total_count": 2,
                "entries": [
                    {
                        "type": "folder",
                        "id": "0",
                        "sequence_id": null,
                        "etag": null,
                        "name": "All Files"
                    },
                    {
                        "type": "folder",
                        "id": "575496314",
                        "sequence_id": "3",
                        "etag": "3",
                        "name": "Marketing Materials"
                    }
                ]
            },
            "created_at": "2015-03-08T20:34:51-07:00",
            "modified_at": "2015-03-08T20:34:51-07:00",
            "trashed_at": null,
            "purged_at": null,
            "content_created_at": "2015-03-08T14:41:58-07:00",
            "content_modified_at": "2015-03-08T14:41:58-07:00",
            "created_by": {
                "type": "user",
                "id": "10523870",
                "name": "Ted Blosser",
                "login": "ted+demo@box.com"
            },
            "modified_by": {
                "type": "user",
                "id": "10523870",
                "name": "Ted Blosser",
                "login": "ted+demo@box.com"
            },
            "owned_by": {
                "type": "user",
                "id": "10523870",
                "name": "Ted Blosser",
                "login": "ted+demo@box.com"
            },
            "shared_link": null,
            "parent": {
                "type": "folder",
                "id": "575496314",
                "sequence_id": "3",
                "etag": "3",
                "name": "Marketing Materials"
            },
            "item_status": "active"
        },
        {
            "type": "file",
            "id": "26776387434",
            "sequence_id": "3",
            "etag": "3",
            "sha1": "72d773345dbba9cfb012c4a889a4fc6840e59bfa",
            "name": "2014 Companies.xlsx",
            "description": "",
            "size": 91821,
            "path_collection": {
                "total_count": 3,
                "entries": [
                    {
                        "type": "folder",
                        "id": "0",
                        "sequence_id": null,
                        "etag": null,
                        "name": "All Files"
                    },
                    {
                        "type": "folder",
                        "id": "575496314",
                        "sequence_id": "3",
                        "etag": "3",
                        "name": "Marketing Materials"
                    },
                    {
                        "type": "folder",
                        "id": "606618154",
                        "sequence_id": "0",
                        "etag": "0",
                        "name": "West"
                    }
                ]
            },
            "created_at": "2015-02-26T22:20:44-08:00",
            "modified_at": "2015-02-26T22:23:15-08:00",
            "trashed_at": null,
            "purged_at": null,
            "content_created_at": "2015-02-06T16:38:26-08:00",
            "content_modified_at": "2015-02-06T16:38:26-08:00",
            "created_by": {
                "type": "user",
                "id": "10523870",
                "name": "Ted Blosser",
                "login": "ted+demo@box.com"
            },
            "modified_by": {
                "type": "user",
                "id": "10523870",
                "name": "Ted Blosser",
                "login": "ted+demo@box.com"
            },
            "owned_by": {
                "type": "user",
                "id": "10523870",
                "name": "Ted Blosser",
                "login": "ted+demo@box.com"
            },
            "shared_link": null,
            "parent": {
                "type": "folder",
                "id": "606618154",
                "sequence_id": "0",
                "etag": "0",
                "name": "West"
            },
            "item_status": "active"
        }
    ],
    "limit": 30,
    "offset": 0
}
 

Metadata allows users and applications to define and store custom data associated with their files/folders. Metadata consists of key:value pairs that belong to files/folders. For example, an important contract may have key:value pairs of "clientNumber":"820183" and "clientName":"bioMedicalCorp".

Metadata can be used for many purposes. Enterprises may want to have a better way to organize their digital assets for their marketing teams or developers may want to provide advanced content functionality such as facilitating workflows or approvals. Metadata is also visible in the Box Web Application. To learn more, please visit the help documentation.

Suggest Edits

Metadata Templates

 

Metadata that belongs to a file or folder is grouped by templates. Templates allow the metadata service to provide a multitude of services, such as pre-defining sets of key:value pairs or schema enforcement on specific fields. For example, a marketingCollateral template may define where and when specific marketing content should be used. You can also see the representation of the template in the Box web application while navigating to a file preview. Metadata associated with folders is not displayed in the Box web application.

Each file can have multiple distinct template instances associated with it, such as a marketingCollateral and retentionPolicy template instances. Template instances are also grouped by "scopes". The supported scopes are enterprise_{id} and global. Enterprise scopes are defined on a per enterprises basis, whereas the global scope is Box application-wide. Attribute order within template instances is not defined.

Templates support four attributes types: string, enum, float, and date (RFC 3339).

Metadata templates can be set up in the Admin Console.

Template Object

template

string

A unique identifier for the template. The identifier must be unique across the scope of the enterprise to which the metadata template is being applied. The character limit is 64 and is validated by this regex: ^[a-zA-Z_][-a-zA-Z0-9_]*$

scope

string

The scope of the object. Global and enterprise scopes are supported. The Global scope contains the properties template, while the enterprise scope pertains to custom template within the enterprise. The ID of the enterprise will be appended to the enterprise scope in this format: enterprise_{id}

displayName

string

The display name of the template. The character limit is 4096.

hidden

boolean

Whether this template is hidden in the UI

fields

Collection
Template Field objects

The ordered set of key:value pairs for the template.

Template Fields Object

type

string

The data type of the field's value. Templates support four attribute types: string, enum, float, and date (RFC 3339).

key

string

A unique identifier for the field. The identifier must be unique within the template to which it belongs. The character limit is 256. All characters are allowed.

displayName

string

The display name of the field. The character limit is 4096. All characters are allowed.

description

string

A description of the field. The character limit is 4096. All characters are allowed.

hidden

boolean

Whether this template is hidden in the UI

options

array of strings

For type enum, a list of all possible values

options[key]

string

For type enum, one of the potential values. The character limit is 4096.

Global Properties Template

In addition to enterprise scoped templates, every file on Box has access to the properties template in the global scope. The properties template is a bucket of free-form key:value string pairs, with no additional schema associated with it. Properties are ideal for scenarios where applications want to write metadata to file objects in a flexible way, without pre-defined template structure.

To access properties metadata use /files/{file_id}/metadata/global/properties.

Suggest Edits

Get Metadata Template

Get information about a metadata template.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/metadata_templates/scope/template/schema

Path Params

scope
string
required
template
string
required

RETURNS

The schema representing the metadata template queried

curl https://api.box.com/2.0/metadata_templates/enterprise/productInfo/schema \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "templateKey": "productInfo",
    "scope": "enterprise_12345",
    "displayName": "Product Info",
    "hidden": false,
    "fields": [
        {
            "type": "float",
            "key": "skuNumber",
            "displayName": "SKU Number",
            "hidden": false
        },
        {
            "type": "string",
            "key": "description",
            "displayName": "Description",
            "hidden": false
        },
        {
            "type": "enum",
            "key": "department",
            "displayName": "Department",
            "hidden": false,
            "options": [
                {
                    "key": "Beauty"
                },
                {
                    "key": "Shoes"
                },
                {
                    "key": "Accessories"
                },
                {
                    "key": "Clothing"
                },
                {
                    "key": "Handbags"
                },
                {
                    "key": "Bedding"
                },
                {
                    "key": "Watches"
                }
            ]
        },
        {
            "type": "date",
            "key": "displayDate",
            "displayName": "Display Date",
            "hidden": false
        }
    ]
}
Suggest Edits

Create Metadata Template

Create a new metadata template with the specified schema.

 
posthttps://api.box.com/2.0/metadata_templates/schema

Form Data

scope
string
required

The scope of the object. Only the enterprise scope is supported.

templateKey
string

A unique identifier for the template. The identifier must be unique across the scope of the enterprise to which the metadata template is being applied to. Defaults to a string derived from the displayName if no value is provided.

displayName
string
required

The display name of the template.

hidden
boolean

Whether this template is hidden in the UI. Defaults to false.

fields
array

The ordered set of key:value pairs for the template.

field.type
string
required

The data type of the field's value. Templates support four attributes types: string, enum, float, and date (RFC 3339).

field.key
string

A unique identifier for the field. The identifier must be unique within the template to which it belongs. Defaults to a string derived from the displayName if no value is provided.

fields.displayName
string
required

The display name of the field

fields.options
array

For type "enum", a list of all possible values

options.key
string
required

For type "enum", one of the potential values

Template Delete Not Supported

Once created, a template cannot be deleted. In order to hide the template from the UI, set the "hidden" flag to true. The template will still appear in the API.

Available in Beta

As with any Beta, you may encounter issues with functionality. Box reserves the right to make changes which may improve, impair, add or remove functionality with these APIs.
If you would like to provide any feedback, please email metadata-feedback@box.com. We would love to hear from you.

Returns

A 201 will be received on successful creation. The schema representing the metadata template created.

Errors

400

Request body contains invalid metadata schema.

403

Request body contains a scope that the user is not allowed to create a template for.

curl https://api.box.com/2.0/metadata_templates/schema \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{
  "templateKey": "customer",
  "scope": "enterprise",
  "displayName": "Customer",
  "fields": [
    {
      "type": "string",
      "key": "customerTeam",
      "displayName": "Customer team"
    },
    {
      "type": "string",
      "key": "category",
      "displayName": "Category"
    },
    {
      "type": "string",
      "key": "brand",
      "displayName": "Brand"
    },
    {
      "type": "enum",
      "key": "fy",
      "displayName": "FY",
      "options": [
        {"key": "FY11"},
        {"key": "FY12"},
        {"key": "FY13"},
        {"key": "FY14"},
        {"key": "FY15"}
    ]},
    {
      "type": "enum",
      "key": "qtr",
      "displayName": "Qtr",
      "options": [
        {"key": "First"},
        {"key": "Second"},
        {"key": "Third"},
        {"key": "Fourth"}
    ]}
  ]}' \
-X POST
A binary file was returned
{
    "templateKey": "customer",
    "scope": "enterprise_490685",
    "displayName": "Customer",
    "fields": [
        {
            "type": "string",
            "key": "customerTeam",
            "displayName": "Customer team",
            "hidden": false
        },
        {
            "type": "string",
            "key": "category",
            "displayName": "Category",
            "hidden": false
        },
        {
            "type": "string",
            "key": "brand",
            "displayName": "Brand",
            "hidden": false
        },
        {
            "type": "enum",
            "key": "fy",
            "displayName": "FY",
            "options": [
                {
                    "key": "FY11"
                },
                {
                    "key": "FY12"
                },
                {
                    "key": "FY13"
                },
                {
                    "key": "FY14"
                },
                {
                    "key": "FY15"
                }
            ],
            "hidden": false
        },
        {
            "type": "enum",
            "key": "qtr",
            "displayName": "Qtr",
            "options": [
                {
                    "key": "First"
                },
                {
                    "key": "Second"
                },
                {
                    "key": "Third"
                },
                {
                    "key": "Fourth"
                }
            ],
            "hidden": false
        }
    ]
}
{
    "type": "error",
    "status": 400,
    "code": "bad_request",
    "help_url": "http://developers.box.com/docs/#errors",
    "message": "\"displayName\" is required and not set",
    "request_id": "616776114571858dc4ab8f"
}
{
    "type": "error",
    "status": 403,
    "code": "forbidden",
    "help_url": "http://developers.box.com/docs/#errors",
    "message": "Forbidden",
    "request_id": "616776114571858dc4ab8f"
}
Suggest Edits

Update Metadata Template

Update a metadata template.

 
puthttps://api.box.com/2.0/metadata_templates/scope/template/schema

Path Params

scope
string
required
template
string
required

Form Data

op
string
required

The operation name. The list of possible operations is detailed below.

data
object

The data for the operation. Can vary depending on the operation.

fieldKey
string

For operations that affect a specific field, the key of the field to be affected.

fieldKeys
array of strings

For operations that affect multiple fields, the keys of the fields to be affected.

enumOptionKeys
array of strings

For operations that affect multiple enum options, the keys of the enum options to be affected.

Only Non-Breaking Changes Supported

This API only supports non-breaking changes (listed below). A non-breaking change is a change that does not affect the values of existing metadata instances. To hide a template or a field from the UI, set the "hidden" flag to true at the template or field level. The template or field will still appear in the API.

Available in Beta

As with any Beta, you may encounter issues with functionality. Box reserves the right to make changes which may improve, impair, add or remove functionality with these APIs.
If you would like to provide any feedback, please email metadata-feedback@box.com. We would love to hear from you.

Possible Template Operations:

  • addEnumOption: Adds an enum option at the end of the enum option list for the specified field
    Params:
    data: JSON object of the enum option to be added
    fieldKey: The key of the field to add the enum option. Must refer to an enum field
    Example: {"op":"addEnumOption","fieldKey":"category","data":{"key":"Technology"}}. This will add a new enum option Technology under the field category.

  • addField: Adds a field at the end of the field list for the template
    Params:
    data: JSON object of the field to be added.
    Example: {"op":"addField","data":{"displayName":"Category","key":"category","hidden":false,"type":"string"}}. This will add a new non-hidden string field with a displayName and key of category.

  • editField: Edits any number of the base properties of a field: displayName, hidden, description
    Params:
    data: JSON object of the properties to be changed and their new values.
    fieldKey: The key of the field to be edited
    Example: {"op":"editField","fieldKey":"category","data":{"displayName":"Customer Group"}}. This will update the field category to have a new display name of Customer Group.

  • editTemplate: Edits any number of the base properties of a template: displayName, hidden
    Params:
    data: JSON object of the properties to be changed and their new values.
    Example: {"op":"editTemplate","data":{"displayName":"Client"}}. This will update the template to have a new display name of Client.

  • reorderEnumOptions: Reorders the enum option list to match the requested enum option list
    Params:
    fieldKey: The key of the field to reorder enum options. Must refer to an enum field.
    enumOptionKeys: The new list of enum option keys in the requested order
    Example: {"op":"reorderEnumOptions","fieldKey":"category","enumOptionKeys":["option2","option1","option3"]}. This will reorder the enum options for field category to have option2 first, followed by option1, then option3.

  • reorderFields: Reorders the field list to match the requested field list
    Params:
    fieldKeys: The new list of field keys in the requested order
    Example: {"op":"reorderFields","fieldKeys":["field2","field1","field3"]}. This will reorder the fields for the template to have field2 first, followed by field1, then field3.

Returns

The schema representing the updated metadata template.

Error code

400

Request body contains invalid metadata schema.

403

Request body contains a scope that the user is not allowed to create templates for.

404

Requested template is not found.

curl https://api.box.com/2.0/metadata_templates/enterprise/customer/schema \
-H "Authorization: Bearer "
-H "Content-Type: application/json" \
-d '[{"op":"editField","fieldKey":"category","data":{"displayName":"Customer Group"}}]' \
-X PUT
A binary file was returned
{
    "templateKey": "customer",
    "scope": "enterprise_490685",
    "displayName": "Customer",
    "fields": [
        {
            "type": "string",
            "key": "customerTeam",
            "displayName": "Customer team",
            "hidden": false
        },
        {
            "type": "string",
            "key": "category",
            "displayName": "Customer Group",
            "hidden": false
        },
        {
            "type": "string",
            "key": "brand",
            "displayName": "Brand",
            "hidden": false
        },
        {
            "type": "enum",
            "key": "fy",
            "displayName": "FY",
            "options": [
                {
                    "key": "FY11"
                },
                {
                    "key": "FY12"
                },
                {
                    "key": "FY13"
                },
                {
                    "key": "FY14"
                },
                {
                    "key": "FY15"
                }
            ],
            "hidden": false
        },
        {
            "type": "enum",
            "key": "qtr",
            "displayName": "Qtr",
            "options": [
                {
                    "key": "First"
                },
                {
                    "key": "Second"
                },
                {
                    "key": "Third"
                },
                {
                    "key": "Fourth"
                }
            ],
            "hidden": false
        }
    ]
}
{
    "type": "error",
    "status": 400,
    "code": "bad_request",
    "help_url": "http://developers.box.com/docs/#errors",
    "message": "\"displayName\" is required and not set",
    "request_id": "616776114571858dc4ab8f"
}
{
    "type": "error",
    "status": 403,
    "code": "forbidden",
    "help_url": "http://developers.box.com/docs/#errors",
    "message": "Forbidden",
    "request_id": "616776114571858dc4ab8f"
}
Suggest Edits

Get Enterprise Templates

Used to retrieve all metadata templates within a user's enterprise. Only the enterprise scope is supported.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/metadata_templates/scope

Path Params

scope
string
required

Query Params

marker
string

The position marker at which to begin the response. See marker-based paging for details.

limit
int32

The maximum number of items to return. The default is 100 and the maximum is 1,000.

Returns

Returns all of the metadata templates within an enterprise and their corresponding schema using marker-based paging.

curl https://api.box.com/2.0/metadata_templates/enterprise \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "limit": 100,
    "entries": [
        {
            "templateKey": "documentFlow",
            "scope": "enterprise_12345",
            "displayName": "Document Flow",
            "hidden": false,
            "fields": [
                {
                    "type": "string",
                    "key": "currentDocumentStage",
                    "displayName": "Current Document Stage",
                    "hidden": false,
                    "description": "What stage in the process the document is in"
                },
                {
                    "type": "string",
                    "key": "needsApprovalFrom",
                    "displayName": "Needs Approval From",
                    "hidden": false
                },
                {
                    "type": "string",
                    "key": "nextDocumentStage",
                    "displayName": "Next Document Stage",
                    "hidden": false,
                    "description": "Next document stage after approval is given"
                },
                {
                    "type": "float",
                    "key": "maximumDaysAllowedInCurrentStage",
                    "displayName": "Maximum Days Allowed In Current Stage",
                    "hidden": false,
                    "description": "Maximum number of days that the document is allowed to be in this stage."
                }
            ]
        },
        {
            "templateKey": "marketingCollateral",
            "scope": "enterprise_12345",
            "displayName": "Marketing Collateral",
            "hidden": false,
            "fields": [
                {
                    "type": "string",
                    "key": "audience1",
                    "displayName": "Audience",
                    "hidden": false
                },
                {
                    "type": "string",
                    "key": "documentType",
                    "displayName": "Document Type",
                    "hidden": false
                },
                {
                    "type": "string",
                    "key": "competitiveDocument",
                    "displayName": "Competitive Document",
                    "hidden": false
                },
                {
                    "type": "string",
                    "key": "status",
                    "displayName": "Status",
                    "hidden": false
                },
                {
                    "type": "string",
                    "key": "author",
                    "displayName": "Author",
                    "hidden": false
                },
                {
                    "type": "string",
                    "key": "editor",
                    "displayName": "Editor",
                    "hidden": false
                },
                {
                    "type": "string",
                    "key": "currentState",
                    "displayName": "Current State",
                    "hidden": false
                },
                {
                    "type": "string",
                    "key": "previousState",
                    "displayName": "Previous State",
                    "hidden": false
                }
            ]
        },
        {
            "templateKey": "productInfo",
            "scope": "enterprise_12345",
            "displayName": "Product Info",
            "hidden": false,
            "fields": [
                {
                    "type": "float",
                    "key": "skuNumber",
                    "displayName": "SKU Number",
                    "hidden": false
                },
                {
                    "type": "string",
                    "key": "description",
                    "displayName": "Description",
                    "hidden": false
                },
                {
                    "type": "enum",
                    "key": "department",
                    "displayName": "Department",
                    "hidden": false,
                    "options": [
                        {
                            "key": "Beauty"
                        },
                        {
                            "key": "Shoes"
                        },
                        {
                            "key": "Accessories"
                        },
                        {
                            "key": "Clothing"
                        },
                        {
                            "key": "Handbags"
                        },
                        {
                            "key": "Bedding"
                        },
                        {
                            "key": "Watches"
                        }
                    ]
                },
                {
                    "type": "date",
                    "key": "displayDate",
                    "displayName": "Display Date",
                    "hidden": false
                }
            ]
        }
    ],
    "next_marker": null,
    "prev_marker": null
}
Suggest Edits

Metadata Object

 

$template

string

The key of the template. Together with $parent and $scope, this forms a unique identifier for the metadata instance.

$scope

string

The scope of the object. global and enterprise scopes are supported. The global scope contains the properties template, while the enterprise scope pertains to custom templates within the enterprise. The ID of the enterprise will be appended to the enterprise scope in this format: enterprise_{id}

$parent

string

The ID of the object the metadata object belongs to. Both file and folder objects are supported. Updating metadata does not directly affect the parent object, such as changing the modified_at field for a file or folder.

$version

integer

The version of the metadata object. Starts at 0 and increases every time a user-defined property is modified.

$id

string

36-character UUID to identify the metadata object

$type

string

A unique identifier for the "type" of this instance. This is an internal system property and should not be used by a client application.

$typeVersion

integer

The last-known version of the template of the object. This is an internal system property and should not be used by a client application.

key(s)

string

Custom value(s) defined by the template. These values also have a corresponding display name that are viewable in applications like the Box web application. The total size of a template instance can not exceed 16384 characters. Since the "$" character is reserved for metadata service keys, custom values can not be prefixed with the "$" character.

Suggest Edits

Get All Metadata on File

Used to retrieve all metadata associated with a given file

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/files/file_id/metadata

Path Params

file_id
string
required

Returns

Returns all of the metadata instances associated with the file. This API does not support paging -- it always returns all of the metadata instances.

curl https://api.box.com/2.0/files/5010739061/metadata \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "entries": [
        {
            "currentDocumentStage": "Init",
            "$type": "documentFlow-452b4c9d-c3ad-4ac7-b1ad-9d5192f2fc5f",
            "$parent": "file_5010739061",
            "$id": "50ba0dba-0f89-4395-b867-3e057c1f6ed9",
            "$version": 4,
            "$typeVersion": 2,
            "needsApprovalFrom": "Smith",
            "$template": "documentFlow",
            "$scope": "enterprise_12345"
        },
        {
            "$type": "productInfo-9d7b6993-b09e-4e52-b197-e42f0ea995b9",
            "$parent": "file_5010739061",
            "$id": "15d1014a-06c2-47ad-9916-014eab456194",
            "$version": 2,
            "$typeVersion": 1,
            "skuNumber": 45334223,
            "description": "Watch",
            "$template": "productInfo",
            "$scope": "enterprise_12345"
        },
        {
            "Popularity": "25",
            "$type": "properties",
            "$parent": "file_5010739061",
            "$id": "b6f36cbc-fc7a-4eda-8889-130f350cc057",
            "$version": 0,
            "$typeVersion": 2,
            "$template": "properties",
            "$scope": "global"
        },

    ],
    "limit": 100
}
Suggest Edits

Get Metadata on File

Get the metadata instance for a file.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/files/file_id/metadata/scope/template

Path Params

file_id
string
required
scope
string
required

The scope of the metadata object (global or enterprise_{enterprise_id})

template
string
required

The key of the template. For example, the global scope has the properties template.

Returns

An instance of the template that includes key:value pairs defined by a user or application. If there is no template instance present, a 404 HTTP status code of not_found will be returned.

curl https://api.box.com/2.0/files/5010739061/metadata/enterprise/bandInfo \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "audience1": "internal",
    "documentType": "Q1 plans",
    "competitiveDocument": "no",
    "status": "active",
    "author": "Jones",
    "currentState": "proposal",
    "$type": "marketingCollateral-d086c908-2498-4d3e-8a1f-01e82bfc2abe",
    "$parent": "file_5010739061",
    "$id": "2094c584-68e1-475c-a581-534a4609594e",
    "$version": 0,
    "$typeVersion": 0,
    "$template": "marketingCollateral",
    "$scope": "enterprise_12345"
}
Suggest Edits

Create Metadata on File

Create a metadata instance for a file.

 

OAuth2 Auth

 Authentication is required for this endpoint.
posthttps://api.box.com/2.0/files/file_id/metadata/scope/template

Path Params

file_id
string
required
scope
string
required

The scope of the metadata object (global or enterprise_{enterprise_id})

template
string
required

The key of the template. For example, the global scope has the properties template.

Body Params

key_1
string

Sample key:value pair

key_2
string

Sample key:value pair

Headers

Content-Type
string

Must be application/json

When creating metadata, only values that adhere to the metadata template schema will be accepted.

Returns

An instance of the template that includes key:value pairs defined by a user or application. If the template instance already exists, a 409 HTTP status code of conflict will be returned and the update method should be used.

curl https://api.box.com/2.0/files/5010739061/metadata/enterprise/marketingCollateral \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{ "audience1": "internal", "documentType": "Q1 plans", "competitiveDocument": "no", "status": "active", "author": "Jones", "currentState": "proposal"}' \
-X POST
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "audience1": "internal",
    "documentType": "Q1 plans",
    "competitiveDocument": "no",
    "status": "active",
    "author": "Jones",
    "currentState": "proposal",
    "$type": "marketingCollateral-d086c908-2498-4d3e-8a1f-01e82bfc2abe",
    "$parent": "file_5010739061",
    "$id": "2094c584-68e1-475c-a581-534a4609594e",
    "$version": 0,
    "$typeVersion": 0,
    "$template": "marketingCollateral",
    "$scope": "enterprise_12345"
}
Suggest Edits

Update Metadata on File

Update a metadata instance on a file.

 
puthttps://api.box.com/2.0/files/file_id/metadata/scope/template

Path Params

file_id
string
required
scope
string
required

The scope of the metadata object (global or enterprise_{enterprise_id})

template
string
required

The key of the template. For example, the global scope has the properties template.

Form Data

op
string
required

The operation type. Must be add, replace, remove , test, move, or copy.

path
string
required

The path that designates the key, in the format of a JSON-Pointer. Since all keys are located at the root of the metadata instance, the key must be prefixed with a /. Special characters ~ and / in the key must be escaped according to JSON-Pointer specification. The value at the path must exist for the operation to be successful.

value
string

The value to be set or tested. Required for add, replace, and test operations. For add, if value already exists, then previous value will be overwritten by the new value. For replace, the metadata value must exist before replacing.For test, the value of the existing metadata instance must match the specified value.

from
string

Required for move or copy. The path that designates the source key, in the format of a JSON-Pointer, formatted in the same way as path. Used in conjunction with path: from specifies the source, path specifies the destination.

Headers

Content-Type
string
required

Must be application/json-patch+json

The request body must follow the JSON-Patch specification, which is represented as a JSON array of operation objects (see examples for more details). Updates can be either add, replace, remove , test, move, or copy. 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.

The update is applied atomically. If any errors occur during the application of the update operations, the metadata instance remains unchanged.

Returns

An instance of the template that includes key:value pairs defined by a user or application. If there is no template instance present, a 404 HTTP status code of not_found will be returned

curl https://api.box.com/2.0/files/5010739061/metadata/enterprise/marketingCollateral \
-H "Authorization: Bearer " \
-H "Content-Type: application/json-patch+json" \
-d '[{"op": "test", "path": "/competitiveDocument", "value": "no"},
{"op": "remove", "path": "/competitiveDocument"},
{"op": "test", "path": "/status", "value": "active"},
{"op": "replace", "path": "/status", "value": "inactive"},
{"op": "test", "path":"/author", "value":"Jones"},
{"op": "copy", "from":"/author", "path":"/editor"},
{"op": "test", "path":"/currentState", "value":"proposal"},
{"op": "move", "from":"/currentState", "path": "/previousState"},
{"op": "add", "path":"/currentState", "value": "reviewed"}]' \
-X PUT
A binary file was returned
{
    "audience1": "internal",
    "documentType": "Q1 plans",
    "status": "inactive",
    "author": "Jones",
    "$type": "marketingCollateral-d086c908-2498-4d3e-8a1f-01e82bfc2abe",
    "$parent": "file_5010739061",
    "$id": "2094c584-68e1-475c-a581-534a4609594e",
    "$version": 1,
    "$typeVersion": 0,
    "editor": "Jones",
    "previousState": "proposal",
    "currentState": "reviewed",
    "$template": "marketingCollateral",
    "$scope": "enterprise_12345"
}
Suggest Edits

Delete Metadata on File

Delete the template instance on a file.

 

OAuth2 Auth

 Authentication is required for this endpoint.
deletehttps://api.box.com/2.0/files/file_id/metadata/scope/template

Path Params

file_id
string
required
scope
string
required

The scope of the metadata object (global or enterprise_{enterprise_id})

template
string
required

The key of the template. For example, the global scope has the properties template.

To delete custom key:value pairs within a template instance, refer to the updating metadata section.

Returns

An empty HTTP 204 response to confirm the deletion of the template instance.

curl https://api.box.com/2.0/files/5010739061/metadata/enterprise/marketingCollateral \
-H "Authorization: Bearer " \
-X DELETE
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Try the API to see results
Suggest Edits

Get All Metadata on Folder

Used to retrieve all metadata associated with a given folder

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/folders/folder_id/metadata

Path Params

folder_id
string
required

Returns

Returns all of the metadata instances associated with the folder. This API does not support paging -- it always returns all of the metadata instances.

Available in Beta

As with any Beta, you may encounter issues with functionality. Box reserves the right to make changes which may improve, impair, add or remove functionality with these APIs.

If you would like to provide any feedback, please email metadata-feedback@box.com. We would love to hear from you.

Folder metadata operations on folder ID 0 (zero) are not allowed.

Attempts to perform Folder metadata operations on folder ID 0 (zero) will result in a 403 HTTP status code.

curl https://api.box.com/2.0/folders/998951261/metadata \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "entries": [
        {
            "currentDocumentStage": "prioritization",
            "needsApprovalFrom": "planning team",
            "$type": "documentFlow-452b4c9d-c3ad-4ac7-b1ad-9d5192f2fc5f",
            "$parent": "folder_998951261",
            "$id": "e57f90ff-0044-48c2-807d-06b908765baf",
            "$version": 1,
            "$typeVersion": 2,
            "maximumDaysAllowedInCurrentStage": 5,
            "$template": "documentFlow",
            "$scope": "enterprise_12345"
        },
        {
            "skuNumber": 45234522115075,
            "description": "Hat",
            "department": "Accessories",
            "$type": "productInfo-9d7b6993-b09e-4e52-b197-e42f0ea995b9",
            "$parent": "folder_998951261",
            "$id": "0dd54220-8340-4ea1-bd3f-59a23c68ccdd",
            "$version": 0,
            "$typeVersion": 1,
            "$template": "productInfo",
            "$scope": "enterprise_12345"
        }
    ],
    "limit": 100
}
Suggest Edits

Get Metadata on Folder

Get the metadata instance for a folder.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/folders/folder_id/metadata/scope/template

Path Params

folder_id
string
required
scope
string
required

The scope of the metadata object (global or enterprise_{enterprise_id})

template
string
required

The key of the template. For example, the global scope has the properties template.

Returns

Available in Beta

As with any Beta, you may encounter issues with functionality. Box reserves the right to make changes which may improve, impair, add or remove functionality with these APIs.
If you would like to provide any feedback, please email metadata-feedback@box.com. We would love to hear from you.

Folder metadata operations on folder ID 0 (zero) are not allowed.

Attempts to perform Folder metadata operations on folder ID 0 (zero) will result in a 403 HTTP status code.

An instance of the template that includes key:value pairs defined by a user or application. If there is no template instance present, a 404 HTTP status code of not_found will be returned.

curl https://api.box.com/2.0/folders/998951261/metadata/enterprise/documentFlow \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "currentDocumentStage": "initial vetting",
    "needsApprovalFrom": "vetting team",
    "nextDocumentStage": "prioritization",
    "$type": "documentFlow-452b4c9d-c3ad-4ac7-b1ad-9d5192f2fc5f",
    "$parent": "folder_998951261",
    "$id": "e57f90ff-0044-48c2-807d-06b908765baf",
    "$version": 0,
    "$typeVersion": 2,
    "$template": "documentFlow",
    "$scope": "enterprise_12345"
}
Suggest Edits

Create Metadata on Folder

Create a metadata instance for a folder.

 

OAuth2 Auth

 Authentication is required for this endpoint.
posthttps://api.box.com/2.0/folders/folder_id/metadata/scope/template

Path Params

folder_id
string
required
scope
string
required

The scope of the metadata object (global or enterprise_{enterprise_id})

template
string
required

The key of the template. For example, the global scope has the properties template.

Body Params

key_1
string

Sample key:value pair

key_2
string

Sample key:value pair

Headers

Content-Type
string
required

Must be application/json

When creating metadata, only values that adhere to the metadata template schema will be accepted.

Returns

Available in Beta

As with any Beta, you may encounter issues with functionality. Box reserves the right to make changes which may improve, impair, add or remove functionality with these APIs.
If you would like to provide any feedback, please email metadata-feedback@box.com. We would love to hear from you.

Folder metadata operations on folder ID 0 (zero) are not allowed.

Attempts to perform Folder metadata operations on folder ID 0 (zero) will result in a 403 HTTP status code.

An instance of the template that includes key:value pairs defined by a user or application. If the template instance already exists, a 409 HTTP status code of conflict will be returned and the update method should be used.

curl https://api.box.com/2.0/folders/998951261/metadata/enterprise/documentFlow \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{"currentDocumentStage": "initial vetting", "needsApprovalFrom": "vetting team", "nextDocumentStage": "prioritization"}' \
-X POST
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "currentDocumentStage": "initial vetting",
    "needsApprovalFrom": "vetting team",
    "nextDocumentStage": "prioritization",
    "$type": "documentFlow-452b4c9d-c3ad-4ac7-b1ad-9d5192f2fc5f",
    "$parent": "folder_998951261",
    "$id": "e57f90ff-0044-48c2-807d-06b908765baf",
    "$version": 0,
    "$typeVersion": 0,
    "$template": "documentFlow",
    "$scope": "enterprise_12345"
}
Suggest Edits

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.

 
puthttps://api.box.com/2.0/folders/folder_id/metadata/scope/template

Path Params

folder_id
string
required
scope
string
required

The scope of the metadata object (global or enterprise_{enterprise_id})

template
string
required

The key of the template. For example, the global scope has the properties template.

Form Data

op
string
required

The operation type. Must be add, replace, remove , or test.

path
string
required

The path that designates the key. Must be prefixed with a /

value
string

The value to be set. If value already exists, then previous value will be overwritten by the new value. Required for add and replace operations.

Headers

Content-Type
string
required

Must be application/json-patch+json

Returns

Available in Beta

As with any Beta, you may encounter issues with functionality. Box reserves the right to make changes which may improve, impair, add or remove functionality with these APIs.
If you would like to provide any feedback, please email metadata-feedback@box.com. We would love to hear from you.

Folder metadata operations on folder ID 0 (zero) are not allowed.

Attempts to perform Folder metadata operations on folder ID 0 (zero) will result in a 403 HTTP status code.

An instance of the template that includes key:value pairs defined by a user or application. If there is no template instance present, a 404 HTTP status code of not_found will be returned

curl https://api.box.com/2.0/folders/998951261/metadata/enterprise/documentFlow \
-H "Authorization: Bearer " \
-H "Content-Type: application/json-patch+json" \
-d '[{"op": "test", "path":"/currentDocumentStage", "value": "initial vetting" },
	{"op": "replace", "path":"/currentDocumentStage", "value": "prioritization" },
  {"op": "test", "path":"/needsApprovalFrom", "value": "vetting team" },
  {"op": "replace", "path":"/needsApprovalFrom", "value": "planning team" },
	{"op": "add", "path":"/maximumDaysAllowedInCurrentStage", "value": 5},
  {"op": "test", "path":"/nextDocumentStage", "value": "prioritization" },
	{"op": "remove", "path":"/nextDocumentStage"}]' \
-X PUT
A binary file was returned
{
    "currentDocumentStage": "prioritization",
    "needsApprovalFrom": "planning team",
    "$type": "documentFlow-452b4c9d-c3ad-4ac7-b1ad-9d5192f2fc5f",
    "$parent": "folder_998951261",
    "$id": "e57f90ff-0044-48c2-807d-06b908765baf",
    "$version": 1,
    "$typeVersion": 2,
    "maximumDaysAllowedInCurrentStage": 5,
    "$template": "documentFlow",
    "$scope": "enterprise_12345"
}
Suggest Edits

Delete Metadata on Folder

Delete the metadata instance for a folder.

 

OAuth2 Auth

 Authentication is required for this endpoint.
deletehttps://api.box.com/2.0/folders/folder_id/metadata/scope/template

Path Params

folder_id
string
required
scope
string
required

The scope of the metadata object (global or enterprise_{enterprise_id})

template
string
required

Returns

To delete custom key:value pairs within a template instance, you should refer to the updating metadata section.

Available in Beta

As with any Beta, you may encounter issues with functionality. Box reserves the right to make changes which may improve, impair, add or remove functionality with these APIs.
If you would like to provide any feedback, please email metadata-feedback@box.com. We would love to hear from you.

Folder metadata operations on folder ID 0 (zero) are not allowed.

Attempts to perform Folder metadata operations on folder ID 0 (zero) will result in a 403 HTTP status code.

An empty HTTP 204 response to confirm the deletion of the template instance.

curl https://api.box.com/2.0/folders/998951261/metadata/enterprise/documentFlow \
-H "Authorization: Bearer " \
-X DELETE
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Try the API to see results
Suggest Edits

User Object

 

The users endpoint is used for managing a user and its content. For an individual user, this includes their own user information and content. For an enterprise admin, this includes both the individual user and any other users in the admin’s enterprise account. Italicized attributes are not returned by default and must be retrieved through the fields parameter.

type

string

user

id

string

The ID of the user object

name

string

The name of the user

login

string

The email address the user uses to log in

created_at

date-time

When the user object was created

modified_at

date-time

When the user object was last modified

The user's preferred language

The user's timezone

space_amount

integer

The user’s total available space amount in bytes

space_used

integer

The amount of space in use by the user

max_upload_size

integer

The maximum individual file size in bytes the user can have

status

string

Can be active, inactive, cannot_delete_edit, or cannot_delete_edit_upload

job_title

string

The user’s job title

phone

string

The user’s phone number

address

string

The user’s address

avatar_url

string

URL of the user’s avatar image

role

string

The user’s enterprise role. Can be admin, coadmin, or user.

tracking_codes

array

An array of key/value pairs set by the user’s admin

can_see_managed_users

boolean

Whether the user can see other enterprise users in her contact list

is_sync_enabled

boolean

Whether the user can use Box Sync

is_external_collab_restricted

boolean

Whether the user is allowed to collaborate with users outside her enterprise

is_exempt_from_device_limits
boolean

Whether to exempt the user from Enterprise device limits

is_exempt_from_login_verification

boolean

Whether the user must use two-factor authentication

enterprise

object

Mini representation of the user’s enterprise

my_tags

array of strings

Tags for all files and folders owned by the user

hostname

string

The root (protocol, subdomain, domain) of any links that need to be generated for the user

is_platform_access_only

boolean

Whether the user is an App User

{
    "type": "user",
    "id": "181216415",
    "name": "sean rose",
    "login": "sean+awesome@box.com",
    "created_at": "2012-05-03T21:39:11-07:00",
    "modified_at": "2012-11-14T11:21:32-08:00",
    "role": "admin",
    "language": "en",
    "timezone": "Africa/Bujumbura",
    "space_amount": 11345156112,
    "space_used": 1237009912,
    "max_upload_size": 2147483648,
    "tracking_codes": [],
    "can_see_managed_users": true,
    "is_sync_enabled": true,
    "status": "active",
    "job_title": "",
    "phone": "6509241374",
    "address": "",
    "avatar_url": "https://www.box.com/api/avatar/large/181216415",
    "is_exempt_from_device_limits": false,
    "is_exempt_from_login_verification": false,
    "enterprise": {
        "type": "enterprise",
        "id": "17077211",
        "name": "seanrose enterprise"
    },
    "my_tags": [
        "important",
        "needs review"
    ]
}
{
        "type": "user",
        "id": "181216415",
        "name": "sean rose",
        "login": "sean+awesome@box.com"
}
Suggest Edits

Get Current User

Get information about the user who is currently logged in (i.e. the user for whom this auth token was generated).

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/users/me

Query Params

fields
string

Comma-separated list of fields to include in the response

Returns

Returns a single complete user object.

curl https://api.box.com/2.0/users/me
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "user",
    "id": "17738362",
    "name": "sean rose",
    "login": "sean@box.com",
    "created_at": "2012-03-26T15:43:07-07:00",
    "modified_at": "2012-12-12T11:34:29-08:00",
    "language": "en",
    "space_amount": 5368709120,
    "space_used": 2377016,
    "max_upload_size": 262144000,
    "status": "active",
    "job_title": "Employee",
    "phone": "5555555555",
    "address": "555 Office Drive",
    "avatar_url": "https://app.box.com/api/avatar/large/17738362"
}
Suggest Edits

Get User

Get information about a user in the enterprise. Requires enterprise administration authorization.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/users/user_id

Path Params

user_id
string
required

The ID of the user

Query Params

fields
string

Comma-separated list of fields to include in the response

Returns

Returns a single complete user object.

Note:

The GET /users{id} endpoint also returns a limited set of information for external users who are collaborated on content owned by the enterprise for certain admin scopes/users. Disallowed fields will return null.

curl https://api.box.com/2.0/users/USER_ID
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "user",
    "id": "10543463",
    "name": "Arielle Frey",
    "login": "ariellefrey@box.com",
    "created_at": "2011-01-07T12:37:09-08:00",
    "modified_at": "2014-05-30T10:39:47-07:00",
    "language": "en",
    "timezone": "America/Los_Angeles",
    "space_amount": 10737418240,
    "space_used": 558732,
    "max_upload_size": 5368709120,
    "status": "active",
    "job_title": "",
    "phone": "",
    "address": "",
    "avatar_url": "https://blosserdemoaccount.app.box.com/api/avatar/large/10543465"
}
Suggest Edits

Create User

Create a new managed user in an enterprise. This method only works for enterprise admins.

 

OAuth2 Auth

 Authentication is required for this endpoint.
posthttps://api.box.com/2.0/users

Query Params

fields
string

Comma-separated list of fields to include in the response

Body Params

login
string
required

The email address the user uses to login

name
string
required

The name of the user

role
string

The user’s enterprise role. Can be coadmin or user

language
string

The language of the user. Input format follows ISO 639-1 language code format.

is_sync_enabled
boolean

Whether the user can use Box Sync

job_title
string

The user’s job title

phone
string

The user’s phone number

address
string

The user’s address

space_amount
int32

The user’s total available space amount in bytes

tracking_codes
array of mixed types

An array of key/value pairs set by the user’s admin

can_see_managed_users
boolean

Whether the user can see other managed users

timezone
string

The user's timezone. Input format follows tz database timezones.

is_exempt_from_device_limits
boolean

Whether to exempt the user from Enterprise device limits

is_exempt_from_login_verification
boolean

Whether the user must use two-factor authentication

is_external_collab_restricted
boolean

Whether the user is restricted from external collaboration

status
string

active, inactive, cannot_delete_edit, or cannot_delete_edit_upload

Returns

Returns the standard user object for a newly created user when making the request with just the required parameters.

Errors may be thrown when the fields are invalid or this API call is made from a non-admin account.

curl https://api.box.com/2.0/users \
-H "Authorization: Bearer " \
-d '{"login": "eddard@box.com", "name": "Ned Stark"}' \
-X POST
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "user",
    "id": "187273718",
    "name": "Ned Stark",
    "login": "eddard@box.com",
    "created_at": "2012-11-15T16:34:28-08:00",
    "modified_at": "2012-11-15T16:34:29-08:00",
    "role": "user",
    "language": "en",
    "timezone": "America/Los_Angeles",
    "space_amount": 5368709120,
    "space_used": 0,
    "max_upload_size": 2147483648,
    "status": "active",
    "job_title": "",
    "phone": "555-555-5555",
    "address": "555 Box Lane",
    "avatar_url": "https://www.box.com/api/avatar/large/187273718"
}
Suggest Edits

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.

 

OAuth2 Auth

 Authentication is required for this endpoint.
posthttps://api.box.com/2.0/users

Query Params

fields
string

Comma-separated list of fields to include in the response

Body Params

name
string
required

The name of the user

is_platform_access_only
boolean
required

Specifies that an App User is created. Value must be "true".

language
string

The language of the user. Input format follows ISO 639-1 language code format.

job_title
string

The user's job title

timezone
string

The user's timezone. Input format follows tz database timezones.

phone
string

The user's phone number

address
string

The user's address

space_amount
int32

The user’s total available space amount in bytes

status
string

active, inactive, cannot_delete_edit, or cannot_delete_edit_upload

is_external_collab_restricted
boolean

Whether the user is restricted from external collaboration

can_see_managed_users
boolean

Whether the user can see managed users

Returns

Returns the user object for the newly created App User. Errors may be thrown when the fields are invalid or this API call is made from a non-admin account.

curl https://api.box.com/2.0/users \
-H "Authorization: Bearer " \
-d '{"name": "Ned Stark", "is_platform_access_only": true}' \
-X POST
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "user",
    "id": "236506102",
    "name": "Ned Stark",
    "login": "AppUser_59659_vuNs7OCQ7y@box.com",
    "created_at": "2015-04-20T20:09:59-07:00",
    "modified_at": "2015-04-20T20:09:59-07:00",
    "language": "en",
    "timezone": "America/Los_Angeles",
    "space_amount": 5368709120,
    "space_used": 0,
    "max_upload_size": 16106127360,
    "status": "active",
    "job_title": "",
    "phone": "",
    "address": "",
    "avatar_url": ""
}
Suggest Edits

Update User

Update the information for a user.

 

OAuth2 Auth

 Authentication is required for this endpoint.
puthttps://api.box.com/2.0/users/user_id

Path Params

user_id
string
required

The ID of the user

Query Params

fields
string

Comma-separated list of fields to include in the response

Body Params

notify
boolean

Whether the user should receive an email when they are rolled out of an enterprise

enterprise
string

Set this to null to roll the user out of the enterprise and make them a free user

name
string

The name of this user

role
string

The user’s enterprise role. Can be coadmin or user

language
string

The language of the user

is_sync_enabled
boolean

Whether the user can use Box Sync

job_title
string

The user’s job title

phone
string

The user’s phone number

address
string

The user’s address

space_amount
int32

The user’s total available space amount in byte. A value of -1 grants unlimited storage.

tracking_codes
array of mixed types

An array of key/value pairs set by the user’s admin

can_see_managed_users
boolean

Whether the user can see other enterprise users in its contact list

status
string

active, inactive, cannot_delete_edit, or cannot_delete_edit_upload

timezone
string

The timezone of the user

is_exempt_from_device_limits
boolean

Whether to exempt the user from Enterprise device limits

is_exempt_from_login_verification
boolean

Whether the user must use two-factor authentication

is_password_reset_required
boolean

Whether the user is required to reset their password

is_external_collab_restricted
boolean

Whether the user is restricted from external collaboration

To roll a user out of their enterprise (and convert them to a standalone free user), update the special enterprise attribute to be null. The enterprise attribute can only be updated by enterprise admins.

Returns

Returns the a full user object for the updated user. Errors may be thrown when the fields are invalid or this API call is made from a non-admin account.

curl https://api.box.com/2.0/users/USER_ID \
-H "Authorization: Bearer " \
-d '{"name": "sean"}' \
-X PUT
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "user",
    "id": "181216415",
    "name": "sean",
    "login": "sean+awesome@box.com",
    "created_at": "2012-05-03T21:39:11-07:00",
    "modified_at": "2012-12-06T18:17:16-08:00",
    "role": "admin",
    "language": "en",
    "space_amount": 5368709120,
    "space_used": 1237179286,
    "max_upload_size": 2147483648,
    "tracking_codes": [],
    "can_see_managed_users": true,
    "is_sync_enabled": true,
    "status": "active",
    "job_title": "",
    "phone": "6509241374",
    "address": "",
    "avatar_url": "https://www.box.com/api/avatar/large/181216415",
    "is_exempt_from_device_limits": false,
    "is_exempt_from_login_verification": false
}
Suggest Edits

Delete User

Delete a user.

 

OAuth2 Auth

 Authentication is required for this endpoint.
deletehttps://api.box.com/2.0/users/user_id

Path Params

user_id
string
required

The ID of the user

Query Params

notify
boolean

Whether the destination user will receive email notification of the transfer

force
boolean

Whether the user should be deleted even if this user still own files

Returns

An empty 204 response is sent to confirm deletion of the user. If the user still has files in their account and the ‘force’ parameter is not sent, an error is returned.

curl https://api.box.com/2.0/users/USER_ID \
-H "Authorization: Bearer " \
-X DELETE
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Try the API to see results
Suggest Edits

Get Enterprise Users

Returns all of the users for the Enterprise. Only available to admin accounts or service accounts.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/users

Query Params

user_type
string

The type of user to search for. One of all, external or managed. The default is managed.

filter_term
string

Only return users whose name or login matches the filter_term. See notes below for details on the matching.

fields
string

Comma-separated list of fields to include in the response

offset
int32

The offset of the item at which to begin the response. See offset-based paging for details.

limit
int32

The maximum number of items to return. The default is 100 and the maximum is 1,000.

Returns

Returns all of the users in the enterprise using offset-based paging.

Note:

When searching using filter_term, managed users (and app users) match if either the name or login start with the given string (initial match). External users only match if the login exactly matches the given string (exact match). All matching is case-insensitive.

If filter_term is omitted, all managed users (and app users) will be returned. External users can only be returned with an exact match of filter_term.

When called by a service account, this API will return either only app users or all enterprise users depending on the authorized scope of the app.

Note:

For external user, the API returns null for all fields except type, id, name, login, language, timezone, avatar_url, and enterprise (if requested via fields).

curl https://api.box.com/2.0/users
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "total_count": 1,
    "entries": [
        {
            "type": "user",
            "id": "181216415",
            "name": "sean rose",
            "login": "sean+awesome@box.com",
            "created_at": "2012-05-03T21:39:11-07:00",
            "modified_at": "2012-08-23T14:57:48-07:00",
            "language": "en",
            "space_amount": 5368709120,
            "space_used": 52947,
            "max_upload_size": 104857600,
            "status": "active",
            "job_title": "",
            "phone": "5555551374",
            "address": "10 Cloud Way Los Altos CA",
            "avatar_url": "https://app.box.com/api/avatar/large/181216415"
        }
    ]
}
Suggest Edits

Invite User

Invite an existing user to join an Enterprise.

 

OAuth2 Auth

 Authentication is required for this endpoint.
posthttps://api.box.com/2.0/invites

Query Params

fields
string

Comma-separated list of fields to include in the response

Body Params

enterprise
object
 
enterprise.id
int32
required

The ID of the enterprise the user will be invited to

actionable_by
object
 
actionable_by.login
string
required

The login of the user that will receive the invitation

The existing user can not be part of another Enterprise and must already have a Box account. Once invited, the user will receive an email and prompt to accept the invitation within the Box web application. This method requires the "Manage An Enterprise" scope for the enterprise, which can be enabled within your developer console.

Returns

A new invite object will be returned if successful. The status of the invite can also be queried by retrieving the invite object. This can be done by making a GET request to /invites/{invite_id}.

curl https://api.box.com/2.0/invites \
-H "Authorization: Bearer " \
-d '{ "enterprise" : { "id" : "42500" } , "actionable_by" : { "login" : "freeuser@box.com" } }' \
-X POST
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    {
    "type": "invite",
    "id": "238632",
    "invited_to": {
        "type": "enterprise",
        "id": "42500",
        "name": "Blosser Account"
    },
    "actionable_by": {
        "type": "user",
        "id": "229667663",
        "name": "Lleyton Hewitt",
        "login": "freeuser@box.com"
    },
    "invited_by": {
        "type": "user",
        "id": "10523870",
        "name": "Ted Blosser",
        "login": "ted@box.com"
    },
    "status": "pending",
    "created_at": "2014-12-23T12:55:53-08:00",
    "modified_at": "2014-12-23T12:55:53-08:00"
}
Suggest Edits

Move Owned Items

Move all of the items owned by a user into a new folder in another user’s account.

 

OAuth2 Auth

 Authentication is required for this endpoint.
puthttps://api.box.com/2.0/users/user_id/folders/folder_id

Path Params

user_id
string
required

The ID of the user whose owned content will be moved

folder_id
string
required

Must be 0 (the user's root folder)

Query Params

notify
boolean

Whether the destination user should receive email notification of the transfer

fields
string

Comma-separated list of fields to include in the response

Body Params

owned_by
object
 
owned_by.id
string
required

The ID of the user who the folder will be transferred to

You can move folders across users as long as you have administrative permissions and the ‘source’ user owns the folders. To move everything from the root folder, use “0” which always represents the root folder of a Box account.

Returns

Returns the information for the newly created destination folder.. An error is returned if you do not have the necessary permissions to move the folder.

folder_id:

Only moving of the root folder (0) is supported.

curl https://api.box.com/2.0/users/USER_ID/folders/FOLDER_ID \
-H "Authorization: Bearer " \
-d '{"owned_by": {"id": "USER_ID"}}' \
-X PUT
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "folder",
    "id": "11446498",
    "sequence_id": "1",
    "etag": "1",
    "name": "Pictures",
    "created_at": "2012-12-12T10:53:43-08:00",
    "modified_at": "2012-12-12T11:15:04-08:00",
    "description": "Some pictures I took",
    "size": 629644,
    "path_collection": {
        "total_count": 1,
        "entries": [
            {
                "type": "folder",
                "id": "0",
                "sequence_id": null,
                "etag": null,
                "name": "All Files"
            }
        ]
    },
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "modified_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "owned_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "shared_link": {
        "url": "https://www.box.com/s/vspke7y05sb214wjokpk",
        "download_url": null,
        "vanity_url": null,
        "is_password_enabled": false,
        "unshared_at": null,
        "download_count": 0,
        "preview_count": 0,
        "access": "open",
        "permissions": {
            "can_download": true,
            "can_preview": true
        }
    },
    "folder_upload_email": {
        "access": "open",
        "email": "upload.Picture.k13sdz1@u.box.com"
    },
    "parent": {
        "type": "folder",
        "id": "0",
        "sequence_id": null,
        "etag": null,
        "name": "All Files"
    },
    "item_status": "active",
    "item_collection": {
        "total_count": 1,
        "entries": [
            {
                "type": "file",
                "id": "5000948880",
                "sequence_id": "3",
                "etag": "3",
                "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc",
                "name": "tigers.jpeg"
            }
        ],
        "offset": 0,
        "limit": 100
    }
}
Suggest Edits

Change User's Login

Used to convert one of the user’s confirmed email aliases into the user’s primary login.

 

OAuth2 Auth

 Authentication is required for this endpoint.
puthttps://api.box.com/2.0/users/user_id

Path Params

:user_id
string
required

The ID of the user

Query Params

fields
string

Comma-separated list of fields to include in the response

Body Params

login
string
required

The email alias to become the primary email

Returns

If the user_id is valid and the email address is a confirmed email alias, the updated user object will be returned.

curl https://api.box.com/2.0/users/USER_ID \
-H "Authorization: Bearer " \
-d '{"login": "dglover2@box.com"}' ]
-X PUT
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type":"user",
    "id":"18180156",
    "name":"Dan Glover",
    "login":"dglover2@box.com",
    "created_at":"2012-09-13T10:19:51-07:00",
    "modified_at":"2012-09-21T10:24:51-07:00",
    "role":"user",
    "language":"en",
    "space_amount":5368709120,
    "space_used":0,
    "max_upload_size":1073741824,
    "tracking_codes":[],
    "see_managed_users":false,
    "sync_enabled":false,
    "status":"active",
    "job_title":"",
    "phone":"",
    "address":"",
    "avatar_url":""
}
Suggest Edits

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.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/users/user_id/email_aliases

Path Params

user_id
string
required

The ID of the user

Returns

If the user_id is valid a collection of email aliases will be returned.

curl https://api.box.com/2.0/users/USER_ID/email_aliases \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "total_count": 1,
    "entries": [
        {
            "type": "email_alias",
            "id": "1234",
            "is_confirmed": true,
            "email": "dglover2@box.com"
        },
        {
            "type": "email_alias",
            "id": "1235",
            "is_confirmed": true,
            "email": "dglover3@box.com"
        }
    ]
}
Suggest Edits

Create Email Alias

Adds a new email alias to the given user’s account.

 

OAuth2 Auth

 Authentication is required for this endpoint.
posthttps://api.box.com/2.0/users/user_id/email_aliases

Path Params

user_id
string
required

The ID of the user

Body Params

email
string
required

The email address to add to the account as an alias

Returns

Returns the newly created email_alias object. Errors will be thrown if the user_id is not valid or the particular user’s email alias cannot be modified.

curl https://api.box.com/2.0/users/USER_ID/email_aliases \
-H "Authorization: Bearer " \
-d '{"email": "dglover2@box.com"}'
-X POST
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
  "type":"email_alias",
  "id":"1234",
  "is_confirmed":true,
  "email": "dglover2@box.com"
}
Suggest Edits

Delete Email Alias

Removes an email alias from a user.

 

OAuth2 Auth

 Authentication is required for this endpoint.
deletehttps://api.box.com/2.0/users/user_id/email_aliases/email_alias_id

Path Params

user_id
string
required

The ID of the user

email_alias_id
string
required

The ID of the email alias

Returns

If the user has permission to remove this email alias, an empty 204 No Content response will be returned to confirm deletion.

curl https://api.box.com/2.0/users/USER_ID/email_aliases/EMAIL_ALIAS_ID \
-H "Authorization: Bearer " \
-X DELETE
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Try the API to see results
Suggest Edits

Group Object

 

Groups contain a set of users, and can be used in place of users in some operations, such as collaborations.

Supported Group Names:

Box only supports group names of 255 characters or less. Names that will not be supported are the name “none” or a null name.

type

string

group

id

string

The ID of the group object

name

string

The name of the group

created_at

date-time

When the group object was created

modified_at

date-time

When the group object was last modified

provenance

string

Keeps track of which external source this group is coming from (e.g. "Active Directory", "Google Groups", "Facebook Groups"). This should be a human-readable identifier up to 255 characters long. Setting this will also prevent Box users from editing this group directly through Box. This is desirable for one-way syncing of groups. Needs to be accessed via the fields parameter.

external_sync_identifier

string

An arbitrary identifier that can be used by external group sync tools to link this Box Group to an external group. Example values of this field could be an Active Directory Object ID or a Google Group ID. We recommend use of this field in order to avoid issues when group names are updated in either Box or external systems. Needs to be accessed via the fields parameter.

description

string

Human readable description of the group. This can be up to 255 characters long. Needs to be accessed via the fields parameter.

invitability_level

string

Specifies who can invite the group to collaborate on folders (Create Collaboration).

admins_only Master Admin, Co-admins, the group's Group Admin.

admins_and_members Admins listed above and group members.

all_managed_users All managed users in the enterprise.

member_viewability_level

string

Specifies who can view the members of the group (Get Memberships for Group).

admins_only Master Admin, Coadmins, group's Group Admin.

admins_and_members Admins and group members.

all_managed_users All managed users in the enterprise.

{
    "total_count": 1,
    "entries": [
        {
            "type": "group",
            "id": "1786931",
            "name": "friends"
        }
    ],
    "limit": 100,
    "offset": 0
}
Suggest Edits

Get Group

Get information about a group.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/groups/group_id

Path Params

group_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response

Returns

A group object that was requested.

curl https://api.box.com/2.0/groups/GROUP_ID \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "group",
    "id": "255224",
    "name": "Everyone",
    "created_at": "2014-09-15T13:15:35-07:00",
    "modified_at": "2014-09-15T13:15:35-07:00"
}
Suggest Edits

Create Group

Create a new group.

 

OAuth2 Auth

 Authentication is required for this endpoint.
posthttps://api.box.com/2.0/groups

Query Params

fields
string

Comma-separated list of fields to include in the response

Body Params

name
string
required

The name of the new group to be created

provenance
string

Typically used to track the external source where the group is coming from. Retrieved through the fields parameter.

external_sync_identifier
string

Typically used as a group identifier for groups coming from an external source. Retrieved through the fields parameter.

description
string

Description of the group. Retrieved through the fields parameter.

invitability_level
string

Specifies who can invite this group to folders. Retrieved through the fields parameter.

member_viewability_level
string

Specifies who can view the members of this group. Retrieved through the fields parameter.

Returns

A new group object will be returned upon success.

curl https://api.box.com/2.0/groups \
-H "Authorization: Bearer " \
-d '{"name": "Box Employees", "provenance": "Google", "external_sync_identifier": "Google-Box-Users", "description": "All box Users", "invitability_level": "admins_and_members", "member_viewability_level": "admins_only"}' \
-X POST
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "group",
    "id": "119720",
    "name": "Box Employees",
    "created_at": "2013-05-16T15:27:57-07:00",
    "modified_at": "2013-05-16T15:27:57-07:00",
}
Suggest Edits

Update Group

Update a group.

 

OAuth2 Auth

 Authentication is required for this endpoint.
puthttps://api.box.com/2.0/groups/group_id

Path Params

group_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response

Body Params

name
string

The name of the group

provenance
string

Typically used to track the external source where the group is coming from. Retrieved through the fields parameter.

external_sync_identifier
string

Typically used as a group identifier for groups coming from an external source. Retrieved through the fields parameter.

description
string

Description of the group. Retrieved through the fields parameter.

invitability_level
string

Specifies who can invite this group to folders. Retrieved through the fields parameter.

member_viewability_level
string

Specifies who can view the members of this group. Retrieved through the fields parameter.

Returns

The updated group object will be returned upon success.

curl https://api.box.com/2.0/groups/GROUP_ID \
-H "Authorization: Bearer " \
-d '{"name": "framily"}' \
-X PUT
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "group",
    "id": "119720",
    "name": "framily",
    "created_at": "2013-05-16T15:27:57-07:00",
    "modified_at": "2013-05-16T15:27:57-07:00"
}
Suggest Edits

Delete Group

Delete a group.

 

OAuth2 Auth

 Authentication is required for this endpoint.
deletehttps://api.box.com/2.0/groups/group_id

Path Params

group_id
string
required

Returns

An empty 204 response will be returned upon success.

curl https://api.box.com/2.0/groups/GROUP_ID \
-H "Authorization: Bearer " \
-X DELETE
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Try the API to see results
Suggest Edits

Get Enterprise Groups

Returns all of the groups for given enterprise. Must have permissions to see an enterprise's groups.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/groups

Query Params

name
string

Only return groups whose name contains a word starting with the given string (case insensitive)

fields
string

Comma-separated list of fields to include in the response

offset
int32

The offset of the item at which to begin the response. See offset-based paging for details.

limit
int32

The maximum number of items to return. The default is 100 and the maximum is 1,000.

Returns

Returns all of the groups in the enterprise using offset-based paging.

curl https://api.box.com/2.0/groups \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "total_count": 1,
    "entries": [
        {
            "type": "group",
            "id": "1786931",
            "name": "friends"
        }
    ],
    "limit": 100,
    "offset": 0
}
Suggest Edits

Membership Object

 

Membership is used to signify that a user is part of a group. Membership can be added, requested, updated and deleted. You can also get all members of a group, or all memberships for a given user.

type
string

Type for membership is 'group_membership'

id
string

Box’s unique string identifying this membership

user
object

Mini representation of the user, including id and name of user.

group
object

Mini representation of the group, including id and name of group.

role

string

The role of the user in the group. Default is “member” with option for “admin”

created_at

date-time

The time this membership was created.

modified_at

date-time

The time this membership was last modified.

{
    "type": "group_membership",
    "id": "1560354",
    "user": {
        "type": "user",
        "id": "13130406",
        "name": "Alison Wonderland",
        "login": "alice@gmail.com"
    },
    "group": {
        "type": "group",
        "id": "119720",
        "name": "family"
    },
    "role": "member",
    "created_at": "2013-05-16T15:27:57-07:00",
    "modified_at": "2013-05-16T15:27:57-07:00"
}
Suggest Edits

Get Membership

Fetches a specific group membership entry.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/group_memberships/group_membership_id

Path Params

group_membership_id
string
required

Returns

The specified group_membership object will be returned upon success.

curl https://api.box.com/2.0/group_memberships/GROUP_MEMBERSHIP_ID \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "group_membership",
    "id": "1560354",
    "user": {
        "type": "user",
        "id": "13130406",
        "name": "Alison Wonderland",
        "login": "alice@gmail.com"
    },
    "group": {
        "type": "group",
        "id": "119720",
        "name": "family"
    },
    "role": "member",
    "created_at": "2013-05-16T15:27:57-07:00",
    "modified_at": "2013-05-16T15:27:57-07:00"
}
Suggest Edits

Create Membership

Add a member to a group.

 

OAuth2 Auth

 Authentication is required for this endpoint.
posthttps://api.box.com/2.0/group_memberships

Body Params

user
object
 
user.id
string
required

The ID of the user to add to the group

group
object
 
group.id
string

The ID of the group to add the user into.

role
string

The role of the user in the group. Default is “member” option for “admin”

Returns

A new group membership object will be returned upon success.

curl https://api.box.com/2.0/group_memberships \
-H "Authorization: Bearer " \
-d '{ "user": { "id": "1992432"}, "group": { "id": "1992432" } }' \
-X POST
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
            "type": "group_membership",
            "id": "1560354",
            "user": {
                "type": "user",
                "id": "13130406",
                "name": "Alison Wonderland",
                "login": "alice@gmail.com"
            },
            "group": {
                "type": "group",
                "id": "119720",
                "name": "family"
            },
            "role": "member"
        }
Suggest Edits

Update Membership

Update a group membership.

 

OAuth2 Auth

 Authentication is required for this endpoint.
puthttps://api.box.com/2.0/group_memberships/group_membership_id

Path Params

group_membership_id
string
required

Body Params

role
string

The role for the user in the group

Returns

A new group membership object will be returned upon success.

curl https://api.box.com/2.0/group_memberships/GROUP_MEMBERSHIP_ID \
-H "Authorization: Bearer " \
-d '{ "role": "submaster" }' \
-X PUT
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "group_membership",
    "id": "1560354",
    "user": {
        "type": "user",
        "id": "13130406",
        "name": "Alison Wonderland",
        "login": "alice@gmail.com"
    },
    "group": {
        "type": "group",
        "id": "119720",
        "name": "family"
    },
    "role": "submaster",
    "created_at": "2013-05-16T15:27:57-07:00",
    "modified_at": "2013-05-16T15:27:57-07:00"
}
Suggest Edits

Delete Membership

Delete a group membership.

 

OAuth2 Auth

 Authentication is required for this endpoint.
deletehttps://api.box.com/2.0/group_memberships/group_membership_id

Path Params

group_membership_id
string
required

Returns

An empty 204 No Content response will be returned upon success.

curl https://api.box.com/2.0/group_memberships/GROUP_MEMBERSHIP_ID \
-H "Authorization: Bearer " \
-X DELETE
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Try the API to see results
Suggest Edits

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).

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/groups/group_id/memberships

Path Params

group_id
string
required

Query Params

offset
int32

The offset of the item at which to begin the response. See offset-based paging for details.

limit
int32

The maximum number of items to return. The default is 100 and the maximum is 1,000.

Returns

Returns all of the group's memberships using offset-based paging.

curl https://api.box.com/2.0/groups/GROUP_ID/memberships \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "total_count": 2,
    "entries": [
        {
            "type": "group_membership",
            "id": "1560354",
            "user": {
                "type": "user",
                "id": "13130906",
                "name": "Alice",
                "login": "alice@gmail.com"
            },
            "group": {
                "type": "group",
                "id": "119720",
                "name": "family"
            },
            "role": "member"
        },
        {
            "type": "group_membership",
            "id": "1560356",
            "user": {
                "type": "user",
                "id": "192633962",
                "name": "rabbit",
                "login": "rabbit@gmail.com"
            },
            "group": {
                "type": "group",
                "id": "119720",
                "name": "family"
            },
            "role": "member"
        }
    ],
    "offset": 0,
    "limit": 100
}
Suggest Edits

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.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/users/user_id/memberships

Path Params

user_id
string
required

Query Params

offset
int32

The offset of the item at which to begin the response. See offset-based paging for details.

limit
int32

The maximum number of items to return. The default is 100 and the maximum is 1,000.

Returns

Returns all of the user's memberships using offset-based paging.

curl https://api.box.com/2.0/users/USER_ID/memberships \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "total_count": 1,
    "entries": [
        {
            "type": "group_membership",
            "id": "1560354",
            "user": {
                "type": "user",
                "id": "13130406",
                "name": "Alison Wonderland",
                "login": "alice@gmail.com"
            },
            "group": {
                "type": "group",
                "id": "119720",
                "name": "family"
            },
            "role": "member"
        }
    ],
    "limit": 100,
    "offset": 0
}
Suggest Edits

Get Collaborations for Group

Returns all of the group collaborations for a given group. Note this is only available to group admins.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/groups/group_id/collaborations

Path Params

group_id
string
required

Query Params

offset
int32

The offset of the item at which to begin the response. See offset-based paging for details.

limit
int32

The maximum number of items to return. The default is 100 and the maximum is 1,000.

Returns

Returns all of the group's collaborations using offset-based paging.

Each collaboration object has details on which files or folders the group has access to and with what role.

curl https://api.box.com/2.0/groups/ID/collaborations \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "total_count": 1,
    "entries": [
        {
            "type": "collaboration",
            "id": "52123184",
            "created_by": {
                "type": "user",
                "id": "13130406",
                "name": "Eddard Stark",
                "login": "ned@winterfell.com"
            },
            "created_at": "2013-11-14T16:16:20-08:00",
            "modified_at": "2013-11-14T16:16:20-08:00",
            "expires_at": null,
            "status": "accepted",
            "accessible_by": {
                "type": "group",
                "id": "160018",
                "name": "Hand of the King inner counsel"
            },
            "role": "viewer",
            "acknowledged_at": "2013-11-14T16:16:20-08:00",
            "item": {
                "type": "folder",
                "id": "541014843",
                "sequence_id": "0",
                "etag": "0",
                "name": "People killed by Ice"
            }
        }
    ],
    "offset": 0,
    "limit": 100
}
Suggest Edits

Collaboration Object

 

Collaborations define access permissions for users and groups to files and folders, similar to access control lists. A collaboration object grants a user or group access to a file or folder with permissions defined by a specific role.

The collaboration roles are editor, viewer, previewer, uploader, previewer uploader, viewer uploader, co-owner, or owner. For a full description of each role, please refer to our support documentation.

type

string

collaboration

id

string

The ID of the collaboration object

item

file or folder object

The file or folder that access is granted to

accessible_by

user or group object

The user or group that is granted access

role

string

The level of access granted. Can be editor, viewer, previewer, uploader, previewer uploader, viewer uploader, co-owner, or owner.

expires_at

date-time

When the collaboration will expire

can_view_path

boolean

Whether the "view path collaboration" feature is enabled or not. View path collaborations allow the invitee to see the entire parent path to the item. View path collaboration does not grant privileges in any parent folder (e.g. cannot see content the user is not collaborated on), other than the permission to view the parent path.

status

string

The status of the collaboration invitation. Can be accepted, pending, or rejected.

acknowledged_at

date-time

When the status of the collaboration object changed to accepted or rejected

created_by

mini user object

The user who created the collaboration object

created_at

date-time

When the collaboration object was created

modified_at

date-time

When the collaboration object was last modified

Collaboration Limitations

The number of collaborators on a file will be capped to 100 collaborators.

{
    "type": "collaboration",
    "id": "791293",
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "created_at": "2012-12-12T10:54:37-08:00",
    "modified_at": "2012-12-12T11:30:43-08:00",
    "expires_at": null,
    "status": "accepted",
    "accessible_by": {
        "type": "user",
        "id": "18203124",
        "name": "sean",
        "login": "sean+test@box.com"
    },
    "role": "editor",
    "acknowledged_at": "2012-12-12T11:30:43-08:00",
    "item": {
        "type": "folder",
        "id": "11446500",
        "sequence_id": "0",
        "etag": "0",
        "name": "Shared Pictures"
    }
}
Suggest Edits

Get Collaboration

Get information about a collaboration.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/collaborations/collab_id

Path Params

collab_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response

All collaborations for a single file or folder can be retrieved through GET /files/{id}/collaborations or GET /folders/{id}/collaborations. A complete list of the user’s pending collaborations can also be retrieved.

Returns

The collaboration object is returned.

curl https://api.box.com/2.0/collaborations/COLLAB_ID \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "collaboration",
    "id": "791293",
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "created_at": "2012-12-12T10:54:37-08:00",
    "modified_at": "2012-12-12T11:30:43-08:00",
    "expires_at": null,
    "status": "accepted",
    "accessible_by": {
        "type": "user",
        "id": "18203124",
        "name": "sean",
        "login": "sean+test@box.com"
    },
    "role": "editor",
    "acknowledged_at": "2012-12-12T11:30:43-08:00",
    "item": {
        "type": "folder",
        "id": "11446500",
        "sequence_id": "0",
        "etag": "0",
        "name": "Shared Pictures"
    }
}
Suggest Edits

Create Collaboration

Create a new collaboration that grants a user or group access to a file or folder in a specific role.

 

OAuth2 Auth

 Authentication is required for this endpoint.
posthttps://api.box.com/2.0/collaborations

Query Params

fields
string

Comma-separated list of fields to include in the response

notify
boolean

Determines if the user (or all the users in the group) will receive email notifications

Body Params

item
object
 
item.type
string
required

file or folder

item.id
string
required

The ID of the file or folder that access is granted to

accessible_by
object
 
accessible_by.type
string

user or group

accessible_by.id
string

The ID of the user or group that is granted access

accessible_by.login
string

The email address of the person to grant access to. Use instead of id to invite new users.

role
string
required

The level of access granted. Can be editor, viewer, previewer, uploader, previewer uploader, viewer uploader, co-owner, or owner.

can_view_path
boolean

Whether view path collaboration feature is enabled or not. View path collaborations allow the invitee to see the entire ancestral path to the associated folder. The user will not gain privileges in any ancestral folder (e.g. see content the user is not collaborated on).

The accessible_by field can specify the ID of an existing user or group, or the email address of a person to invite. Groups invitations are subject to the group's invitability_level.

Returns

The new collaboration object is returned.

Note

With the can_view_path parameter the user will only see the names of all the folder’s ancestor folders and be able to traverse up and down this path. Only the folder owner can use the can_view_path option.

curl https://api.box.com/2.0/collaborations \
-H "Authorization: Bearer " \
-d '{"item": { "id": "FOLDER_ID", "type": "folder"}, "accessible_by": { "id": "USER_ID", "type": "user" }, "role": "editor"}' \
-X POST
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "collaboration",
    "id": "791293",
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "created_at": "2012-12-12T10:54:37-08:00",
    "modified_at": "2012-12-12T11:30:43-08:00",
    "expires_at": null,
    "status": "accepted",
    "accessible_by": {
        "type": "user",
        "id": "18203124",
        "name": "sean",
        "login": "sean+test@box.com"
    },
    "role": "editor",
    "acknowledged_at": "2012-12-12T11:30:43-08:00",
    "item": {
        "type": "folder",
        "id": "11446500",
        "sequence_id": "0",
        "etag": "0",
        "name": "Shared Pictures"
    }
}
Suggest Edits

Update Collaboration

Update a collaboration.

 

OAuth2 Auth

 Authentication is required for this endpoint.
puthttps://api.box.com/2.0/collaborations/collab_id

Path Params

collab_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response

Body Params

role
string
required

The level of access granted. Can be editor, viewer, previewer, uploader, previewer uploader, viewer uploader, co-owner, or owner.

status
string

The status of the collaboration invitation. Can be accepted, pending, or rejected.

can_view_path
boolean

Whether view path collaboration feature is enabled or not. View path collaborations allow the invitee to see the entire ancestral path to the associated folder. The user will not gain privileges in any ancestral folder (e.g. see content the user is not collaborated on).

Status:

If the status field is pending, then the user specified in accessible_by can accept or reject the collaboration invite by setting the status field to ‘accepted’ or ‘rejected’.

Returns

The updated collaboration object is returned. If the role field is changed from co-owner to owner, then the collaboration object is deleted and a new one is created with the previous owner granted access as a co-owner. A 204 response is returned in this case.

Note:

With the can_view_path parameter the user will only see the names of all the folder’s ancestor folders and be able to traverse up and down this path. Only the folder owner will be able to create a view path collaboration.

curl https://api.box.com/2.0/collaborations/COLLAB_ID \
-H "Authorization: Bearer " \
-d '{"role": "viewer"} ' \
-X PUT
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "collaboration",
    "id": "791293",
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "created_at": "2012-12-12T10:54:37-08:00",
    "modified_at": "2012-12-12T11:30:43-08:00",
    "expires_at": null,
    "status": "accepted",
    "accessible_by": {
        "type": "user",
        "id": "18203124",
        "name": "sean",
        "login": "sean+test@box.com"
    },
    "role": "viewer",
    "acknowledged_at": "2012-12-12T11:30:43-08:00",
    "item": {
        "type": "folder",
        "id": "11446500",
        "sequence_id": "0",
        "etag": "0",
        "name": "Shared Pictures"
    }
}
Suggest Edits

Delete Collaboration

Delete a collaboration.

 

OAuth2 Auth

 Authentication is required for this endpoint.
deletehttps://api.box.com/2.0/collaborations/collab_id

Path Params

collab_id
string
required

Returns

A blank 204 response is returned if the ID is valid, and the user has permissions to remove the collaboration.

curl https://api.box.com/2.0/collaborations/COLLAB_ID \
-H "Authorization: Bearer " \
-X DELETE
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Try the API to see results
Suggest Edits

Pending Collaborations

Get all pending collaboration invites for a user.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/collaborations

Query Params

status
string
required
fields
string

Comma-separated list of fields to include in the response

offset
int32

The offset of the item at which to begin the response. See offset-based paging for details.

limit
int32

The maximum number of items to return. The default is 100 and the maximum is 1,000.

Returns

Returns all of the user's pending collaborations using offset-based paging.

Pending Collaboration Item:

As the user does not yet have access to the item they’re being invited to, the returned item will be null.

curl https://api.box.com/2.0/collaborations?status=pending \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "total_count": 1,
    "entries": [
        {
            "type": "collaboration",
            "id": "27513888",
            "created_by": {
                "type": "user",
                "id": "11993747",
                "name": "sean",
                "login": "sean@box.com"
            },
            "created_at": "2012-10-17T23:14:42-07:00",
            "modified_at": "2012-10-17T23:14:42-07:00",
            "expires_at": null,
            "status": "Pending",
            "accessible_by": {
                "type": "user",
                "id": "181216415",
                "name": "sean rose",
                "login": "sean+awesome@box.com"
            },
            "role": "Editor",
            "acknowledged_at": null,
            "item": null
        }
    ]
}
Suggest Edits

Comment Object

 

Comments are messages generated by Box users. Each message is tied to a specific file. You can create comments independently or create them as responses to other comments.

type

string

comment

id

string

The ID of the comment object

is_reply_comment

boolean

Whether or not this comment is a reply to another comment

message

string

The comment text that the user typed

tagged_message

string

The string representing the comment text with @mentions included. @mention format is @[id:username] where id is user_id and username is display name. Field is not included by default.

created_by

mini user object

A mini user object representing the author of the comment

created_at

date-time

The time this comment was created

item

object

The object this comment was placed on

modified_at

date-time

The time this comment was last modified

{
    "type": "comment",
    "id": "191969",
    "is_reply_comment": false,
    "message": "These tigers are cool!",
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "created_at": "2012-12-12T11:25:01-08:00",
    "item": {
        "id": "5000948880",
        "type": "file"
    },
    "modified_at": "2012-12-12T11:25:01-08:00"
}
Suggest Edits

Get Comment

Get information about a comment.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/comments/comment_id

Path Params

comment_id
string
required

Returns

A full comment object is returned is the ID is valid and if the user has access to the comment.

curl https://api.box.com/2.0/comments/COMMENT_ID
-H "Authorization: Bearer ACCESS_TOKEN"
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "comment",
    "id": "191969",
    "is_reply_comment": false,
    "message": "These tigers are cool!",
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "created_at": "2012-12-12T11:25:01-08:00",
    "item": {
        "id": "5000948880",
        "type": "file"
    },
    "modified_at": "2012-12-12T11:25:01-08:00"
}
Suggest Edits

Create Comment

Create a new comment.

 

OAuth2 Auth

 Authentication is required for this endpoint.
posthttps://api.box.com/2.0/comments

Body Params

item
object
 
item.type
string
required

The type of the item that this comment will be placed on. Can be file or comment.

item.id
string
required

The ID of the item that this comment will be placed on

message
string

The text of the comment

tagged_message
string

The text of the comment, including @[userid:Username] somewhere in the message to mention the user, which will send them a direct email, letting them know they’ve been mentioned in a comment

Comments can be made on a file or another comment (i.e. a reply comment).

Returns

The new comment object is returned. Errors may occur if the item ID is invalid, the item type is invalid/unsupported, you don’t include either a message or a tagged_message, or if the user does not have access to the item being commented on.

curl https://api.box.com/2.0/comments \
-H "Authorization: Bearer ACCESS_TOKEN" \
-d '{"item": {"type": "file", "id": "FILE_ID"}, "message": "YOUR_MESSAGE"}' \
-X POST
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "comment",
    "id": "191969",
    "is_reply_comment": false,
    "message": "These tigers are cool!",
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "created_at": "2012-12-12T11:25:01-08:00",
    "item": {
        "id": "5000948880",
        "type": "file"
    },
    "modified_at": "2012-12-12T11:25:01-08:00"
}
Suggest Edits

Update Comment

Update a comment.

 

OAuth2 Auth

 Authentication is required for this endpoint.
puthttps://api.box.com/2.0/comments/comment_id

Path Params

comment_id
string
required

The ID of the comment

Body Params

message
string
required

The text of the comment

Returns

The full updated comment object is returned if the ID is valid and if the user has access to the comment.

curl https://api.box.com/2.0/comments/COMMENT_ID \
-H "Authorization: Bearer ACCESS_TOKEN" \
-d '{"message":"My New Message"}' \
-X PUT
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "comment",
    "id": "191969",
    "is_reply_comment": false,
    "message": "These tigers are cool!",
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "created_at": "2012-12-12T11:25:01-08:00",
    "item": {
        "id": "5000948880",
        "type": "file"
    },
    "modified_at": "2012-12-12T11:25:01-08:00"
}
Suggest Edits

Delete Comment

Delete a comment.

 

OAuth2 Auth

 Authentication is required for this endpoint.
deletehttps://api.box.com/2.0/comments/comment_id

Path Params

comment_id
string
required

The ID of the comment

Returns

An empty 204 response is returned to confirm deletion of the comment. Errors can be thrown if the ID is invalid or if the user is not authorized to delete this particular comment.

curl https://api.box.com/2.0/comments/COMMENT_ID \
-H "Authorization: Bearer ACCESS_TOKEN" \
-X DELETE
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Try the API to see results
Suggest Edits

Events Overview

 

Box provides an API endpoint at /events that presents a stream of two different types of events, called user events and admin events.

Admin events are those events that are retrieved when you request a stream_type of admin_logs. User events are all other events.

When something changes in a Box user's account, Box logs an event for the user. The event is a description of the object that changed and what caused it to change. The object can be any Box object that the user owns or collaborates on. Box records events in admin reports and uses them to send messages to the Box sync client about account activity.

When you request user events, Box delivers a low-latency, highly reliable list of all events related to the user's account. Because of its emphasis on returning complete results quickly, Box may return duplicate events, and events may delivered out of order.

When you request admin events, Box delivers the full history of an enterprise account, suitable for use with analytic tools like Splunk and GoodData, limited by the parameters that you provide. The events returned are the same events that appear in Box administrative logs. Unlike requests for user events, requests for admin events support filters by event type. Because the emphasis is on completeness and not on low latency, Box may deliver admin events with much higher latencies.

See the "Enterprise Events" section below for a description of all supported parameters.

To retrieve events, send a request to the /events endpoint with no stream_position parameter. The absence of the stream_position signals to Box that it should return a list of all events. To limit the number of results, pass a count in the chunk_size parameter; Box returns all events or chunk_size events, whichever is less.

If Box returns fewer than all available events, then the results object contains a stream_position field that identifies the next event that has not yet been returned. To retrieve the next available events, make another request to the /events endpoint, passing the stream_position value that you receive from Box.

If you requested user events then the result list may contain duplicates. Compare the event_id fields of event objects to identify and remove duplicates.

Important

Events occasionally arrive out of order. As an example, a ITEM_PREVIEW event might show up before the corresponding ITEM_UPLOAD event. You may need to buffer events and reorder them chronologically.

You can begin retrieving events in either of two ways:

  • send a request to the /events endpoint with stream_position=now
  • send a request to the /events endpoint with no stream_position parameter

If you send stream_position=now then Box returns an empty list and the parameter stream_position with the latest stream position as its value. Using stream_position=now works only when the stream_type is not admin_logs.

If you send no stream_position parameter then Box send all available events, beginning with the oldest stream position.

Important

Box does not store all user and enterprise events for all time. Please see the retention policy for user and enterprise events below.

User Events Retention Policy - We store user events for between 2 weeks and 2 months, after which they are removed.

Enterprise Events Retention Policy - Enterprise events are accessible for up to 7 years via the reports section in the Box Admin Console. Enterprise events are accessible for up to 1 year via the Enterprise Events endpoint.

The result object that Box returns contains a stream_position field whose value is the stream position of the next unreturned event. Make another request, passing this value as the value for stream_position, to retrieve the next batch of events. Repeat until you have retrieved all the events you need.

Important

Box responds to the created_before and created_after parameters only if the stream_position parameter is not included.

Box keeps track of a certain set of events, and defined as follows:

Important

This list is subject to change as new events will be added to user events and admin events over time.

Suggest Edits

User Events

 

User Events

ITEM_CREATE

A folder or File was created
sync changes

ITEM_UPLOAD

A folder or File was uploaded
sync changes

COMMENT_CREATE

A comment was created on a folder, file, or other comment

COMMENT_DELETE

A comment was deleted on folder, file, or other comment

ITEM_DOWNLOAD

A file or folder was downloaded

ITEM_PREVIEW

A file was previewed

CONTENT_ACCESS

A representation of a file was accessed. This may include preview or offline access.

ITEM_MOVE

A file or folder was moved
sync changes

ITEM_COPY

A file or folder was copied
sync changes

TASK_ASSIGNMENT_CREATE

A task was assigned

TASK_CREATE

A task was created

LOCK_CREATE

A file was locked
sync changes

LOCK_DESTROY

A file was unlocked. If a locked file is deleted, the source file will be null.
sync changes

ITEM_TRASH

A file or folder was marked as deleted
sync changes

ITEM_UNDELETE_VIA_TRASH

A file or folder was recovered out of the trash
sync changes

COLLAB_ADD_COLLABORATOR

A collaborator was added to a folder
sync changes

COLLAB_ROLE_CHANGE

A collaborator had their role changed
sync changes

COLLAB_INVITE_COLLABORATOR

A collaborator was invited on a folder
sync changes

COLLAB_REMOVE_COLLABORATOR

A collaborator was removed from a folder
sync changes

ITEM_SYNC

A folder was marked for sync
sync changes

ITEM_UNSYNC

A folder was un-marked for sync
sync changes

ITEM_RENAME

A file or folder was renamed
sync changes

ITEM_SHARED_CREATE

A file or folder was enabled for sharing

ITEM_SHARED_UNSHARE

A file or folder was disabled for sharing

ITEM_SHARED

A folder was shared

ITEM_MAKE_CURRENT_VERSION

A previous version of a file was promoted to the current version
sync changes

TAG_ITEM_CREATE

A Tag was added to a file or folder

ENABLE_TWO_FACTOR_AUTH

2 factor authentication enabled by user.

MASTER_INVITE_ACCEPT

Free user accepts invitation to become a managed user.

MASTER_INVITE_REJECT

Free user rejects invitation to become a managed user.

ACCESS_GRANTED

Granted Box access to account.

ACCESS_REVOKED

Revoke Box access to account.

GROUP_ADD_USER

Added user to group
sync changes

GROUP_REMOVE_USER

Removed user from group
sync changes

Suggest Edits

Enterprise Events

 

Enterprise Events

The following events are defined only for the admin_logs stream_type:

GROUP_ADD_USER

Added user to group

NEW_USER

Created user

GROUP_CREATION

Created new group

GROUP_DELETION

Deleted group

DELETE_USER

Deleted user

GROUP_EDITED

Edited group

EDIT_USER

Edited user

GROUP_ADD_FOLDER

Granted folder access

GROUP_ADD_FILE

Granted file access

GROUP_REMOVE_USER

Removed user from group

GROUP_REMOVE_FOLDER

Removed folder access

GROUP_REMOVE_FILE

Removed file access

ADMIN_LOGIN

Admin login

ADD_DEVICE_ASSOCIATION

Added device association

FAILED_LOGIN

Failed login

LOGIN

Login

REMOVE_DEVICE_ASSOCIATION

Removed device association

TERMS_OF_SERVICE_AGREE

Agreed to terms

TERMS_OF_SERVICE_REJECT

Rejected terms

FILE_MARKED_MALICIOUS

Virus found on a file. Event is only received by enterprises that have opted in to be notified.

COPY

Copied

DELETE

Deleted

DOWNLOAD

Downloaded

EDIT

Edited

LOCK

Locked

MOVE

Moved

PREVIEW

Previewed

CONTENT_ACCESS

A representation of a file was accessed. This may include prefetching, preview, or offline access

RENAME

Renamed

STORAGE_EXPIRATION

Set file auto-delete

UNDELETE

Undeleted

UNLOCK

Unlocked

UPLOAD

Uploaded

SHARE

Enabled shared links

ITEM_SHARED_UPDATE

Share links settings updated

UPDATE_SHARE_EXPIRATION

Extend shared link expiration

SHARE_EXPIRATION

Set shared link expiration

UNSHARE

Unshared links

COLLABORATION_ACCEPT

Accepted invites

COLLABORATION_ROLE_CHANGE

Changed user roles

UPDATE_COLLABORATION_EXPIRATION

Extend collaborator expiration

COLLABORATION_REMOVE

Removed collaborators

COLLABORATION_INVITE

Invited

COLLABORATION_EXPIRATION

Set collaborator expiration

ITEM_SYNC

Synced folder

ITEM_UNSYNC

Un-synced folder

ADD_LOGIN_ACTIVITY_DEVICE

A user is logging in from a device we haven’t seen before

REMOVE_LOGIN_ACTIVITY_DEVICE

We invalidated a user session associated with an app

CHANGE_ADMIN_ROLE

When an admin role changes for a user

CONTENT_WORKFLOW_UPLOAD_POLICY_VIOLATION

A collaborator violated an admin-set upload policy

METADATA_INSTANCE_CREATE

Creation of metadata instance.

METADATA_INSTANCE_UPDATE

Update of metadata instance.

METADATA_INSTANCE_DELETE

Deletion of metadata instance.

TASK_ASSIGNMENT_UPDATE

Update of a task assignment.

Suggest Edits

Event Object

 

When you use the /events endpoint to retrieve Box events, Box sends you a JSON object that contains an array of event objects. This section describes these results.

Collection Attributes

The result object that contains the array of events also contains the following fields:

chunk_size

integer

The number of event records contained in the object.

next_stream_position

string

The next position in the Box event stream. Use this position in your next request to get the next set of events.

Event Attributes

Events returned in an event object have the following fields:

type

string

event

event_id

string

The ID of the event object. You can use the ID to detect duplicate events.

created_by

user

The user that performed the action represented by the event. Some events may be performed by users not logged into Box. In that case, not all attributes of the object are populated and the event is attributed to a unknown user (user_id = 2).

event_type

event

One of the event types described in the previous section.

session_id

string

The session ID of the user who performed the action represented by the event. Not all events populate this field.

source

type (varies)

The object modified by the event. See object definitions for appropriate types of object, including file, folder, comment. Not all events populate this field.

additional_details

type (varies)

Additional information about the event. This information can include how a user performed the event or information used to correlate events to external Keysafe logs. Not all events populate this field. This field appears only in Enterprise Events.

{
    "type": "event",
    "event_id": "f82c3ba03e41f7e8a7608363cc6c0390183c3f83",
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "created_at": "2012-12-12T10:53:43-08:00",
    "recorded_at": "2012-12-12T10:53:48-08:00",
    "event_type": "ITEM_CREATE",
    "session_id": "70090280850c8d2a1933c1",
    "source": {
        "type": "folder",
        "id": "11446498",
        "sequence_id": "0",
        "etag": "0",
        "name": "Pictures",
        "created_at": "2012-12-12T10:53:43-08:00",
        "modified_at": "2012-12-12T10:53:43-08:00",
        "description": null,
        "size": 0,
        "created_by": {
            "type": "user",
            "id": "17738362",
            "name": "sean rose",
            "login": "sean@box.com"
        },
        "modified_by": {
            "type": "user",
            "id": "17738362",
            "name": "sean rose",
            "login": "sean@box.com"
        },
        "owned_by": {
            "type": "user",
            "id": "17738362",
            "name": "sean rose",
            "login": "sean@box.com"
        },
        "shared_link": null,
        "parent": {
            "type": "folder",
            "id": "0",
            "sequence_id": null,
            "etag": null,
            "name": "All Files"
        },
        "item_status": "active",
        "synced": false
    }
}
Suggest Edits

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.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/events

Query Params

stream_type
string

Restricts the types of events returned: all returns all events; changes returns events that may cause file tree changes such as file updates or collaborations; sync returns events that may cause file tree changes only for synced folders

stream_position
string

The location in the event stream from which you want to start receiving events. You can specify the special value now to get 0 events and the latest stream_position value. Specifying 0 will return all available events.

limit
int32

The maximum number of items to return. The default is 100 and the maximum is 500.

Get All User Events

Either setting stream_position to 0 or not setting a value for stream_position will return all user events.

Returns

A collection of events is returned. See the above table for descriptions of the event types.

curl https://api.box.com/2.0/events \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "chunk_size": 1,
    "next_stream_position": 1348790499819,
    "entries": [
        {
    "type": "event",
    "event_id": "f82c3ba03e41f7e8a7608363cc6c0390183c3f83",
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "created_at": "2012-12-12T10:53:43-08:00",
    "recorded_at": "2012-12-12T10:53:48-08:00",
    "event_type": "ITEM_CREATE",
    "session_id": "70090280850c8d2a1933c1",
    "source": {
        "type": "folder",
        "id": "11446498",
        "sequence_id": "0",
        "etag": "0",
        "name": "Pictures",
        "created_at": "2012-12-12T10:53:43-08:00",
        "modified_at": "2012-12-12T10:53:43-08:00",
        "description": null,
        "size": 0,
        "created_by": {
            "type": "user",
            "id": "17738362",
            "name": "sean rose",
            "login": "sean@box.com"
        },
        "modified_by": {
            "type": "user",
            "id": "17738362",
            "name": "sean rose",
            "login": "sean@box.com"
        },
        "owned_by": {
            "type": "user",
            "id": "17738362",
            "name": "sean rose",
            "login": "sean@box.com"
        },
        "shared_link": null,
        "parent": {
            "type": "folder",
            "id": "0",
            "sequence_id": null,
            "etag": null,
            "name": "All Files"
        },
        "item_status": "active",
        "synced": false
    }
}
    ]
}
Suggest Edits

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.

 
gethttps://api.box.com/2.0/events

Query Params

stream_type
string
required

admin_logs

event_type
string

A comma-separated list of event types. Only matching events are returned.

created_after
date-time

A lower bound on the timestamp of the events returned. Please the see date format section of the docs for formatting tips.

created_before
date-time

An upper bound on the timestamp of the events returned. Please the see date format section of the docs for formatting tips.

stream_position
string

The location in the event stream from which you want to start receiving events. Box returns up to limit events.

limit
int32

The maximum number of items to return. The default is 100 and the maximum is 500.

Requires Admin:

This API call will only work with an auth token from an enterprise admin account.

curl https://api.box.com/2.0/events?stream_type=admin_logs&limit=3&stream_position=1152922976252162650 \
-H "Authorization: Bearer "
A binary file was returned
{
  "chunk_size": 2,
  "next_stream_position": "1152922976252290886",
  "entries": [
    {
      "source": {
        "type": "user",
        "id": "222853849",
        "name": "Nick Lee",
        "login": "nlee+demo4@box.com"
      },
      "created_by": {
        "type": "user",
        "id": "222853849",
        "name": "sean rose",
        "login": "sean+awesome@box.com"
      },
      "created_at": "2015-12-02T09:41:31-08:00",
      "event_id": "b9a2393a-20cf-4307-90f5-004110dec209",
      "event_type": "ADD_LOGIN_ACTIVITY_DEVICE",
      "ip_address": "Unknown IP",
      "type": "event",
      "session_id": null,
      "additional_details": null
    },
    {
      "source": {
        "type": "user",
        "id": "222853849",
        "name": "sean rose",
        "login": "sean+awesome@box.com"
      },
      "created_by": {
        "type": "user",
        "id": "222853849",
        "name": "Nick Lee",
        "login": "nlee+demo4@box.com"
      },
      "created_at": "2015-12-02T09:41:31-08:00",
      "event_id": "1a4ade15-b1ff-4cc3-89a8-955e1522557c",
      "event_type": "LOGIN",
      "ip_address": "Unknown IP",
      "type": "event",
      "session_id": null,
      "additional_details": null
    }
  ]
}
Suggest Edits

Long polling

To get real-time notification of activity in a Box account you can use the long poll feature of the /events API.

 

OAuth2 Auth

 Authentication is required for this endpoint.
optionshttps://api.box.com/2.0/events

To get real-time notification of activity in a Box account you can use the long poll feature of the /events API. Long polling means opening an HTTP request and keeping it open until the server sends a response, then repeating the process over and over to receive updated responses.

Long polling can only be used for the User Events API.

To use long polling, first send an OPTIONS request to the /events endpoint to retrieve the long poll URL. Next, make a GET request to the provided URL to begin listening for events. If an event occurs in an account you are monitoring you will receive a response with the value "new_change". The response contains no other details; it simply serves as a prompt to take further action such as sending a request to the /events endpoint with the last known stream_position. After the server sends this response it closes the connection. You must now repeat the long poll process to begin listening for events again.

If no events occur for a while after you send the GET request to the long-poll URL then you will receive a response with the value "reconnect". When you receive this response you’ll make another OPTIONS call to the /events endpoint and repeat the long poll process.

If you receive no events in retry_timeout seconds then you must make another GET request to the real-time server (that is, URL in the response). Sending another GET request might be necessary in case you do not receive the reconnect message because of network errors.

If you receive a "max_retries" error when making GET requests to the real-time server, you should make another OPTIONS request.

For a better understanding of the long-poll process, please review this short tutorial.

curl https://api.box.com/2.0/events \
-H "Authorization: Bearer " \
-X OPTIONS
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "chunk_size":1,
    "entries":[
        {
            "type":"realtime_server",
            "url":"http:\/\/2.realtime.services.box.net\/subscribe?channel=cc807c9c4869ffb1c81a&stream_type=all",
            "ttl":"10",
            "max_retries":"10",
            "retry_timeout":610
        }
    ]
}
Suggest Edits

Overview of Webhooks V2

 

Introduction

Webhooks enable you to attach event triggers to Box files and folders. Event triggers monitor events on Box objects and notify your application when they occur. A webhook notifies your application by sending HTTP requests to a URL of your choosing.

The Webhooks v2 API defines GET, POST, PUT, and DELETE methods you can use to create webhooks, define the events that trigger notifications, set the URLs they communicate with, and remove them when they are no longer needed. Because every aspect of webhooks can be controlled through the API your application can create webhooks on files and folders as they're needed and remove them when they aren't.

For a basic introduction to using Webhooks V2, see Getting Started with Webhooks V2

This reference describes the Webhooks V2 API, how to create and configure webhooks, and the options and data structures you'll use to work with them.

Suggest Edits

Event Triggers

 

Webhooks activate when events occur. When you create a webhook you define a list of event triggers that activate it. Each event trigger names a type of event that can affect the file or folder object that is the target of the webhook. When any of those events occur the webhook sends a notification to a URL that you specify.

The table below lists all the events that webhooks can respond to and describes the circumstances that signal each event.

An event can affect a file or a folder. Some events affect only files; some only folders. Events that support webhooks on Files have a "Yes" in the Files? column. Events that support webhooks on folders have a "Yes" in the Folders? column.

Note

When the permissions on a file prevent an action from occurring, no notification is sent for the attempted action.

Event name
Triggered when
File?
Folder?

FILE.UPLOADED

A file is uploaded

No

Yes

FILE.PREVIEWED

A file is previewed

Yes

Yes

FILE.DOWNLOADED

A file is downloaded

Yes

Yes

FILE.TRASHED

A file is moved to the trash

Yes

Yes

FILE.DELETED

A file is permanently deleted

Yes

Yes

FILE.RESTORED

A file is restored from the trash

Yes

Yes

FILE.COPIED

A file is copied

Yes

Yes

FILE.MOVED

A file is moved from one folder to another

Yes

Yes

FILE.LOCKED

A file is locked

Yes

Yes

FILE.UNLOCKED

A file is unlocked

Yes

Yes

COMMENT.CREATED

A comment object is created

Yes

Yes

COMMENT.UPDATED

A comment object is edited

Yes

Yes

COMMENT.DELETED

A comment object is removed

Yes

Yes

TASK_ASSIGNMENT.CREATED

A task is created

Yes

Yes

TASK_ASSIGNMENT.UPDATED

A task assignment is changed

Yes

Yes

METADATA_INSTANCE.CREATED

A new metadata template instance is associated with a file or folder

Yes

Yes

METADATA_INSTANCE.UPDATED

An attribute (value) is updated/deleted for an existing metadata template instance associated with a file or folder

Yes

Yes

METADATA_INSTANCE.DELETED

An existing metadata template instance associated with a file or folder is deleted

Yes

Yes

FOLDER.CREATED

A folder is created

No

Yes

FOLDER.DOWNLOADED

A folder is downloaded

No

Yes

FOLDER.RESTORED

A folder is restored from the trash

No

Yes

FOLDER.DELETED

A folder is permanently removed

No

Yes

FOLDER.COPIED

A copy of a folder is made

No

Yes

FOLDER.MOVED

A folder is moved to a different folder

No

Yes

FOLDER.TRASHED

A folder is moved to the trash

No

Yes

WEBHOOK.DELETED

When a webhook is deleted

No

No

COLLABORATION.CREATED

A collaboration is created

No

Yes

COLLABORATION.ACCEPTED

A collaboration has been accepted

No

Yes

COLLABORATION.REJECTED

A collaboration has been rejected

No

Yes

COLLABORATION.REMOVED

A collaboration has been removed

No

Yes

COLLABORATION.UPDATED

A collaboration has been updated.

No

Yes

SHARED_LINK.DELETED

A shared link was deleted

Yes

Yes

SHARED_LINK.CREATED

A shared link was created

Yes

Yes

SHARED_LINK.UPDATED

A shared link was updated

Yes

Yes

Suggest Edits

Webhook Notifications

 

A webhook sends a notification by making an HTTP request to a URL that you specify when creating the webhook. The following sections section the structure of the notifications that Box sends, how it sends them, and how your application can handle them.

Sending Notifications

When Box observes an event that a webhook is watching, it sends an HTTP request to the webhook's notification URL. The notification URL is a valid HTTPS URL that you specify when you create the webhook. The URL must use the standard HTTPS port (443). The notification URL should be the endpoint of a service provided by your application for capturing and handling webhook notifications. To signal that your service has accepted the notification, it should return an HTTP status in the range 200-299 within 30 seconds of receiving the notification.

Retries

Delivery has failed if Box does not receive an HTTP response in the range 200-299 within 30 seconds of sending the notification. If delivery of a notification fails, Box resends it. The initial retry will take place 5 minutes after the failure.

Box will retry webhook notification delivery up to 10 times. Box uses an exponential back-off strategy when retrying notifications in order to avoid overloading the destination server with traffic. Exponential backoff means that after each failure to deliver, Box waits longer than the last time.

Subject to Change - Number of Notification Delivery Retries

Box will retry webhook notification delivery up to 10 times. This number is subject to change. If you have feedback about the number of retries, please email us at webhooks-v2-feedback@box.com.

Suggest Edits

The Notification Payload

 

This section describes the structure of the notification payload.

Notification Headers

A notification request sent by a webhook has the following Box-specific headers:

Header
Description

BOX-DELIVERY-ID

A unique ID assigned by Box that identifies the delivered notification. If Box tries more than once to deliver the notification then the ID in the body of the notification is the same in each message, but the BOX-DELIVERY-ID is different.

BOX-DELIVERY-TIMESTAMP

An RFC-3339 timestamp that identifies the time that the notification was sent (see Date Format).

BOX-SIGNATURE-PRIMARY

A hash message authentication code (HMAC) created using the primary signature key configured for this webhook.

BOX-SIGNATURE-SECONDARY

A hash message authentication code (HMAC) created using the secondary signature key configured for this webhook.

BOX-SIGNATURE-VERSION

1

BOX-SIGNATURE-ALGORITHM

"HmacSHA256"

Notification Body

The body of a webhook notification message is a JSON object that describes the webhook's target and the event trigger that sent the notification. The structure of the body is as follows:

{"id": A_NOTIFICATION_ID,
 "type": "webhook_event",
 "webhook": A_WEBHOOK_OBJECT,
 "created_by": A_USER,
 "created_at": AN_RFC3339_TIMESTAMP,
 "trigger": AN_EVENT_NAME,
 "source": A_BOX_OBJECT
}

Example Payload

The following example shows the payload for a notification sent by a FILE.UPLOADED webhook. The details of the header and body values are only examples; they will be different in your notifications.

Headers

Box-Delivery-Id: 673a081b-bb4b-4d45-b4f1-4131a29c1d07
Box-Delivery-Timestamp: 2016-07-11T10:10:33-07:00
Box-Signature-Algorithm: HmacSHA256
Box-Signature-Primary: isCeDp7mLR41/MjcSEFLag9bWmpJkgmN80Je4VIESdo=
Box-Signature-Secondary: 1UbiiKS7/2o5vNIlyMh7e5QGCHq8lflWFgEF+YWBugI=
Box-Signature-Version: 1
Cache-Control: max-age=259200
Connection: close
Content-Length: 1590
Content-Type: application/json; charset=UTF-8
Host:
Surrogate-Capability: web-proxy2002.sv2.box.net="Surrogate/1.0 ESI/1.0"
User-Agent: Box-WH-Client/0.1

Body

{
  "type":"webhook_event",
   "id":"eb0c4e06-751f-442c-86f8-fd5bb404dbec",
   "created_at":"2016-07-11T10:10:32-07:00",
   "trigger":"FILE.UPLOADED",
   "webhook":{
      "id":"53",
      "type":"webhook"
   },
   "created_by":{
      "type":"user",
      "id":"226067247",
      "name":"John Q. Developer",
      "login":"johnq@dev.name"
   },
   "source":{
      "id":"73835521473",
      "type":"file",
      "file_version":{
         "type":"file_version",
         "id":"78096737033",
         "sha1":"2c61623e86bee78e6ab444af456bccc7a1164095"
      },
      "sequence_id":"0",
      "etag":"0",
      "sha1":"2c61623e86bee78e6ab444af456bccc7a1164095",
      "name":"Test-Image-3.png",
      "description":"",
      "size":26458,
      "path_collection":{
         "total_count":4,
         "entries":[
            {
               "type":"folder",
               "id":"0",
               "sequence_id":null,
               "etag":null,
               "name":"All Files"
            },
            {
               "type":"folder",
               "id":"2614853901",
               "sequence_id":"4",
               "etag":"4",
               "name":"Testing"
            },
            {
               "type":"folder",
               "id":"8290186265",
               "sequence_id":"0",
               "etag":"0",
               "name":"Webhooks Base"
            },
            {
               "type":"folder",
               "id":"8290188973",
               "sequence_id":"0",
               "etag":"0",
               "name":"Webhooks"
            }
         ]
      },
      "created_at":"2016-07-11T10:10:32-07:00",
      "modified_at":"2016-07-11T10:10:32-07:00",
      "trashed_at":null,
      "purged_at":null,
      "content_created_at":"2016-06-08T11:14:04-07:00",
      "content_modified_at":"2016-06-08T11:14:04-07:00",
      "created_by":{
         "type":"user",
         "id":"226067247",
         "name":"John Q. Developer",
         "login":"johnq@dev.name"
      },
      "modified_by":{
         "type":"user",
         "id":"226067247",
         "name":"John Q. Developer",
         "login":"johnq@dev.name"
      },
      "owned_by":{
         "type":"user",
         "id":"226067247",
         "name":"John Q. Developer",
         "login":"johnq@dev.name"
      },
      "shared_link":null,
      "parent":{
         "type":"folder",
         "id":"8290188973",
         "sequence_id":"0",
         "etag":"0",
         "name":"Webhooks"
      },
      "item_status":"active"
   },
   "additional_info":[

   ]
}

Payload without Authentication

If the application that authenticates a webhook has no active OAuth session—that is, if its login has expired—then the webhook sends a notification with a minimal payload. This minimal notification carries less data than a full notification, but serves to inform the notification URL that the webhook has been activated.

The headers and body structure of a minimal notification are the same as a full notification, but with less information. Below is an example of a minimal notification. The values of fields in your notifications will be different.

Headers

Box-Delivery-Id: 462fc1b2-7bc5-4e50-bda3-c094daf12f99
Box-Delivery-Timestamp: 2016-07-12T13:14:19-07:00
Box-Signature-Algorithm: HmacSHA256
Box-Signature-Primary: m2zzDEo888sLGDiQ+5a0fj3Fc3LF8awRsKLO/ZtGClk=
Box-Signature-Secondary: IBgiKXC+5vwpoEdZWtXvb+LqAQEeZ9UXoIu0ejR72uA=
Box-Signature-Version: 1
Cache-Control: max-age=259200
Connection: close
Content-Length: 316
Content-Type: application/json; charset=UTF-8
Host:
Surrogate-Capability: web-proxy2004.sv2.box.net="Surrogate/1.0 ESI/1.0"
User-Agent: Box-WH-Client/0.1

Body

{
  "type":"webhook_event",
   "id":"0f46a6ca-86bf-44ab-8cf5-f08e1e02876b",
   "created_at":"2016-07-12T13:14:19-07:00",
   "trigger":"NO_ACTIVE_SESSION",
   "webhook":{
      "id":"53",
      "type":"webhook"
   },
   "created_by":{
      "type":"user",
      "id":"2",
      "name":"Anonymous User",
      "login":""
   },
   "source":{
      "id":"73835521473",
      "type":"file"
   },
   "additional_info":[

   ]
}
Suggest Edits

Handling Notifications

 

To handle a webhooks notification your application must process HTTP POST requests sent to the notification URL defined for each active webhook. The requests that you receive will be structured according to the description in the previous section. You can examine the headers and the JSON body of the notification and compare it to your application's requirements in order to decide how to handle it.

To ensure that notifications are valid and that they haven't been tampered with en route, follow the advice in the "Signatures" section.

If your application examines a notification and considers it valid and acceptable, it should respond within 30 seconds with an HTTP status code in the range 200-299.

Suggest Edits

The Webhook Object

 

When you create or retrieve a webhook a JSON object representing the webhook is returned to you. This JSON object's fields contain the name and ID of the webhook, along with configuration details such as its target and its notification URL.

Fields of the Webhook Object

The following table describes all fields of the Webhook Object. The target object and the created_by object are included inline:

Field
Description

type

string

webhook

id

string

The ID of the webhook object

target.id

string

The unique ID string assigned by Box to the target of the webhook. The target is the file or folder that the webhook monitors.

target.type

string

file or folder

created_by.id

string

The unique ID string assigned by Box to the user who created the webhook.

created_by.type

string

user

created_by.name

string

The human-readable name of the user who created the webhook.

created_by.login

string

The login name of the user who created the webhook.

created_at

date-time

An RFC-3339 timestamp identifying the time that the webhook was created.

address

string

The notification URL of the webhook. The notification URL is the URL used by Box to send a notification when the webhook is triggered.

triggers

array of strings

An array of event names. The events that webhooks support are listed in the "Event Triggers" section.

Example Webhook Object

The example below shows what a webhook object looks like. The values shown for IDs, user data, and URLs are fictional values of the right type. Replace them with values that are correct for your application.

{"id": "123456789",
 "type": "webhook",
 "target": {"id": "987654321",
            "type": "file"},
 "created_by": {"id": "234567890",
                "type": "user",
                "name": "John Q. Developer",
                "login": "johnq"},
 "created_at": "2016-07-16T11:04:26-08:00",
 "address": "https://dev.name/box-notification",
 "triggers": ["FILE.SHARED","COMMENT.UPDATED"]}
Suggest Edits

Signatures

 

You can configure webhooks to use signatures to protect them against attacks. When you configure a webhook to use a signature, Box generates a cryptographic digest of the notification's body and attaches it in a header. When your application receives the notification it can compute the same digest and compare it to the one attached to the message. If the digests are not the same then you should not trust the notification; it may have been tampered with by a malicious party.

Using signatures you can ensure that a notification was really sent by Box and that it hasn't been tampered with in transit. Signatures greatly reduce the likelihood of a successful man-in-the-middle or replay attack.

Signatures provide stronger protection if you frequently change the keys used to generate them, but what happens if you change the key while interactions are happening? Your application might receive a valid notification with a signature that is no longer valid.

Webhooks V2 provides a procedure for updating keys that uses two keys and two signatures to avoid that problem.

Configuring an Application to Generate Signatures

In order to attach signatures to an application's notifications you must first generate signature keys for the application. A signature key is a string used by Box to compute the cryptographic digest of each notification. Each application has two signature keys in order to support signature rotation. See the next section, "Rotating Signatures," for a description of how they're used.

To configure your application's keys, begin by logging in to the developer console and Clicking the My Applications link. Edit the application you wish to configure.

In the Webhooks v2 section of the page, find the buttons labeled "Generate primary key" and "Generate secondary key." Click each button to generate the keys that will be used to compute digests of your application's notification messages.

You'll use the data generated by these buttons in your application code to verify received notifications.

Rotating Signatures

Update only one of your application's signature keys at a time. Box always sends two signatures. Your application can trust a notification as long as at least one of its signatures is valid.

If you update only one key at a time, then even if your application receives a notification with one invalid signature, it can still trust the notification as long as the other signature is valid.

These instructions assume that you have already created a primary and secondary key.

To change the primary key, simply generate a new primary key, but not a new secondary key, using the instructions in the previous section.

To change the secondary key, wait for some time to pass first—enough time to be confident that no notifications using the old primary key are still in flight. Then generate a new secondary key (but not a new primary key!).

Make sure that when you use the developer console to generate a new primary or secondary key, you also remember to change your application's notification handler to use the new key in its verification code.

Verifying Signatures

To protect your application against attacks, you must verify signatures included with notifications. Verification ensures that the notifications were actually sent by Box and not by some malicious party, and that the contents of the notification haven't been changed.

The sample Python code below shows how to verify a signature. The steps it illustrates are:

  1. Ensure that the timestamp given in the BOX-DELIVERY-TIMESTAMP header is no older than ten minutes.
  2. Extract the text of the UTF-8 payload as an array of bytes.
  3. Append the UTF-8 value of the BOX-DELIVERY-TIMESTAMP header, as an array of bytes, to the end of the payload array.
  4. Compute a SHA256 HMAC digests for the array of bytes collected in steps 2 and 3. Compute one digest using the application's primary key and one using the secondary key. Copy these keys from the configuration page of your application.
  5. Encode both digests using Base64 encoding.
  6. Compare the encoded digest that you computed using your application's primary key to the value of the BOX-SIGNATURE-PRIMARY header. Compare the one you computed using your application's Secondary Key to the value of the BOX-SIGNATURE-Secondary header. At least one of the computed digests must exactly match its corresponding header value; if not, then the notification may be compromised and should not be trusted.

The following sample code illustrates how to perform these steps in Python:

#!/usr/bin/env python3
import hashlib
import hmac
import base64
import dateutil.parser
import datetime
import pytz


def verifyDeliveryTimestamp(deliveryTimestamp, minutes=10):
    """
    Returns true if given deliveryTimestamp is not older than `minutes`

    Args:
        deliveryTimestamp (str):  Value of header Box-Delivery-Timestamp
        minutes (int): How old the delivery timestamp could be (in minutes)
    """
    parsedDeliveryTimestamp = dateutil.parser.parse(
        deliveryTimestamp).astimezone(pytz.utc)
    now = datetime.datetime.now(pytz.utc)
    deltaMinutes = datetime.timedelta(minutes=minutes)
    oldestTimestampAllowed = now - deltaMinutes

    return parsedDeliveryTimestamp >= oldestTimestampAllowed


def verifyWebhookSignature(signatureKey,
                           payload,
                           deliveryTimestamp,
                           primarySignature=None,
                           secondarySignature=None):
    """
    Returns true if locally calculated signature matches either primary or
    secondary signature present in webhook notification

    Args:
        signatureKey (str): Signature key stored within client application
        payload (str): Webhook notification payload/body
        deliveryTimestamp (str):  Value of header Box-Delivery-Timestamp
        primarySignature (str): Value of header Box-Signature-Primary
        secondarySignature (str): Value of header Box-Signature-Secondary
    """
    calculatedSignature = generateSignature(signatureKey, payload,
                                            deliveryTimestamp)
    return calculatedSignature == primarySignature or calculatedSignature == secondarySignature


def generateSignature(signatureKey, payload, deliveryTimestamp):
    """
    Return base64 encode hmac (sha256) for the given webhook notification
     payload and delivery timestamp using provided signature key

    Args:
        signatureKey (str): Signature key stored within client application
        payload (str): Webhook notification payload/body
        deliveryTimestamp (str): Value of header Box-Delivery-Timestamp
    """
    messageBytes = bytes(payload, 'utf-8') + bytes(deliveryTimestamp, 'utf-8')
    hmacSHA256 = hmac.new(signatureKey, messageBytes, hashlib.sha256).digest()
    return base64.b64encode(hmacSHA256)
Suggest Edits

Deleting a Webhook

 

You can use the Webhooks v2 API to delete a webhook by ID, but that's not the only way a webhook can be deleted. Deleting a Box application also deletes all webhooks that are associated with it. In addition, if you revoke all access tokens associated with a webhook then the webhook is deleted.

Finally, Box automatically deletes webhooks if they aren't able to deliver their notifications for a system-determined amount of time. When Box automatically removes a webhook, it sends a WEBHOOK.DELETED notification to your registered notification URL.

Following is an example of the information supplied in the payload of a WEBHOOK.DELETED notification:

"additional_info": {
  "reason": "auto_cleanup"
}
Suggest Edits

Using the API

 

Everything that can be done with Webhooks v2 can be done using its REST API, including creating and configuring them.

Using the API means sending GET, POST, PUT, and DELETE requests to Box to create, retrieve, update, and remove webhooks.

Structure of Webhooks v2 requests

Webhooks v2 GET and DELETE requests send parameters in path or the query string of the URL. POST and PUT requests send their parameters in the form of a JSON object in the body of the request, referred to as the parameters object.

Webhooks v2 endpoint

Webhooks v2 API requests should be sent to the endpoint

https://api.box.com/2.0/webhooks

POST and PUT bodies

POST and PUT requests transport parameters as the values of fields in a JSON object. This object is called the parameters object. A parameters object looks like this:

{"id": "AN_ID_STRING",
 "type": "A_TYPE_STRING",
 "target": {"id": "AN_ID_STRING",
            "type": "A_TYPE_STRING"},
 "created_by": {"id": "AN_ID_STRING",
                "type": "A_TYPE_STRING",
                "name": "A_STRING",
                "login": "A_STRING"},
 "created_at": "A_TIMESTAMP",
 "address": "A_URL_STRING",
 "triggers": "AN_ARRAY_OF_TRIGGER_NAMES"}

The values shown in this example are placeholders. The following sections describe the fields of the parameters object in more detail.

In the reference sections for API calls, Webhooks v2 parameters for POST and PUT calls are given as the names of fields in the parameters object. In those sections, when the text refers to a field of the target or created_by object, those fields are shown using JSON dot notation. For example, when describing the id field of the target object, the reference section will call it the target.id field.

The parameters object

The following table describes the types and values of the fields of the JSON object used to represent parameters in POST and PUT requests:

Parameter name
Parameter type
Description

id

string

The string identifier of the webhook, assigned by Box

type

string

The type of the webhook. This value must always be "webhook".

target

JSON object

A JSON object that identifies the Box object (file or folder) to which the webhook is attached. See the table Target Object, below.

created_by

JSON object

A JSON object that identifies the Box user who created the webhook. See the table Created-by Object, below.

created_at

string

An RFC-3339 timestamp that identifies when the webhook was created.

address

string

The URL to which Webhooks notifications are to be sent.

triggers

array of strings

An array of Event Trigger names. See the section Event Triggers.

Target Object

A target object is a JSON object that describe the target of a webhook. It is passed in Webhooks v2 requests in the target field of the parameters object.

Parameter name
Parameter type
Description

id

string

The string identifier of the target object (file or folder), assigned by Box

type

string

The name of the target object's type. This value must be be either "file" or "folder".

Created-by Object

A created-by object is a JSON object that describe the Box user who created a webhook. It is passed in Webhooks v2 requests in the created_by field of the parameters object.

Parameter name
Parameter type
Description

id

string

The string identifier of the Box user who created the webhook, assigned by Box

type

string

The type of the object that represents the user. This value must always be "user".

name

string

The user's name.

login

string

The user's login name.

Examples

Here's an example of an API request to retrieve a webhook that was previously defined. The call to get a webhook uses a GET request and passes its parameters in the URL path:

GET /api/2.0/webhooks/4137 HTTP/1.1

The following example requests all defined webhooks, with a limit of 3 per page. It passes its parameter in the URL query string:

GET /api/2.0/webhooks?limit=3 HTTP/1.1

The following example shows one of the API requests that passes parameters in the request body in the form of a JSON object. This is a request to create a webhook:

POST /api/2.0/webhooks HTTP/1.1
Host: me.example.net
Authorization: Bearer kn6F8iARsLkKlfftIC67WK6zxlC0vcJh
Cache-Control: no-cache

{
  "target": {
    "type": "file",
    "id": "5018848529"
  },
  "address": "https://me.example.net/actions/file_changed",
  "triggers": ["FILE.DOWNLOADED", "FILE.PREVIEWED"]
}

Responses

All Webhooks APIs return responses in the form of JSON objects, with the exception of the request to delete a webhook, which returns 204 No Content. See the reference section for each individual API request for a description of the response objects they return.

Suggest Edits

Limitations and Restrictions

 

One Webhook per Object

There's a limit of one webhook per object in a given application for a given user. An object is either a file or a folder. Once you have set a webhook on a target object, you cannot add a second one for that application and user, even if the second one would respond to a different event.

For example, let's suppose you create a FILE.UPLOADED webhook on the folder Junk for use with the application MyGreatApp for the user Fred. You cannot now add a FILE.DOWNLOADED webhook on the same folder, unless you add it for a different application or a different user.

What if you want to change the webhook? You can use the Update request to change the event and other parameters of the webhook (see the Update Webhook section of this reference).

No More Than 1000 Webhooks

There is a limit of 1000 webhooks on each combination of application and user. In other words, you can create up to 1000 webhooks on a particular application for user Alice, but not more. On the other hand, if there are already 1000 webhooks on the app for Alice, you can still create new webhooks on the same app for user Bob, up to another 1000.

Restrictions on the Notification URL

The notification URL for a webhook must be a valid HTTPs URL that resolves to a valid IP address. The IP address must be accessible from the Internet and it most not be a Box.com address. The port used in the URL must be the standard HTTPS port, 443; if you use a different port then your notifications will not be delivered.

No Webhooks on Root Folder

You will not be able to create a webhook on your a root folder.

Suggest Edits

Error Codes

 

Error Codes - Webhook POST Requests

These status codes are generated when an error happens during a request to create a webhook.

404: Target could not be found

{
  "type": "error",
  "status": 404,
  "code": "not_found",
  "context_info": {
    "errors": [
      {
        "reason": "invalid_parameter",
        "name": "folder",
        "message": "Invalid value '50557037881'. 'folder' with value '50557037881' not found"
      }
    ]
  },
  "help_url": "http://developers.box.com/docs/#errors",
  "message": "Not Found",
  "request_id": "12576614995893a4c6a0190"
}

403: Insufficient permissions

{
  "type": "error",
  "status": 403,
  "code": "access_denied_insufficient_permissions",
  "help_url": "http://developers.box.com/docs/#errors",
  "message": "Access denied - insufficient permission",
  "request_id": "3017045825893a6564995b"
}

400: Target not supported

{
  "type": "error",
  "status": 400,
  "code": "bad_request",
  "context_info": {
    "errors": [
      {
        "reason": "invalid_parameter",
        "name": "targetType",
        "message": "Invalid value 'user'. Value must be one of the allowable values for 'targetType'"
      }
    ]
  },
  "help_url": "http://developers.box.com/docs/#errors",
  "message": "Bad Request",
  "request_id": "18327826535893a67aae880"
}

400: Address invalid

{
  "type": "error",
  "status": 400,
  "code": "bad_request",
  "context_info": {
    "errors": [
      {
        "reason": "invalid_parameter",
        "name": "address",
        "message": "Invalid address specified."
      }
    ]
  },
  "help_url": "http://developers.box.com/docs/#errors",
  "message": "Bad Request",
  "request_id": "10565575345893a7d15ce62"
}

400: Event name invalid

{
  "type": "error",
  "status": 400,
  "code": "bad_request",
  "context_info": {
    "errors": [
      {
        "reason": "invalid_parameter",
        "name": "trigger",
        "message": "Invalid value 'FILE1.DOWNLOADED'."
      }
    ]
  },
  "help_url": "http://developers.box.com/docs/#errors",
  "message": "Bad Request",
  "request_id": "10653978935893a7ee0f40a"
}

400: Unsupported target type

{
  "type": "error",
  "status": 400,
  "code": "bad_request",
  "context_info": {
    "errors": [
      {
        "reason": "invalid_parameter",
        "name": "trigger",
        "message": "FILE.UPLOADED could not be applied to resource type : file"
      }
    ]
  },
  "help_url": "http://developers.box.com/docs/#errors",
  "message": "Bad Request",
  "request_id": "8645764015893a8336ed69"
}

400: Required field missing

{
  "type": "error",
  "status": 400,
  "code": "bad_request",
  "context_info": {
    "errors": [
      {
        "reason": "missing_parameter",
        "name": "address",
        "message": "'address' is required"
      }
    ]
  },
  "help_url": "http://developers.box.com/docs/#errors",
  "message": "Bad Request",
  "request_id": "7541061865893a84a5e819"
}

409: Webhook already exists

{
  "type": "error",
  "status": 409,
  "code": "conflict",
  "context_info": {
    "errors": [
      {
        "reason": "invalid_parameter",
        "name": "existWebhookId",
        "message": "Webhook:936998 already exists on the specified target."
      }
    ]
  },
  "help_url": "http://developers.box.com/docs/#errors",
  "message": "Bad Request",
  "request_id": "1459093015893a912bcaa3"
}

Error Codes - Webook GET Requests

These status codes are generated when an error happens during a request to get a webhook.

404: Webhooks ID not found

{
  "type": "error",
  "status": 404,
  "code": "not_found",
  "context_info": {
    "errors": [
      {
        "reason": "invalid_parameter",
        "name": "webhook",
        "message": "Invalid value '40'. 'webhook' with value '40' not found"
      }
    ]
  },
  "help_url": "http://developers.box.com/docs/#errors",
  "message": "Not Found",
  "request_id": "15905304615893a9426ae16"
}

403: Insufficient permissions

{
  "type": "error",
  "status": 403,
  "code": "access_denied_insufficient_permissions",
  "help_url": "http://developers.box.com/docs/#errors",
  "message": "Access denied - insufficient permission",
  "request_id": "3017045825893a6564995b"
}
Suggest Edits

Get Webhooks

Get all webhooks in an enterprise.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/webhooks

Query Params

marker
string

The position marker at which to begin the response. See marker-based paging for details.

limit
int32

The maximum number of items to return. The default is 100 and the maximum is 200.

Returns

Returns all of the webhooks in the enterprise using marker-based paging.

Errors

403: Insufficient permissions
Returned if you lack permission to access webhooks for the application.

curl https://api.box.com/2.0/webhooks?limit=3&marker=A_STRING \
-H "Authorization: Bearer "
-H Cache-Control: no-cache
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
  "next_marker": "ZmlQZS0xLTE%3D",
  "entries": [
    {
      "id": "4161",
      "type": "webhook",
      "target": {
        "id": "5018326685",
        "type": "folder"
      }
    },
    {
      "id": "4165",
      "type": "webhook",
      "target": {
        "id": "5016243669",
        "type": "file"
      }
    }
  ],
  "limit": 2
}
Suggest Edits

Get Webhook

Get information about a webhook.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/webhooks/webhook_id

Path Params

webhook_id
string
required

Returns

Returns a webhook object.

Errors

404: Webhook ID not found
Signaled if no webhook exists with the supplied ID.

403: Insufficient permissions
Signaled if you lack permission to access the webhook.

curl https://api.box.com/2.0/webhooks/{id} \
-H "Authorization: Bearer " \
-H Cache-Control: no-cache
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
  "id": "4137",
  "type": "webhook",
  "target": {
    "id": "5018848529",
    "type": "file"
  },
  "created_by": {
    "type": "user",
    "id": "2030392653",
    "name": "John Q. Developer",
    "login": "johnq@example.net"
  },
  "created_at": "2016-05-04T18:51:45-07:00",
  "address": "https://example.net/actions/file_changed",
  "triggers": [
    "FILE.PREVIEWED"
  ]
}
Suggest Edits

Create Webhook

Create a new webhook.

 

OAuth2 Auth

 Authentication is required for this endpoint.
posthttps://api.box.com/2.0/webhooks

Body Params

target
object
 
target.type
string
required
target.id
string
required
triggers
array of strings
required

Event types that trigger notifications for the target.

address
string
required

Returns

Returns a webhook object if creation succeeds.

Errors

404: Target could not be found
Signaled if there is no target with the supplied ID, or if you don't have access to the target.

403: Insufficient permissions
Signaled if you don't have permission to perform the event that the webhook observes.

400: Target not supported
Signaled if you try to create a webhook on an object other than a file or folder.

400: Address invalid
Signaled if the notification URL is not an HTTPS URL.

400: Event name invalid
Signaled if the event name is unrecognized or unsupported by Webhooks V2.

400: Unsupported target type
Signaled if the event type is not supported on the target object's type. For example, you can set a FILE.UPLOADED webhook on a folder, but not on a file.

400: Required field missing
Signaled if a required field is missing from the request. For example, submitting a request in which the target address is missing signals this error.

409: Webhook already exists
Signaled if you try to create a webhook when a matching one already exists. You can only create one webhook for each combination of target, application, and user. If you want to replace one webhook with another, use the Update request to change the webhook.

curl https://api.box.com/2.0/webhooks \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" -X POST \
-d '{"target": {"id": "<TARGET_ID>", "type": "folder"}, "address": "<NOTIFICATION_URL>", "triggers": ["FILE.UPLOADED","FILE.DOWNLOADED"]}'
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
  "id": "4165",
  "type": "webhook",
  "target": {
    "id": "5016243669",
    "type": "file"
  },
  "created_by": {
    "type": "user",
    "id": "2030392653",
    "name": "John Q. Developer",
    "login": "johnq@dev.name"
  },
  "created_at": "2016-05-09T17:41:27-07:00",
  "address": "https://dev.name/actions/file_changed",
  "triggers": [
    "FILE.DOWNLOADED",
    "FILE.UPLOADED"
  ]
}
Suggest Edits

Update Webhook

Update a webhook.

 

OAuth2 Auth

 Authentication is required for this endpoint.
puthttps://api.box.com/2.0/webhooks/webhook_id

Path Params

webhook_id
string
required

Body Params

target
object
 
target.type
string
target.id
string
triggers
array of strings

An array of event names identifying the events that will trigger notification.

address
string

The notification URL to which Box sends messages when monitored events occur.

Returns

Returns the updated webhook object.

Errors

400: Address invalid
Signaled if the notification URL is not valid. The notification URL must be an HTTPS URL that resolves to a valid IP address that is accessible from the Internet, and which is not a Box address.

400: Event name invalid
Signaled if the event name is unrecognized or unsupported.

400: Unsupported target type
Signaled if the event type is not supported on the target object's type. For example, you can set or update a FILE.UPLOADED webhook on a folder, but not on a file.

curl https://api.box.com/2.0/webhooks/{ID} \
-H "Authorization: Bearer " \
-d '{ "address": "https://notification.example.net", "triggers":  ["FILE.PREVIEWED", "FILE.DOWNLOADED"]}' \
-X PUT
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
  "id": "4133",
  "type": "webhook",
  "target": {
    "id": "1000605797",
    "type": "folder"
  },
  "created_by": {
    "type": "user",
    "id": "2030392653",
    "name": "John Q. Developer",
    "login": "john2@example.net"
  },
  "created_at": "2016-05-04T18:51:17-07:00",
  "address": "https://notification.example.net",
  "triggers": [
    "FILE.PREVIEWED", "FILE.DOWNLOADED"
  ]
}
Suggest Edits

Delete Webhook

Delete a webhook.

 

OAuth2 Auth

 Authentication is required for this endpoint.
deletehttps://api.box.com/2.0/webhooks/webhook_id

Path Params

webhook_id
string
required

Returns

204 No Content

Errors

404: Webhook ID not found
Signaled if no webhook exists with the supplied ID.

403: Insufficient permissions
Signaled if you lack permission to delete the webhook.

curl https://api.box.com/2.0/webhooks/{ID} \
-H "Authorization: Bearer " \
-X DELETE
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
No content
Bad request
Signaled if no webhook exists with the supplied ID.
Signaled if you lack permission to delete the webhook.
Suggest Edits

Watermarking Overview

 

Watermarking allows you to place a semi-transparent overlay on an embedded file preview that displays a viewer's email address or user ID and the time of access over a file's content. Once a watermark is applied to a file or folder via the API, the watermark will be displayed on any file preview generated via the Get Embed Link endpoint of the Box Content API.

The ability to watermark files and folders is represented as a sub-resource on the Files and Folders resources, respectively. You can think of the sub-resource as a "label" marking whether the file or folder is watermarked or not. If you apply a watermark label to a folder, then all files inside of it will be protected by the watermark (e.g. previews will be watermarked). However, those files' watermark sub-resource is independent from the folder that got watermarked. This allows you to watermark files and folders independently.

For example, if Folder A has File B and Folder C inside of it, and Folder A gets a watermark applied to it, then all three items are considered to be protected by the watermark (File B will show a watermark on preview). However, when calling "Get Watermark" on File B or Folder C, no watermark sub-resource will be returned, unless they had a watermark applied to them before, explicitly. To find out whether an item is protected by a watermark, request the is_watermarked attribute from the File or Folder object.

The default watermark imprint for Box Managed Users accessing watermarked content is their login email address and the current timestamp. For anonymous users, it is their IP address and current timestamp. For App Users, it is their user ID and current timestamp. The default watermark cannot be customized at this time.

Watermarking is only available for Developer, Enterprise and Elite Box accounts. This feature is "on" globally by default, and users with editor permissions have access (Owners, Co-Owners, Editors). The root folder (folder ID "0") cannot be watermarked.

For more information on the watermarking feature, please see our community page.

Watermarking specific error codes

The following are error codes specific to the watermarking endpoints.

status
error_code
message

400

invalid_watermark_request_body

Request body is invalid.

400

filesystem_watermarking_violation

A filesystem and watermarking constraint is violated.

403

watermarking_feature_not_enabled

Watermarking feature is not enabled.

Suggest Edits

Get Watermark on File

Used to retrieve the watermark for a corresponding Box file.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/files/file_id/watermark

Path Params

file_id
string
required

Returns

An object containing information about the watermark associated for this file. If the file does not have a watermark applied to it, a 404 Not Found will be returned.

curl https://api.box.com/2.0/files/5010739069/watermark \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
  "watermark": {
    "created_at": "2016-10-31T15:33:33-07:00",
    "modified_at": "2016-10-31T15:33:33-07:00"
  }
}
Not Found
Suggest Edits

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.

 

OAuth2 Auth

 Authentication is required for this endpoint.
puthttps://api.box.com/2.0/files/file_id/watermark

Path Params

file_id
string
required

Body Params

watermark
object
 
watermark.imprint
string
required

default

Returns

An object containing information about the watermark associated for this file. If the file did not previously have a watermark applied to it, 201 Created is returned, otherwise 200 OK is returned.

curl https://api.box.com/2.0/files/5010739069/watermark \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{"watermark": {"imprint": "default"}}' \
-X PUT
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
  "watermark": {
    "created_at": "2016-10-31T15:33:33-07:00",
    "modified_at": "2016-10-31T15:33:33-07:00"
  }
}
Returned if file is already watermarked
Suggest Edits

Remove Watermark on File

Used to remove the watermark for a corresponding Box file.

 

OAuth2 Auth

 Authentication is required for this endpoint.
deletehttps://api.box.com/2.0/files/file_id/watermark

Path Params

file_id
string
required

Returns

An empty 204 No Content response to confirm the watermark has been removed. If the file did not have a watermark applied to it, a 404 Not Found will be returned.

curl https://api.box.com/2.0/files/5010739069/watermark \
-H "Authorization: Bearer " \
-X DELETE
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Suggest Edits

Get Watermark on Folder

Used to retrieve the watermark for a corresponding Box folder.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/folders/folder_id/watermark

Path Params

folder_id
string
required

Returns

An object containing information about the watermark associated for this folder. If the folder does not have a watermark applied to it, a 404 Not Found will be returned.

curl https://api.box.com/2.0/folders/5010739069/watermark \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
  "watermark": {
    "created_at": "2016-10-31T15:33:33-07:00",
    "modified_at": "2016-10-31T15:33:33-07:00"
  }
}
Not found
Suggest Edits

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.

 

OAuth2 Auth

 Authentication is required for this endpoint.
puthttps://api.box.com/2.0/folders/folder_id/watermark

Path Params

folder_id
string
required

Returns

An object containing information about the watermark associated for this folder. If the folder did not previously have a watermark applied to it, 201 Created is returned, otherwise 200 OK is returned.

curl https://api.box.com/2.0/folders/5010739069/watermark \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{"watermark": {"imprint": "default"}}' \
-X PUT
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
  "watermark": {
    "created_at": "2016-10-31T15:33:33-07:00",
    "modified_at": "2016-10-31T15:33:33-07:00"
  }
}
{
  "watermark": {
    "created_at": "2016-10-31T15:33:33-07:00",
    "modified_at": "2016-10-31T15:50:25-07:00"
  }
}
Suggest Edits

Remove Watermark on Folder

Used to remove the watermark for a corresponding Box folder.

 

OAuth2 Auth

 Authentication is required for this endpoint.
deletehttps://api.box.com/2.0/folders/folder_id/watermark

Path Params

folder_id
string
required

Returns

An empty 204 No Content response to confirm the watermark has been removed. If the file did not have a watermark applied to it, a 404 Not Found will be returned.

curl https://api.box.com/2.0/folders/5010739069/watermark \
-H "Authorization: Bearer " \
-X DELETE
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Try the API to see results
Suggest Edits

Device Pin Object

 

Device pins allow enterprises to control what devices can use native Box applications. To learn more about device pinning, please see our documentation.

type

string

device_pinner

id

string

The ID of the device pin object

owned_by

string

The user that the device pin belongs to

product_name

string

The type of device being pinned

created_at

date-time

The time the device pin was created

modified_at

date-time

The time the device pin was modified

{
    "type": "device_pinner",
    "id": "788804",
    "owned_by": {
        "type": "user",
        "id": "222276603",
        "name": "Ted Blosser",
        "login": "ted+boxworks2@box.com"
    },
    "product_name": "iPad",
    "created_at": "2014-09-23T22:56:18-07:00",
    "modified_at": "2014-09-23T22:56:18-07:00"
}
Suggest Edits

Get Device Pin

Gets information about an individual device pin.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/device_pinners/device_pin_id

Path Params

device_pin_id
string
required

Returns information about a single device pin.

curl https://api.box.com/2.0/device_pinners/788804 \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "device_pinner",
    "id": "788804",
    "owned_by": {
        "type": "user",
        "id": "222276603",
        "name": "Ted Blosser",
        "login": "ted+boxworks2@box.com"
    },
    "product_name": "iPad",
    "created_at": "2014-09-23T22:56:18-07:00",
    "modified_at": "2014-09-23T22:56:18-07:00"
}
Suggest Edits

Delete Device Pin

Delete individual device pin.

 

OAuth2 Auth

 Authentication is required for this endpoint.
deletehttps://api.box.com/2.0/device_pinners/device_pin_id

Path Params

device_pin_id
string
required

A 204 will be returned if deletion is successful

curl https://api.box.com/2.0/device_pinners/788804  \
-H "Authorization: Bearer " \
-X DELETE
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Try the API to see results
Suggest Edits

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.

 
gethttps://api.box.com/2.0/enterprises/enterprise_id/device_pinners

Path Params

enterprise_id
string
required

Query Params

marker
string

The position marker at which to begin the response. See marker-based paging for details.

limit
int32

The maximum number of items to return. The default is 100 and the maximum is 10,000.

direction
string

The sorting direction (by id). One of ASC or DESC (default is ASC). Case-insensitive.

Returns all of the device pins for the given enterprise using marker-based paging.

curl https://api.box.com/2.0/enterprises/490683/device_pinners \
-H "Authorization: Bearer "
A binary file was returned
{
    "entries": [
        {
            "type": "device_pinner",
            "id": "788804",
            "owned_by": {
                "type": "user",
                "id": "222276603",
                "name": "Ted Blosser",
                "login": "ted+boxworks2@box.com"
            },
            "product_name": "iPad"
        },

        {
            "type": "device_pinner",
            "id": "1003086",
            "owned_by": {
                "type": "user",
                "id": "222276603",
                "name": "Ted Blosser",
                "login": "ted+boxworks2@box.com"
            },
            "product_name": "iPhone"
        }
    ],
    "limit": 100,
    "order": [
        {
            "by": "id",
            "direction": "ASC"
        }
    ]
}
Suggest Edits

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.

 

type

string

collection

id

string

The ID of the collection

name

string

The name of the collection. The only collection available is named Favorites

collection_type

string

The type of the collection. This is used to determine the proper visual treatment for collections. The only collection type is favorites.

{
    "type": "collection",
    "id": "5880",
    "name": "Favorites",
    "collection_type": "favorites",
}
Suggest Edits

Get Collections

Retrieves the collections for the given user. Only the Favorites collection is supported.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/collections
curl https://api.box.com/2.0/collections/
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "total_count": 1,
    "entries": [
        {
            "type": "collection",
            "id": "405151",
            "name": "Favorites",
            "collection_type": "favorites"
        }
    ],
    "limit": 100,
    "offset": 0
}
Suggest Edits

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.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/collections/collection_id/items

Path Params

collection_id
string
required

Query Params

fields
string

Comma-separated list of fields to include in the response

offset
int32

The offset of the item at which to begin the response. See offset-based paging for details.

limit
int32

The maximum number of items to return. The default is 100 and the maximum is 1,000.

Returns

Returns all of the items in the collection using offset-based paging.

An error is returned if the collection does not exist, or if any of the parameters are invalid.

Order:

Each order object will list an attribute (e.g. name) and direction (e.g. ASC).

curl https://api.box.com/2.0/collections/COLLECTION_ID/items?limit=2&offset=0 \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "total_count": 24,
    "entries": [
        {
            "type": "folder",
            "id": "192429928",
            "sequence_id": "1",
            "etag": "1",
            "name": "Stephen Curry Three Pointers"
        },
        {
            "type": "file",
            "id": "818853862",
            "sequence_id": "0",
            "etag": "0",
            "name": "Warriors.jpg"
        }
    ],
    "offset": 0,
    "limit": 2
}
Suggest Edits

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.

 

OAuth2 Auth

 Authentication is required for this endpoint.
puthttps://api.box.com/2.0/folders/folder_id

Path Params

folder_id
string
required
curl https://api.box.com/2.0/folders/FOLDER_ID \
-H "Authorization: Bearer " \
-d '{"collections": [{"id":"123"}]}' \
-X PUT
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "folder",
    "id": "11446498",
    "sequence_id": "1",
    "etag": "1",
    "name": "New Folder Name!",
    "created_at": "2012-12-12T10:53:43-08:00",
    "modified_at": "2012-12-12T11:15:04-08:00",
    "description": "Some pictures I took",
    "size": 629644,
    "path_collection": {
        "total_count": 1,
        "entries": [
            {
                "type": "folder",
                "id": "0",
                "sequence_id": null,
                "etag": null,
                "name": "All Files"
            }
        ]
    },
    "created_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "modified_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "owned_by": {
        "type": "user",
        "id": "17738362",
        "name": "sean rose",
        "login": "sean@box.com"
    },
    "shared_link": {
        "url": "https://www.box.com/s/vspke7y05sb214wjokpk",
        "download_url": null,
        "vanity_url": null,
        "is_password_enabled": false,
        "unshared_at": null,
        "download_count": 0,
        "preview_count": 0,
        "access": "open",
        "permissions": {
            "can_download": true,
            "can_preview": true
        }
    },
    "folder_upload_email": {
        "access": "open",
        "email": "upload.Picture.k13sdz1@u.box.com"
    },
    "parent": {
        "type": "folder",
        "id": "0",
        "sequence_id": null,
        "etag": null,
        "name": "All Files"
    },
    "item_status": "active",
    "item_collection": {
        "total_count": 1,
        "entries": [
            {
                "type": "file",
                "id": "5000948880",
                "sequence_id": "3",
                "etag": "3",
                "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc",
                "name": "tigers.jpeg"
            }
        ],
        "offset": 0,
        "limit": 100
    }
}
Suggest Edits

Task Object

 

Tasks enable file-centric workflows in Box. User can create tasks on files and assign them to collaborators on Box. You can read more about tasks in Box here.

type

string

task

id

string

The ID of the task object

item

mini file object

The file associated with the task

due_at

date-time

When the task is due

action

string

The action the task assignee will be prompted to do. Must be review

message

string

A message that will be included with the task

task_assignment_collection

collection

A collection of mini task_assignment objects associated with the task

is_completed

boolean

Whether the task has been completed

created_by

mini user object

The user who created the task

created_at

date-time

When the task object was created

Note:

Tagged messages are not included in the task object.

{
    "type": "task",
    "id": "1839355",
    "item": {
        "type": "file",
        "id": "7287087200",
        "sequence_id": "0",
        "etag": "0",
        "sha1": "0bbd79a105c504f99573e3799756debba4c760cd",
        "name": "box-logo.png"
    },
    "due_at": "2014-04-03T11:09:43-07:00",
    "action": "review",
    "message": "REVIEW PLZ K THX",
    "task_assignment_collection": {
        "total_count": 0,
        "entries": []
    },
    "is_completed": false,
    "created_by": {
        "type": "user",
        "id": "11993747",
        "name": "☁ sean ☁",
        "login": "sean@box.com"
    },
    "created_at": "2013-04-03T11:12:54-07:00"
}
Suggest Edits

Get Task

Fetches a specific task.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/tasks/task_id

Path Params

task_id
string
required

Returns

The specified task object will be returned upon success.

curl https://api.box.com/2.0/tasks/TASK_ID \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "task",
    "id": "1839355",
    "item": {
        "type": "file",
        "id": "7287087200",
        "sequence_id": "0",
        "etag": "0",
        "sha1": "0bbd79a105c504f99573e3799756debba4c760cd",
        "name": "box-logo.png"
    },
    "due_at": "2014-04-03T11:09:43-07:00",
    "action": "review",
    "message": "REVIEW PLZ K THX",
    "task_assignment_collection": {
        "total_count": 0,
        "entries": []
    },
    "is_completed": false,
    "created_by": {
        "type": "user",
        "id": "11993747",
        "name": "☁ sean ☁",
        "login": "sean@box.com"
    },
    "created_at": "2013-04-03T11:12:54-07:00"
}
Suggest Edits

Create Task

Used to create a single task for single user on a single file.

 

OAuth2 Auth

 Authentication is required for this endpoint.
posthttps://api.box.com/2.0/tasks

Body Params

item
object
 
item.type
string
required

file

item.id
string
required

The ID of the file this task is associated with

action
string

The action the task assignee will be prompted to do. Must be review

message
string

An optional message to include with the task

due_at
date-time

When this task is due

Returns

A new task object will be returned upon success.

curl https://api.box.com/2.0/tasks \
-H "Authorization: Bearer " \
-d '{"item": {"type": "file", "id": "FILE_ID"}, "action": "review"}' \
-X POST
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "task",
    "id": "1839355",
    "item": {
        "type": "file",
        "id": "7287087200",
        "sequence_id": "0",
        "etag": "0",
        "sha1": "0bbd79a105c504f99573e3799756debba4c760cd",
        "name": "box-logo.png"
    },
    "due_at": "2014-04-03T11:09:43-07:00",
    "action": "review",
    "message": "REVIEW PLZ K THX",
    "task_assignment_collection": {
        "total_count": 0,
        "entries": []
    },
    "is_completed": false,
    "created_by": {
        "type": "user",
        "id": "11993747",
        "name": "☁ sean ☁",
        "login": "sean@box.com"
    },
    "created_at": "2013-04-03T11:12:54-07:00"
}
Suggest Edits

Update Task

Updates a specific task.

 

OAuth2 Auth

 Authentication is required for this endpoint.
puthttps://api.box.com/2.0/tasks/task_id

Path Params

task_id
string
required

Body Params

action
string

The action the task assignee will be prompted to do. Can be review

message
string
required

An message to include with the task

due_at
date-time

The day at which this task is due

Returns

The updated task object will be returned upon success.

curl https://api.box.com/2.0/tasks/TASK_ID \
-H "Authorization: Bearer " \
-d '{"message": "REVIEW PLZ K THX"}' \
-X PUT
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "task",
    "id": "1839355",
    "item": {
        "type": "file",
        "id": "7287087200",
        "sequence_id": "0",
        "etag": "0",
        "sha1": "0bbd79a105c504f99573e3799756debba4c760cd",
        "name": "box-logo.png"
    },
    "due_at": "2014-04-03T11:09:43-07:00",
    "action": "review",
    "message": "REVIEW PLZ K THX",
    "task_assignment_collection": {
        "total_count": 0,
        "entries": []
    },
    "is_completed": false,
    "created_by": {
        "type": "user",
        "id": "11993747",
        "name": "☁ sean ☁",
        "login": "sean@box.com"
    },
    "created_at": "2013-04-03T11:12:54-07:00"
}
Suggest Edits

Delete Task

Permanently deletes a specific task.

 

OAuth2 Auth

 Authentication is required for this endpoint.
deletehttps://api.box.com/2.0/tasks/task_id

Path Params

task_id
string
required

Returns

An empty 204 response will be returned upon success.

curl https://api.box.com/2.0/tasks/TASK_ID \
-H "Authorization: Bearer " \
-X DELETE
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Try the API to see results
Suggest Edits

Get Task Assignment

Fetches a specific task assignment.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/task_assignments/task_assignment_id

Path Params

task_assignment_id
string
required

Returns

The specified task assignment object will be returned upon success.

curl https://api.box.com/2.0/task_assignments/TASK_ASSIGNMENT_ID \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "task_assignment",
    "id": "2698512",
    "item": {
        "type": "file",
        "id": "8018809384",
        "sequence_id": "0",
        "etag": "0",
        "sha1": "7840095ee096ee8297676a138d4e316eabb3ec96",
        "name": "scrumworksToTrello.js"
    },
    "assigned_to": {
        "type": "user",
        "id": "1992432",
        "name": "rhaegar@box.com",
        "login": "rhaegar@box.com"
    },
    "message": null,
    "completed_at": null,
    "assigned_at": "2013-05-10T11:43:41-07:00",
    "reminded_at": null,
    "resolution_state": "incomplete",
    "assigned_by": {
        "type": "user",
        "id": "11993747",
        "name": "☁ sean ☁",
        "login": "sean@box.com"
    }
}
Suggest Edits

Create Task Assignment

Used to assign a task to a single user. There can be multiple assignments on a given task.

 

OAuth2 Auth

 Authentication is required for this endpoint.
posthttps://api.box.com/2.0/task_assignments

Body Params

task
object
 
task.type
string
required

task

task.id
string
required

The ID of the task this assignment is for

assign_to
object
 
assign_to.id
string

The ID of the user this assignment is for

assign_to.login
string

The login email address for the user this assignment is for

Returns

A new task assignment object will be returned upon success.

curl https://api.box.com/2.0/task_assignments \
-H "Authorization: Bearer " \
-d '{ "task": { "id": "1992432", "type": "task" }, "assign_to": { "id": "1992432" } }' \
-X POST
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "task_assignment",
    "id": "2698512",
    "item": {
        "type": "file",
        "id": "8018809384",
        "sequence_id": "0",
        "etag": "0",
        "sha1": "7840095ee096ee8297676a138d4e316eabb3ec96",
        "name": "scrumworksToTrello.js"
    },
    "assigned_to": {
        "type": "user",
        "id": "1992432",
        "name": "rhaegar@box.com",
        "login": "rhaegar@box.com"
    },
    "message": null,
    "completed_at": null,
    "assigned_at": "2013-05-10T11:43:41-07:00",
    "reminded_at": null,
    "resolution_state": "incomplete",
    "assigned_by": {
        "type": "user",
        "id": "11993747",
        "name": "☁ sean ☁",
        "login": "sean@box.com"
    }
}
Suggest Edits

Update Task Assignment

Used to update a task assignment.

 

OAuth2 Auth

 Authentication is required for this endpoint.
puthttps://api.box.com/2.0/task_assignments/task_assignment_id

Path Params

task_assignment_id
string
required

Body Params

message
string

A message from the assignee about this task

resolution_state
string

Can be completed, incomplete, approved, or rejected

Returns

A new task assignment object will be returned upon success.

curl https://api.box.com/2.0/task_assignments \
-H "Authorization: Bearer " \
-d '{ "message": "hello!!!" }' \
-X PUT
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "type": "task_assignment",
    "id": "2698512",
    "item": {
        "type": "file",
        "id": "8018809384",
        "sequence_id": "0",
        "etag": "0",
        "sha1": "7840095ee096ee8297676a138d4e316eabb3ec96",
        "name": "scrumworksToTrello.js"
    },
    "assigned_to": {
        "type": "user",
        "id": "1992432",
        "name": "rhaegar@box.com",
        "login": "rhaegar@box.com"
    },
    "message": "hello!!!",
    "completed_at": null,
    "assigned_at": "2013-05-10T11:43:41-07:00",
    "reminded_at": null,
    "resolution_state": "incomplete",
    "assigned_by": {
        "type": "user",
        "id": "11993747",
        "name": "☁ sean ☁",
        "login": "sean@box.com"
    }
}
Suggest Edits

Delete Task Assignment

Deletes a specific task assignment.

 

OAuth2 Auth

 Authentication is required for this endpoint.
deletehttps://api.box.com/2.0/task_assignments/task_assignment_id

Path Params

task_assignment_id
string
required

Returns

An empty 204 No Content response will be returned upon success.

curl https://api.box.com/2.0/task_assignments/TASK_ASSIGNMENT_ID \
-H "Authorization: Bearer " \
-X DELETE
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
Try the API to see results
Suggest Edits

Get Task Assignments

Retrieves all of the assignments for a given task.

 

OAuth2 Auth

 Authentication is required for this endpoint.
gethttps://api.box.com/2.0/tasks/task_id/assignments

Path Params

task_id
string
required

Returns

Returns all of the task assignment for the task. This API does not support paging -- it always returns all of the task assignments.

curl https://api.box.com/2.0/tasks/TASK_ID/assignments \
-H "Authorization: Bearer "
A binary file was returned

Your OAuth2 token has expired

Reauthenticate via OAuth2
{
    "total_count": 1,
    "entries": [
        {
            "type": "task_assignment",
            "id": "2485961",
            "item": {
                "type": "file",
                "id": "7287087200",
                "sequence_id": "0",
                "etag": "0",
                "sha1": "0bbd79a105c504f99573e3799756debba4c760cd",
                "name": "box-logo.png"
            },
            "assigned_to": {
                "type": "user",
                "id": "193425559",
                "name": "Rhaegar Targaryen",
                "login": "rhaegar@box.com"
            }
        }
    ]
}
Suggest Edits

Retention Policy Object

 

Premium feature

Retention Management is a feature of the Box Governance package, which can be added on to any Business Plus or Enterprise account. More details available here.

A retention policy blocks permanent deletion of content for a specified amount of time. Admins can create retention policies and then later assign them to specific folders or their entire enterprise. To use this feature, you must have the manage retention policies scope enabled for your API key via your application management console. For more information about retention policies, please visit our help documentation.

File Deletion with Retention Policies

Files under retention can be deleted from folders, but they will be retained in the trash until the retention period expires. When the retention period expires, you can choose to have the content automatically deleted or for the policy to be removed.

type

string

retention_policy

id

string

The ID of the retention policy object

policy_name

string

The name of the retention policy

policy_type

string

The type of the retention policy. A retention policy type can either be finite, where a specific amount of time to retain the content is known upfront, or indefinite, where the amount of time to retain the content is still unknown.

retention_length

integer

The length of the retention policy. This length specifies the duration in days that the retention policy will be active for after being assigned to content.

disposition_action

string

The disposition action of the retention policy. This action can be permanently_delete, which will cause the content retained by the policy to be permanently deleted, or remove_retention, which will lift the retention policy from the content, allowing it to be deleted by users, once the retention policy time period has passed.

status

string

The status of the retention policy. The status of a policy will be active, unless explicitly retired by an administrator, in which case the status will be retired. Once a policy has been retired, it cannot become active again.

created_by

mini user object

A mini user object representing the user that created the retention policy

created_at

date-time

When the retention policy object was created

modified_at

date-time

When the retention policy object was last modified

Suggest Edits

Get Retention Policy

Used to retrieve information about a retention policy

 
gethttps://api.box.com/2.0/retention_policies/policy_id

Path Params

policy_id
string
required

Returns

The specified retention policy will be returned upon success. If the retention policy specified does not exist, a 404 HTTP status code of not_found is returned.

curl https://api.box.com/2.0/retention_policies/POLICY_ID \ 
-H "Authorization: Bearer " \
A binary file was returned
{
  "type": "retention_policy",     
  "id": "123456789",     
  "policy_name": "Tax Documents",  
  "policy_type": "finite",     
  "retention_length": 365,     
  "disposition_action": "remove_retention",  
  "status": "active",     
  "created_by": {
    "type": "user",
    "id": "11993747",
    "name": "Sean",
    "login": "sean@box.com"
  },
  "created_at": "2015-05-01T11:12:54-07:00",
  "modified_at": "2015-06-08T11:11:50-07:00" 
}
Suggest Edits

Create Retention Policy

Used to create a new retention policy.

 
posthttps://api.box.com/2.0/retention_policies

Form Data

policy_name
string
required

Name of retention policy to be created

policy_type
string
required

finite or indefinite

retention_length
int32

The retention_length is the amount of time, in days, to apply the retention policy to the selected content in days. Do not specify for indefinite policies. Required for finite policies.

disposition_action
string
required

If creating a finite policy, the disposition action can be permanently_delete or remove_retention. For indefinite policies, disposition action must be remove_retention.

Returns

A new retention policy object will be returned upon success. If a “retention_length” or incorrect “disposition_action” is specified for an indefinite policy, a 400 HTTP status code of bad_request will be returned. If a retention policy with the given name already exists, a 409 HTTP status code of conflict will be returned.

curl https://api.box.com/2.0/retention_policies \ 
-H "Authorization: Bearer " \ 
-d '{"policy_name": "POLICY_NAME", "policy_type": "finite", "retention_length": 365, "disposition_action": "remove_retention"}' \ 
-X POST
A binary file was returned
{
  "type": "retention_policy",
  "id": "123456789",
  "policy_name": "Tax Documents",
  "policy_type": "finite",
  "retention_length": 365,
  "disposition_action": "permanently_delete",
  "status": "active",
  "created_by": {
    "type": "user",
    "id": "11993747",
    "name": "Sean",
    "login": "sean@box.com"
  },
  "created_at": "2015-05-01T11:12:54-07:00",
  "modified_at": null 
}
Suggest Edits

Update Retention Policy

Used to update a retention policy.

 
puthttps://api.box.com/2.0/retention_policies/policy_id

Path Params

policy_id
string
required

Form Data

policy_name
string

Updated name of retention policy

disposition_action
string

If creating a finite policy, the disposition action can be permanently_delete or remove_retention. For indefinite policies, disposition action must be remove_retention.

status
string

Used to retire a retention policy if status is set to retired. If not retiring a policy, do not include or set to null.

Returns

An updated retention policy object will be returned upon success. If an incorrect “disposition_action” is specified for an indefinite policy, a 400 HTTP status code of bad_request will be returned. If a retention policy with the given name already exists, a 409 HTTP status code of conflict will be returned.

curl https://api.box.com/2.0/retention_policies/POLICY_ID \ 
-H "Authorization: Bearer " \ 
-d '{"policy_name": "NEW_POLICY_NAME", "disposition_action": "remove_retention", "status": null}' \ 
-X PUT
A binary file was returned
{     
  "type": "retention_policy",     
  "id": "123456789",     
  "policy_name": "Tax Documents", 
  "policy_type": "finite",     
  "retention_length": 365,     
  "disposition_action": "remove_retention",  
  "status": "active",     
  "created_by": {
    "type": "user",
    "id": "11993747",
    "name": "Sean",
    "login": "sean@box.com"
  },
  "created_at": "2015-05-01T11:12:54-07:00",
  "modified_at": "2015-06-08T11:11:50-07:00" 
}
Suggest Edits

Get Retention Policies

Retrieves all of the retention policies for the given enterprise.

 
gethttps://api.box.com/2.0/retention_policies

Query Params

policy_name
string

A name to filter the retention policies by. A trailing partial match search is performed.

policy_type
string

A policy type to filter the retention policies by.

created_by_user_id
string

A user ID to filter the retention policies by.

Returns

Returns the list of all retention policies for the enterprise. If query parameters are given, only the retention policies that match the query parameters are returned. If the user specified in the “created_by_user_id” does not exist, a 404 HTTP status code of not_found is returned. If a bad “policy_type” is given, a 400 HTTP status code of bad_request is returned.

curl https://api.box.com/2.0/retention_policies \ 
-H "Authorization: Bearer " \
A binary file was returned
{
  "entries": [
    {
      "type": "retention_policy",
      "id": "123456789",
      "name": "TaxDocuments"
    }
  ] 
}
Suggest Edits

Retention Assignment Object

 

The retention policy assignment endpoint provides a way for admins to apply a retention policy on a per-folder basis, or place a blanket policy over the entire enterprise.

type

string

retention_policy_assignment

id

string

The ID of the retention policy assignment object

retention_policy

mini retention policy object

A mini retention policy object representing the retention policy that has been assigned to this content

assigned_to

object

The type and id of the content that is under retention. The type can either be folder or enterprise.

assigned_by

mini user object

A mini user object representing the user that created the retention policy assignment object

assigned_at

date-time

When the retention policy assignment object was created

Suggest Edits

Get Retention Policy Assignment

Used to retrieve information about a retention policy assignment.

 
gethttps://api.box.com/2.0/retention_policy_assignments/retention_policy_assignment_id

Path Params

retention_policy_assignment_id
string
required

Returns

The specified retention policy assignment will be returned upon success. If no retention policy assignment with the given ID exists, a 404 HTTP status code of not_found is returned.

curl https://api.box.com/2.0/retention_policy_assignments/{RETENTION_POLICY_ASSIGNMENT_ID} \  
-H "Authorization: Bearer " \
A binary file was returned
{     
  "type": "retention_policy_assignment",    
  "id": "3233225",    
  "retention_policy": {   
    "type": "retention_policy",    
    "id": "32131",   
    "policy_name": "TaxDocuments"
  },    
  "assigned_to": {  
    "type": "folder",   
    "id": "99922219"   
  },   
  "assigned_by": {  
    "type": "user",    
    "id": "123456789",  
    "name": "Sean",     
    "login": "sean@box.com"     
  },     
  "assigned_at": "2015-07-20T14:28:09-07:00" 
}
Suggest Edits

Create Retention Policy Assignment

Returns a list of all retention policy assignments associated with a specified retention policy.

 
posthttps://api.box.com/2.0/retention_policy_assignments

Form Data

policy_id
string
required

The ID of the retention policy to assign this content to.

assign_to
object
required

The type and id of the content to assign the retention policy to. type can only be one of two attributes: enterprise or folder. If assigning to an enterprise, no id should be provided.

Returns

A new retention policy assignment will be returned upon success. If no retention policy with the given “policy_id” exists, a 404 HTTP status code of not_found is returned. If an “id” is specified while assigning a retention policy to an enterprise, a 400 HTTP status code of bad_request is returned. If a retention policy of equal or greater length has already been assigned to this content, a 409 HTTP status_code of conflict is returned.

curl https://api.box.com/2.0/retention_policy_assignments \ 
-H "Authorization: Bearer " \ 
-d '{"policy_id": "POLICY_ID", "assign_to": {"type": "folder", "id": "FOLDER_ID"}}' \ 
-X POST
A binary file was returned
{     
  "type": "retention_policy_assignment",     
  "id": "3233225",     
  "retention_policy": {         
    "type": "retention_policy",         
    "id": "32131",         
    "policy_name": "TaxDocuments"     
  },
  "assigned_to": {
    "type": "folder",         
    "id": "99922219"     
  },     
  "assigned_by": {         
    "type": "user",        
    "id": "123456789",        
    "name": "Sean",        
    "login": "sean@box.com"    
  },    
  "assigned_at": "2015-07-20T14:28:09-07:00"
}
Suggest Edits

Get Retention Policy Assignments

Returns a list of all retention policy assignments associated with a specified retention policy.

 
gethttps://api.box.com/2.0/retention_policies/policy_id/assignments

Path Params

policy_id
string
required

Query Params

type
string

The type of the retention policy assignment to retrieve. Can either be folder or enterprise.

Returns

Returns a list of the retention policy assignments associated with the specified retention policy. If a bad “type” parameter is given, a 400 HTTP status code of bad_request is returned.

curl https://api.box.com/2.0/retention_policies/POLICY_ID/assignments \ 
-H "Authorization: Bearer " \
A binary file was returned
{
  "entries": [
    {
      "type": "retention_policy_assignment",
      "id": "12345678"
    }
  ]
}
Suggest Edits

File Version Retention Object

 

Premium feature

File Version Retention Management is a feature of the Box Governance package, which can be added on to any Business Plus or Enterprise account. More details available here.

A retention policy blocks permanent deletion of content for a specified amount of time. Admins can apply policies to specified folders, or an entire enterprise. A file version retention is a record for a retained file version. To use this feature, you must have the manage retention policies scope enabled for your API key via your application management console. For more information about retention policies, please visit our help documentation.

type
string

file_version_retention

id
string

The ID of the file version retention object

file_version
mini file version object

The file version this file version retention was applied to

file
mini file object

The file this file version retention was applied to

applied_at
date-time

When this file version retention object was created

disposition_at
date-time

When the retention period expires on this file version retention

winning_retention_policy
mini retention policy object

The winning retention policy applied to this file version retention. A file version can have multiple retention policies applied.

Suggest Edits

Get File Version Retention

Used to retrieve information about a file version retention

 
gethttps://api.box.com/2.0/file_version_retentions/file_version_retention_id

Path Params

file_version_retention_id
string
required

Returns

The specified file version retention will be returned upon success. If the file version retention specified does not exist, a 404 HTTP status code of not_found is returned.

curl https://api.box.com/2.0/file_version_retentions/FILE_VERSION_RETENTION_ID \ 
-H "Authorization: Bearer " \
A binary file was returned
{
    "type": "file_version_retention",
    "id": "112729",
    "applied_at": "2015-08-06T22:02:24-07:00",
    "disposition_at": "2016-08-06T21:45:28-07:00",
    "winning_retention_policy": {
        "type": "retention_policy",
        "id": "41173",
        "policy_name": "Tax Documents"
    },
    "file_version": {
        "type": "file_version",
        "id": "124887629",
        "sha1": "4262d6250b0e6f440dca43a2337bd4621bad9136"
    },
    "file": {
        "type": "file_version",
        "id": "5011706273",
        "etag": "2"
    }
}
Suggest Edits

Get File Version Retentions

Retrieves all file version retentions for the given enterprise.

 
gethttps://api.box.com/2.0/file_version_retentions

Query Params

file_id
string

A file ID to filter the file version retentions by

file_version_id
string

A file version ID to filter the file version retentions by

policy_id
string

A policy ID to filter the file version retentions by

disposition_action
string

The disposition action of the retention policy. This action can be permanently_delete, which will cause the content retained by the policy to be permanently deleted, or remove_retention, which will lift the retention policy from the content, allowing it to be deleted by users, once the retention policy time period has passed.

disposition_before
date-time

See content times for formatting

disposition_after
date-time

See content times for formatting

limit
int32

The maximum number of items to return. The default is 100.

marker
string

Base 64 encoded string that represents where the paging should being. It should be left blank to begin paging.

Returns

Returns the list of all file version retentions for the enterprise. If the query parameters are given, only the file version retentions that match the query parameters are returned.

curl https://api.box.com/2.0/file_version_retentions?disposition_action=permanently_delete&disposition_before=2014-09-15T13:15:35-07:00\ 
-H "Authorization: Bearer " \
A binary file was returned
{
      "entries": [
            {
                "type": "file_version_retention",
                "id": "112725"
            },
            {
                "type": "file_version_retention",
                "id": "112729"
            },
            {
                "type": "file_version_retention",
                "id": "112733"
            }
        ],
        "limit": 100,
        "order": [
            {
                "by": "file_version_id",
                "direction": "ASC"
            }
        ]
}
Suggest Edits

Create New Policy Assignment

Create a new policy assignment, which applies the legal hold policy to the target of the assignment.

 
posthttps://api.box.com/2.0/legal_hold_policy_assignments

Form Data

policy_id
string
required

ID of Policy to create Assignment for.

assign_to
object
required
assign_to.id
string
required

Possible values for id are file_version_id, file_id, folder_id, or user_id

assign_to.type
string

Possible values for type are 'file_version', 'file', 'folder', or 'user'

Returns

For a successful request, returns a 200 with information about the Assignment created. If the policy or assign-to target cannot be found, a 404 will be returned.

curl https://api.box.net/2.0/legal_hold_policy_assignments  
-H "Authorization: Bearer " \
-d '{
    "policy_id": "166757",
    "assign_to": {
        "type" : "file",
        "id" : "5025127885"
    }}' \
-X POST
A binary file was returned
{
  "type": "legal_hold_policy_assignment",
  "id": "255613",
  "legal_hold_policy": {
    "type": "legal_hold_policy",
    "id": "166757",
    "policy_name": "Bug Bash 5-12 Policy 3 updated"
  },
  "assigned_to": {
    "type": "file",
    "id": "5025127885"
  },
  "assigned_by": {
    "type": "user",
    "id": "2030388321",
    "name": "Steve Boxuser",
    "login": "sboxuser@box.com"
  },
  "assigned_at": "2016-05-18T17:38:03-07:00",
  "deleted_at": null
}
Suggest Edits

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.

 
deletehttps://api.box.com/2.0/legal_hold_policy_assignments/assignment_id

Path Params

assignment_id
string
required

Returns

A successful request returns 204 No Content. If the Assignment is still initializing, will return a 409.

curl https://api.box.com/2.0/legal_hold_policy_assignments/255613  \
-H "Authorization: Bearer " \
-X DELETE
A binary file was returned
No response examples available
Suggest Edits

Get Policy Assignments

Get all of the assignments for a legal hold policy.

 
gethttps://api.box.com/2.0/legal_hold_policies_assignments

Query Params

policy_id
string
required

ID of Policy to get Assignments for. Can also specify a part of a URL

assign_to_type
string

Filter assignments of this type only. Can be file_version, file, folder, or user.

assign_to_id
string

Filter assignments to this ID only. Note that this will only show assignments applied directly to this entity.

Returns

Returns the list of Assignments for the passed in Policy, as well as any optional filter parameters passed in. By default, will only return only type, and id, but you can specify more by using the fields parameter.

curl https://api.box.com/2.0/legal_hold_policy_assignments?policy_id=166757 \ 
-H "Authorization: Bearer " \
A binary file was returned
{
  "entries": [
    {
      "type": "legal_hold_policy_assignment",
      "id": "255473"
    }
  ],
  "limit": 100,
  "order": [
    {
      "by": "retention_policy_id, retention_policy_object_id",
      "direction": "ASC"
    }
  ]
}
Suggest Edits

Get File Version Legal Hold

Get information about a file version legal hold.

 
gethttps://api.box.com/2.0/file_version_legal_holds/id

Path Params

id
string
required

Returns

If the ID is valid, information about the Hold is returned with a 200.
If the ID is for a non-existent Hold, a 404 is returned.

curl https://api.box.com/2.0/file_version_legal_holds/240997 
-H "Authorization: Bearer "
A binary file was returned
{
  "type": "legal_hold",
  "id": "240997",
  "file_version": {
    "type": "file_version",
    "id": "141649417"
  },
  "file": {
    "type": "file",
    "id": "5025122933",
    "etag": "1"
  },
  "legal_hold_policy_assignments": [
    {
      "type": "legal_hold_policy_assignment",
      "id": "255473"
    },
    {
      "type": "legal_hold_policy_assignment",
      "id": "255617"
    }
  ],
  "deleted_at": null
}