Box Developer Documentation
 
    Latest version

    Create upload session

    post
    https://upload.box.com/api/2.0
    /files/upload_sessions

    This endpoint is in the version 2024.0. No changes are required to continue using it. For more details, see Box API versioning.

    Creates an upload session for a new file.

    Request

    bearer [ACCESS_TOKEN]
    application/json

    Request Body

    stringin bodyrequired
    "Project.mov"

    The name of new file

    integer (int64)in bodyrequired
    104857600

    The total number of bytes of the file to be uploaded

    stringin bodyrequired
    "0"

    The ID of the folder to upload the new file to.

    Response

    application/jsonUpload session

    Returns a new upload session.

    application/jsonClient error

    Returns an error if some of the parameters are missing or not valid.

    • missing_destination: No folder_id was provided
    • invalid_folder_id: folder_id is not valid
    • item_name_invalid: file_name is not valid
    • missing_file_size: file_size was not provided
    • invalid_file_size: file_size was not a valid number
    • file_size_too_small: file_size is below minimum file size for uploads via this API
    • missing_file_name: file_name was not provided
    application/jsonClient error

    Returns an error if the operation is not allowed for some reason.

    • storage_limit_exceeded: Account storage limit reached
    application/jsonClient error

    Returns an error if the parent folder could not be found, or the authenticated user does not have access to it.

    • invalid_parameter: The folder_id value represents a folder that the user does not have access to, or does not exist.
    application/jsonClient error

    Returns an error if the file already exists, or the account has run out of disk space.

    application/jsonClient error

    An unexpected client error.

    post
    Create upload session
    You can now try out some of our APIs live, right here in the documentation.
    Log in

    Request Example

    cURL
    curl -i -X POST "https://upload.box.com/api/2.0/files/upload_sessions" \
         -H "authorization: Bearer <ACCESS_TOKEN>" \
         -H "content-type: application/json" \
         -d '{
           "folder_id": "0",
           "file_size": 104857600,
           "file_name": "Contract.pdf"
         }'

    Response Example

    {
      "id": "F971964745A5CD0C001BBE4E58196BFD",
      "type": "upload_session",
      "num_parts_processed": 455,
      "part_size": 1024,
      "session_endpoints": {
        "abort": "https://{box-upload-server}/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD",
        "commit": "https://{box-upload-server}/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD/commit",
        "list_parts": "https://{box-upload-server}/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD/parts",
        "log_event": "https://{box-upload-server}/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD/log",
        "status": "https://{box-upload-server}/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD",
        "upload_part": "https://{box-upload-server}/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD"
      },
      "session_expires_at": "2012-12-12T10:53:43-08:00",
      "total_parts": 1000
    }