Box Developer Documentation

Commit Upload Session

Commit Upload Session

The final step in a chunked upload is to commit the session.

To commit a file upload session, call the POST /files/upload_sessions/:id/commit with a list of uploaded parts to commit.

cURL
curl -i -X POST "https://upload.box.com/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD/commit" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -H "digest: sha=fpRyg5eVQletdZqEKaFlqwBXJzM=" \
     -H "content-type: application/json" \
     -d '{
       "parts": [
         {
           "part_id": "BFDF5379",
           "offset": 0,
           "size": 8388608,
	     "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc"
         },
		     {
           "part_id": "E8A3ED8E",
           "offset": 8388608,
           "size": 1611392,
	     "sha1": "234b65934ed521fcfe3424b7d814ab8ded5185dc"
         }
       ],
       "attributes": {
         "content_modified_at": "2017-04-08T00:58:08Z"
       }
     }'

Additionally, any file attributes can be passed along with the parts to further add information to the file. See the POST /files/content API for more details.

Response

When successful, the API returns a HTTP 201 Created status code with a File object.

In some cases, creating the parts might not be ready yet and the API will return a 202 Accepted status code instead. In this case the application should check the retry-after header and retry committing after the number of seconds specified.