Welcome to the new Box Support website. Check out all the details here on what’s changed.

Rename File using Box API

New post

Comments

2 comments

  • Rui Barbosa

    Hi Siddhartha,

    You can make a PUT call to the files API, specifying the name, see here.

    And the curl example:

    curl -i -X PUT "https://upload.box.com/api/2.0/files/12345" \
    -H "Authorization: Bearer <ACCESS_TOKEN>" \
    -H "Content-Type: application/json" \
    -d '{ "name": "New name" }'

    Not sure what tools you are using, but this is implemented both on the CLI and the SDK's

    CLI example:

    ❯ box folders:items 0 --fields type,id,name --csv
    type,id,name
    ...
    folder,169047753928,UI Elements Demo
    file,1039371254466,upload_file.py

    ❯ box files:rename 1039371254466 my_new_uploaded_file.py --fields type,id,name --csv
    type,id,name
    file,1039371254466,my_new_uploaded_file.py

    ❯ box folders:items 0 --fields type,id,name --csv
    type,id,name
    ...
    folder,169047753928,UI Elements Demo
    file,1039371254466,my_new_uploaded_file.py
    0
    Comment actions Permalink
  • Lilly Steinberg

    Hi Rui- Im sorry I am not following.  Help!

    0
    Comment actions Permalink

Please sign in to leave a comment.