Error Codes and Messages
About
Core Principles
1. Separate Machine-Readable and Human-Readable Data
{ "error": "Something went wrong" }{
"errorCode": "ORDER_NOT_FOUND",
"errorMessage": "Order with ID 12345 does not exist."
}2. Use Consistent Code Format
3. Align with HTTP Status Codes
4. Avoid Ambiguous Messages
5. Never Leak Sensitive Data
6. Include a Correlation ID
7. Keep Error Payload Structure Consistent
Error Code Naming Guidelines
Rule
Bad Example
Good Example
Reason
Sample JSON Error Format
Last updated