Magento 2.3 Custom Rest Api get size limit

I have made custom API which returns the categories with the products in them like this:
key: Category name

where product is an array:

This was working ok until there were more categories and products. It can still return some small categories meaning with less products but there is a parent category for example which has 3 children categories with 500 products each.
And my question is: Is there a limit somewhere on magento or on the server on the GET call ?