Try ERPNext Try Frappe Cloud Buy Support Partners Foundation

Rest API - Restrict access via rest api to specific doctype

Since there is an open issue where if a field is hidden for a role, it only hides the field in UI and is accessible through Rest API.

Is there a way to block the doctype itself only for rest api? so that i can implement custom endpoint to access that doctype

AFAIK, there is not such setting for rhat.
But if you want, you can customize frappe api and disable default rest api to specific doctype