API Error Response Standardization

D

Daniel Okoye

@daniel-okoye

·

Transform inconsistent API error responses into a standardized format.

78 copies0 forks
Standardize this API error response using the examples below.

Examples:
Input: {"error": "user not found"}
Output: {"error": {"code": "USER_NOT_FOUND", "message": "The requested user does not exist", "status": 404}}

Input: {"msg": "invalid token", "code": 401}
Output: {"error": {"code": "INVALID_TOKEN", "message": "The authentication token is invalid or expired", "status": 401}}

Input: {"success": false, "reason": "rate limited"}
Output: {"error": {"code": "RATE_LIMITED", "message": "Too many requests. Please retry after the specified time", "status": 429, "retryAfter": 60}}

Transform this error:
{{error_response}}

Context: {{endpoint_context}}

Details

Category

Coding

Use Cases

API error standardizationError response normalizationAPI consistency improvement

Works Best With

claude-opus-4.5gpt-5.2gemini-2.0-flash
Created Updated Shared

Create your own prompt vault and start sharing