I am hitting magento 2 swagger UI but getting 500 error Failed to load API definition


2 Answers 2


Please check the network error in the browser if you have something like :

message: "The "array" class doesn't exist and the namespace must be specified. Verify and try again."

it can be related to this issue https://github.com/mundipagg/magento2/issues/137


If you have created custom Magento 2 Rest API, you have to document the API properly ie mention the DOC BLOCK in the interface. Also, you need to verify the return type and input parameter should match the DOC.

For example :

 * Get Register Otp.
 * @param int $mobileNumber
 * @return int
 * @since 101.0.0
public function getRegisterOtp($mobileNumber);
  • great; but somebody knows if there's some way to get a list of the methods with docblock missing? Commented Oct 26, 2020 at 14:16

Your Answer

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

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