Magento 2 API supports session-based authentication to secure data transactions between clients and the server. This method allows users to establish a session by logging in with their credentials, and generating a unique session ID.
Visit Here: https://webkul.com/blog/magento2-custom-rest-api/