Use the rename method to rename a directory.

try {
  const directoryId = 'directory_id_here' // The ID of the directory to rename.
  const newName = 'new_directory_name' // The new name for the directory.
  await sdk.directory.rename(directoryId, newName)
  console.log(`Directory renamed to: ${newName}`)
} catch (error) {
  console.error(error.message)
}

Params

  • directoryId - The ID of the directory you want to rename.
  • newName - The new name for the directory.

Required API Key Permission

  • Create Directory or Delete Directory