Manage Applications

    Create upload session

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

    Creates an upload session for a new file.

    Request

    application/json

    Request Body

    stringin bodyrequired
    Project.mov

    The name of new file

    integer / int64in 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 the file already exists, or the account has run out of disk space.

    You can now try out some of our APIs live, right here in the documentation.
    Log In

    Request Example

    cURL
    curl -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": "Project.mov"
         }'
    Python
    file_size = 26000000
    upload_session = client.file('11111').create_upload_session(file_size)
    print('Created upload session {0} with chunk size of {1} bytes'.format(upload_session.id, upload_session.part_size))
    Node
    // Create a session to upload a 2GB file "huge.pdf" into folder 12345
    client.files.createUploadSession('12345', 2147483648, 'huge.pdf', callback);

    Response Example

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