Use the rename method to rename a file.

try {
  const fileId = 'file_id_here' // The ID of the file to rename.
  const newName = 'new_file_name.txt' // The new name for the file.
  await sdk.file.rename(fileId, newName)
  console.log(`File renamed to: ${newName}`)
} catch (error) {
  console.error(error.message)
}

Params

  • fileId (string): The ID of the file you want to rename.
  • newName (string): The new name for the file.

Required API Key Permission

  • Upload File or Delete File