Skip to main content
POST
/
files
/
upload_sessions
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"
     }'
{
  "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://{box-upload-server}/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD",
    "commit": "https://{box-upload-server}/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD/commit",
    "abort": "https://{box-upload-server}/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD",
    "list_parts": "https://{box-upload-server}/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD/parts",
    "status": "https://{box-upload-server}/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD",
    "log_event": "https://{box-upload-server}/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD/log"
  }
}
This endpoint is in the version 2024.0. No changes are required to continue using it. For more details, see Box API versioning.Learn more about Box SDK versioning strategy.

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Body

application/json
folder_id
string
required

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

Example:

"0"

file_size
integer<int64>
required

The total number of bytes of the file to be uploaded.

Example:

104857600

file_name
string
required

The name of new file.

Example:

"Project.mov"

Response

Returns a new upload session.

An upload session for chunk uploading a file.

id
string

The unique identifier for this session.

Example:

"F971964745A5CD0C001BBE4E58196BFD"

type
enum<string>

The value will always be upload_session.

Available options:
upload_session
Example:

"upload_session"

session_expires_at
string<date-time>

The date and time when this session expires.

Example:

"2012-12-12T10:53:43-08:00"

part_size
integer<int64>

The size in bytes that must be used for all parts of of the upload.

Only the last part is allowed to be of a smaller size.

Example:

1024

total_parts
integer<int32>

The total number of parts expected in this upload session, as determined by the file size and part size.

Example:

1000

num_parts_processed
integer<int32>

The number of parts that have been uploaded and processed by the server. This starts at 0.

When committing a file files, inspecting this property can provide insight if all parts have been uploaded correctly.

Example:

455

session_endpoints
Session endpoints · object

A list of endpoints for this session.