Is there is an API in P2P Trading to get the bank account details of the user who is buying from me ?

if there is no API what is the best way to automate the buying and selling of trades in P2P

According to the documentation, the only available API is the Get C2C Trade History (User_Data), which does not provide the information you’re looking for.

If you are a verified P2P Merchant, please consider reaching out to the Binance Support team for further assistance: Binance Chat