Skip to main content
Question

API for BOX version overwrite uploads

  • May 22, 2025
  • 6 replies
  • 47 views

Forum|alt.badge.img

How can I use the BOX upload API to overwrite the version of an existing file?

6 replies

Forum|alt.badge.img

Hi 

You can use this API https://developer.box.com/reference/post-files-id-content/ to upload a new version. You need to know the fileID of the existing version

Best regards, Peter Christensen, Platform Solutions Engineer, Box


Forum|alt.badge.img

363373027287

Thank you for sharing your knowledge.
I tried to implement it with your reference, but the version was updated, but at the same time the contents of the file disappeared.
I am not sure what is causing this.


Forum|alt.badge.img

Not sure what you mean by the contents of the file 'disappeared'?

If you use this API https://developer.box.com/reference/get-files-id-versions/ you should see a list of all file versions and their sizes. If you successfully uploaded a new version with a non-zero byte size it should show in the list

Rgds,
Peter

 


Forum|alt.badge.img

363373027287

I checked the version of the target file from a web browser, and V1 was uploaded successfully after referring to the following URL.
https://ja.developer.box.com/reference/post-files-content/

However, for V2 and later, I tried using the following URL that you shared, but the byte size became 0 and the contents of the file disappeared.
https://developer.box.com/reference/post-files-id-content/

 




Forum|alt.badge.img

Sounds like you are uploading a zero byte file?

This is how I did it in postman
Upload file

BOX1_s1ThUmNZHyOen3EURHS0RA.png

BOX1_pFZxK4zXx7dkmXwwWGwCVA.png

Upload new version using the ID from above

BOX1_SdfmqCmBiwgtQLA5RoLQqQ.png

Result with size (I uploaded same file)

BOX1_27FZJIcUSQmSWjEdJUoq6w.png

From Box UI

BOX1_8TZOkyG_RL2-eRiOoUotUw.png

Rgds,Peter


Forum|alt.badge.img

363373027287

Thanks for the advice.
I reviewed it and it works.
I apologize for the inconvenience.