Magento 2.0.18 is the final 2.0.x release. After March 2018, Magento 2.0.x will no longer receive security patches, quality fixes, or documentation updates.
To maintain your site's performance, security, and PCI compliance, upgrade to the latest version of Magento.

Generate a local REST API reference

Get more REST API documentation

The REST documentation on the Magento devdocs website is generated with Swagger UI using a schema derived from the latest build of Magento 2. However, the REST API documentation on devdocs is static in that the Magento Developers website is not running an instance of Magento, and there is no live data.

Magento provides two ways to get detailed information about the structure of the REST APIs, as described below.

Generate a full REST API reference locally

The Swagger UI is installed automatically on your server. As a result, you can generate live REST API documentation that can include Magento Commerce modules, third-party modules, and extension attributes that have been installed on your system. To view this documentation, go to:

http://<magento_host>/swagger

By default, Magento returns documentation for resources available to anonymous users. If you specify a valid value in the api_key text box in the upper right corner, Swagger returns documentation for all the APIs the user has access to. To generate an API key, call the POST /V1/integration/customer/token or POST /V1/integration/admin/token as directed in Token-based authentication.

The generated Swagger documentation provides the capability to test REST API requests. A user can enter a sample request, then press the Try it out! button, and Swagger returns information such as a curl command, a request URL, a response body, a response code, and the response header. The Try it out! button will not work unless a bearer authorization token has been specified.

The Try it out! feature is not available on Swagger documentation published on the Magento devdocs website.

Return the JSON schema for one or more services

You can use a REST client to generate the JSON schema for one or more services. In the client, set the method to GET and the URL to

http://<magento_host>/rest/<store_code>/schema?services=<serviceName1,serviceName2,..>

The value of store_code must be one of the following:

  • default
  • The assigned store code
  • all. This value only applies to the CMS and Product modules. If this value is specified, the API call affects all the merchant’s stores.

For example:

http://<magento_host>/rest/default/schema?services=catalogProductRepositoryV1

To return information about all services:

http://<magento_host>/rest/<store_code>/schema

You must specify an authorization token for an admin user to return information for most endpoints. See Token-based authentication for more information.

Return the JSON schema for a specific store in Swagger

Through Swagger it is possible to test the different REST API Calls. By default the resources will be fetched for all storeviews as shown in the example below. To return the JSON Schema for a specific store by adding a store parameter to the url with the store_code of the specific store.

Default Swagger Url: http://<magento_host>/swagger

Fetched JSON schema url: http://<magento_host>/rest/all/schema?services=all


Specified Storecode in Swagger Url: http://<magento_host>/swagger?store=default

Fetched JSON schema url: http://<magento_host>/rest/default/schema?services=all

Token-based authentication

List of REST APIs by module

List of service names permodule