Magento 2 API Documentation

Magento 2 uses Swagger to automatically generate documentation for its REST API. You can view a published version on Magento devdocs. What's even better - Swagger is shipped with each installed instance of Magento 2 and you can simply visit to see the API documentation that is relevant to exactly your site.

This is great as it allows us to, for example confirm, that our Extension Attributes show up in the required API responses.

As the API documentation could provide internal implementation details of a site, you first need to authenticate via an api key to obtain access to the full set of endpoints.

The api key to enter could be created via the integrationAdminTokenServiceV1 endpoint or via the below curl command:

curl -X POST '' \
     -H 'Content-Type:application/json' \
     -d '{"username":"admin", "password":"admin123"}'

The returned value then just needs to be pasted into the api_key field and hit apply. We can now start exploring the API endpoints.

Another neat feature is that Swagger allows you to execute the different endpoints directly from the browser to see what the return values are. Use the "Try it out" buttons.

Kristof Ringleff

Kristof Ringleff

Founder and Lead Developer at Fooman

Join the Fooman Community

We send our popular Fooman Developer Monthly email with Magento news, articles & developer tips, as well as occasional Fooman extension updates.