Sort by prefix length and take the last. They do appear to be already sorted in your case, but I don't know if that's accidental or guaranteed.
The Netbox data model duplicates prefix information, because every IP address object also stores a prefix length. Given that you're looking for the prefix containing "10.50.130.22/23
", you already know implicitly that it should be 10.50.130.0/23
, without even making any API query.
In practice, I find people wrongly entering "/24" all the time, regardless of the true prefix length - so don't rely on it.