I am developing a webapi for my custom module. I referred the below article and able to create the basic webapi that will accept arguments from the URL and do some processing.


This is the API i constructed for my module


I want to now implement the authorization. In other words the webapi should work only along with the Authorization bearer token.

How can I do that?

1 Answer 1


Got the answer after few minutes of posting this question.... Magento looks complex but more and more we do I feel its very easy...

  <resource ref="Magento_Customer::group"/>

After I set the above in webapi.xml, now this API can be accessed only whoever having the appropriate permissions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.