loop with API template code completed