The amount of RAM you need will depend on a number of factors.
In general, the more gateways managed from the device, the more RAM you'll want.
There are multiple processes involved in API usage, but cpm is the primary one.
$FWDIR/log/api.elg may provide other clues for what exactly to monitor as well.
I believe the heap is used to process API calls and may need to be adjusted in some environments.
Of course, if you have heavy API usage, it is highly recommended you upgrade to R81.10 or better, which has a lot of improvements in API performance and stability.
Java is used for a number of things (including the API), so one cannot just monitor Java.