api with recursion