merge api code.