api refact