Manual:$wgAPIMaxDBRows

Details
Maximum number of rows to scan in API database queries.

The default value is generally fine.