Dear all,
I would say the API function for achieving this is subsite::pivot_root. I have actually used this function in one of our projects in the past, but it only does half of the job, thus I had to do some afterwork after calling this function. However, I ended up with what I wanted back then, namely having the subsite in question mounted at root.