Manual:$wgAPIMaxDBRows

Details
Maximum amount of rows to scan in a DB query in the API.

The default value is generally fine.