How to delete customer by REST Web API Magento 2?

Customer Delete using REST Web API in Magento 2 comes with URL endpoint  V1/customers/:customerId and DELETE Action.

You need to replace  :customerId in the URL with the actual customer id.

You have to pass Header as Admin Token to delete customers in Magento.

EndPoint URL: <HOST_URL>/rest/V1/customers/:customerId
(Example, http://127.0.0.1/magento243/rest/V1/customers/3 Where 3 is the customer id to delete.)

Action: DELETE

Header: Authorization Bearer <Admin_TOKEN>

Click the link to retrieve Get Admin Token

Payload Body: empty

Response: True/False.

For B2B Magento 2 Company Module,
If the customer is assigned with Company Admin, You cant able to delete it using the given API.
It will throw an error, Cannot delete the company admin. The delete operation has been stopped. Please repeat the action for the other customers.

You need to unassign from the company admin and then you can try to delete that customer.