To get started with the REST API in Magento 2, you will need token-based authentication. You will require to create a web service User Role and register that role to a new Magento 2 Admin User. Keep in mind that creating a new role and user is necessary because it’s not a good practice to use Magento Owner User in a web service.
To create a web service role in Magento 2, follow these steps:
Login to the Magento 2 Admin Panel.
Go to System > User Roles and tap the Add New Role
Enter the Role Name.
In Your Password field, enter the current password of your Magento 2 Admin.
Now, on the left side, click Role Resources.
In the Resource Access, select only those that are required for your web service.
Once done, hit the Save Role.
Now, create a new user for the newly created role through these steps:
Go to System > All Users and hit the Add New User
Enter the required information including User Name, First and Last Name, Email, Password, etc.
Now, on the left side, click User Role and select the newly created role.
Once done, click the Save User.
That’s all; now you will use this user to the Magento 2 REST API web service.
For further reference, please go through of the below blog post: