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:
array(
key: Category name
values:product1,product2,…productX
(

where product is an array:
array(id,price,name,etc)

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 ?