Split out api code from build