Box Developer Documentation

A beta version of the new Box developer documentation site is launching soon! Updated Developer Guides, modern API Reference, and AI-powered search are on the way to help you build with Box faster. Stay tuned for more updates.

Create Upload Session

Create Upload Session

To create an upload session, call the POST /files/upload_sessions API with the desired file_name and folder_id to put the file in, as well as the file_size of the file to be uploaded.

To create a session for a new version of an existing file, call the POST /files/:id/upload_sessions API instead. In this case, the file_name and folder_id are only required when renaming or moving the file in the process.

Pre-flight Check

Creating an upload session also performs a preflight check, making it unnecessary to do so separately when working with chunked uploads.

Response

When a session is created successfully the response includes an Upload Session that includes a session ID, the number of parts, the part sizes, as well as links to the relevant next API endpoints to use.

{
  "id": "F971964745A5CD0C001BBE4E58196BFD",
  "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/F971964745A5CD0C001BBE4E58196BFD",
    "commit": "https://upload.box.com/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD/commit",
    "abort": "https://upload.box.com/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD",
    "list_parts": "https://upload.box.com/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD/parts",
    "status": "https://upload.box.com/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD",
    "log_event": "https://upload.box.com/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD/log"
  }
}

The upload session defines the size of the parts to use when uploading the individual parts.