What you are asking is basically MinActiveThreshold
as defined here.
// the ere in which you are interested.
const currentEra = ...
// mapping from nominators, to the sum backing that they are providing to different validators.
const assignments: Map<string, BN> = new Map();
// use erasStakersClipped if you want to take into account oversubscription as well.
const stakers = await api.query.staking.erasStakers.entries(currentEra);
stakers.sort((a, b) => a[1].total.toBn().cmp(b[1].total.toBn()))
stakers.map((x) => x[1].others).flat(1).forEach((x) => {
const nominator = (x as PalletStakingIndividualExposure).who.toString();
const amount = (x as PalletStakingIndividualExposure).value;
const val = assignments.get(nominator);
assignments.set(nominator, val ? amount.toBn().add(val) : amount.toBn())
})
/// transform the map to a flat array..
const nominatorStakes = Array.from(assignments);
// .. and sort it..
nominatorStakes.sort((a, b) => a[1].cmp(b[1]));
// .. where the first item will be minimum rewarded.
const minActiveThreshold = nominatorStakes[0][1];