I think I understand what you are looking for.
So, a central place where you can list, create, rename or delete all user created tags, does not exist in the box.com app (the normal UI), neither is implemented on the CLI.
This mean we can not just rename TAG-A with TAG-B and be done with it.
You can, however, search by tag, and update the tags. Please do try any of the examples in some sample files and tags first, until you get comfortable with the scripts and are sure you’re not over writing any important tags for you.
I’m also assuming you already have the CLI configured and authorized.
In my examples I’m using the CLI with JWT authentication. This means the CLI is authenticated via a service account and I must use the --as-user flags to interact on behalf of the user who owns the content. I also often include the --csv and --fields flags so the output is shorter and readable on this forum. Finally I’m using zshell (macOS), but these examples can be adapted to use powershell (windows) or bash (linux).
First lets check who the CLI user is:
❯ box users:get --csv --fields type,id,name
### output ###
type,id,name
**user,20130487697,JWT**
and then locate the user who I want the CLI to impersonate (again this may not be applicable to your case)
❯ box users --csv --fields type,id,name
type,id,name
...
user,22240548078,Investment User
user,22240405099,Wealth User
user,22240545678,Wholesale User
**user,18622116055,Rui Barbosa**
In my, case the user I want the CLI to impersonate is –as-user 18622116055
My sample files in the box app look like this:
Please note that if you have just tagged some sample files, the tags are immediately visible in the box app, but the search can take a few minutes to index the recently applied tags.
To search all files with TAG-A:
❯ box search "TAG-A" --as-user 18622116055 \
--content-types tags \
--csv --fields type,id,name
### output ###
type,id,name
file,1016197618492,sample1.heic
file,1016206416109,sample1.cr2
file,1016203876842,023A9785.CR3
Now we can pipe the output of this command to a csv file in order to update all files in bulk:
❯ box search "TAG-A" --as-user 18622116055 \
--content-types tags \
--csv --fields type,id,name > ./files-tag-a.csv
and check the contents of that file (it should be the same as the output)
❯ cat ./files-tag-a.csv
### output ###
type,id,name
file,1016197618492,sample1.heic
file,1016206416109,sample1.cr2
file,1016203876842,023A9785.CR3
Now all we need to do is to update the tags of these files.
Please note that these files only have one tag, and so we can just replace it with the new one. If in your use case, the files have multiple tags, then we would need a different approach, since the next command will replace ALL tags with TAG-B.
❯ box files:update --as-user 18622116055 \
--bulk-file-path ./files-tag-a.csv \
--tags "TAG-B" \
--csv --fields type,id,name,tags
### output ###
[========================================] 100% | 3/3
type,id,name
file,1016197618492,sample1.heic
file,1016206416109,sample1.cr2
file,1016203876842,023A9785.CR3
All bulk input entries processed successfully.
If we look at the box app, all file tags have been replaced:
Again the search will take a few minutes to re-index the newly applied tags:
❯ box search "TAG-B" --as-user 18622116055 --content-types tags --csv --fields type,id,name
### output ###
type,id,name
file,1016197618492,sample1.heic
file,1016206416109,sample1.cr2
file,1016203876842,023A9785.CR3
Back to the files you’ll notice that TAG-A does not exists anymore in the tag list, this is because it is removed if not used in any files.
So at this point we have successfully replaced ALL tags in files that had the TAG-A with TAG-B.