Error Status

Bayou's API handles errors by sending custom responses that provide valuable insight to developers and guidance on how to fix the error.

In general, 200 HTTP codes correspond to success, 4XX codes are for developer- or user-related failures, and 5XX codes are for Bayou-related issues.

HTTP CodeStatusWhat Bayou uses it for
200OkEverything worked as expected
400Bad requestRequest unacceptable, usually because of a missing parameter
401UnauthorizedNo valid API key provided
403ForbiddenAPI key doesn’t have permission to perform the requested action
404Not FoundThe requested object doesn’t exist
405Method Not AllowedThe request's HTTP method is not supported for this route
409ConflictRequest conflicts with another request, usually related to external_id
415Unsupported Media TypeThe payload format is in an unsupported format
500Server errorIssue on Bayou's side

Error Code Convention

Error codes from Bayou's API follow a standard format. The error object includes the following fields: error_type, error_code, error_message, and docs_url. Below is an example of a 400 error code:

http code 400
{ 
	"error_type": “invalid_input”,
	"error_code": “utility_code_invalid”,
	”error_message”: “The utility code you provided in the request is invalid. Did you mean commonwealth_edison? A full list of utility codes can be found here: https://docs.bayou.energy/reference/utility-support”,
	”docs_url”: “https://docs.bayou.energy/docs/error-codes#utility_code_input_invalid” 
}

Error Types

Below is a list of the error_types in Bayou's API:

error_typeExplanation
invalid_inputAn input error occurs when a request has an invalid or missing parameter.
invalid_requestAn invalid request occurs when a requested route or the requested information doesn’t exist.
auth_errorAn auth error occurs when the API key is missing or doesn’t have permission to perform the requested action.
api_errorAPI errors cover any internal errors that may occur.

What’s Next