copy from apiBuilder