If your API call doesn't succeed, we will return a JSON object containing details about the error in the following format:

{
  "status" : "401",
  "error" : "invalid_request",
  "message" : "API credentials were not provided.",
  "more_info" : "https://www.prayerletters.com/dev/oauth"
}

All errors will be returned with an appropriate HTTP status code, which is mirrored in the status attribute. Status codes beginning with "4" indicate there's a problem on your end that needs to be fixed. Status codes beginning with "5" indicate there's a problem on our end. If the problem is on our end, our monitoring systems will usually notify us, but you can also contact us with any additional information that might help us understand what's happening.

All errors will also include an error attribute, which is designed to be used by your code to identify the specific error and take appropriate action.

Most errors will include a message attribute, providing more detail about the error and possible troubleshooting steps. This may be appropriate to show to an end-user. We may rewrite the message content without incrementing the API version number, so your code should not take any action based on the message other than to display or store it verbatim.

Some errors will include a more_info attribute, which will contain a URL pointing to the API call's documentation or details about the specific error message.

Specific error responses may also include other attributes to help simplify troubleshooting and debugging.

We recommend that you log the entire JSON response when an error is returned. You can also simply print the body of the response to your screen or log. Our JSON responses include line-breaks, spacing, and indentation to make them easier for humans to read.