APIs and their error responses should be understandable by humans as well as machine-readable, which means they should be self-descriptive as defined by Roy Fielding.
Stripe API’s error message tells you what went wrong and also tells you how to fix it making it helpful and detailed.
Merge API's API error message is helpful for debugging and logging as well, it allows a user to check and see if a particular resource was unavailable at a specific time.
Instagram's in-depth API error messages are easily understandable and detailed, which makes it helpful for the API's 2 billion monthly active users.
Salesforce API has 14 unique 4xx error messages and three 5xx messages, which lets users know exactly what's going wrong.
Reltio API is a suite of tools for integrating data into one platform, and each connector features its own error codes, giving solutions in case of errors.
API error messages are one of the best manifestations of APIs’ potential in the first place, preventing users from having to consult the API documentation.
API error messages are one of the fastest, simplest, and least expensive ways to boost developer experience and end customer experience.
It is important for API developers to keep API security best practices in mind when crafting API error messages, as sensitive information can result in unauthorized users gaining access to a network.
The right balance of information and security makes for a better experience for everyone involved with an API.