Admin API Discount Code By Customer Segment Query

Hi!
I’m trying to make an api request to the shopify admin api, in the request I would like to query for all active discount codes where the customer segments is for a specific customer, and to get that by that customer id, does anyone know if it is possbile or not?

thanks!

To query all active discount codes for a specific customer segment in Shopify Admin API, you can use the price_rules endpoint.

Retrieve all price rules and then filter by customer segment.

Thanks for the fast response! can I already include the price rule in the query instead of filtering once i get the response? how should such a query should look like and how to get discount codes with the price rule indicates thats only 1 specific customer can use it?

Please if you can provide more details it would be of a great help