Instead of query the database directly is there a way to use the api to retrieve payout info?

The API doesn’t have all needed info for the past periods. It can give an information for the current month.
You can take a look on