Segment API issue, how to get customer ID for segment ID

how to find a customer is valid for a discount code
For example

I have created a discount coupon with 4 segments
And now i have a customer ID in hand,
We can loop into all the 4 segments

https://take.ms/E0Dzh

Like this and need to match my customer ID programmatically,

Or Is there any easy quick way to check, if the customer belongs to some segment,
Or any possible way to get all segment id, particular customers added