Hello @Manish Aggarwal ,
Thanks for posting your query on Microsoft Q&A. In order to send a customized message when API is not accessible we could follow https://learn.microsoft.com/en-us/azure/active-directory-b2c/restful-technical-profile#returning-validation-error-message.
In a RESTful technical profile, you may raise a localized error message. Using the claims resolver, you can send a contextual claim
The claims could be sent by localizing the REST API https://learn.microsoft.com/en-us/azure/active-directory-b2c/api-connectors-overview?pivots=b2c-custom-policy#localize-the-rest-api
Please do let me know if you have any queries in the comments section.
Thanks,
Akshay Kaushik
Please "Accept the answer" and "Upvote" if the above-mentioned suggestion works as per your business need. This will help us and others in the community as well.