Does anybody know any api that could switch the parent and child on the referral partner

what’s the easiest way to swap the parent and child in the referral partner commission program


Referral partner # 1 - is parent
Referral partner # 2 - is child

child may have several parents that need to be associated based on who the parent

is there any api connection that could add automation to it

please let me know

thank you