Skip to main content
Version: v0.1.0

API Error Codes

Reference for standard API error codes and responses.

Standard Response Format

All API errors return a standard JSON structure:

{
"timestamp": "2024-01-01T12:00:00Z",
"status": 400,
"error": "Bad Request",
"message": "Invalid input data",
"path": "/api/patients",
"code": "VAL_001",
"details": [
"Email address is invalid"
]
}

HTTP Status Codes

StatusMeaningDescription
200OKRequest succeeded
201CreatedResource created successfully
204No ContentRequest succeeded, no body returned
400Bad RequestClient error (validation, formatting)
401UnauthorizedAuthentication required or failed
403ForbiddenAuthenticated, but no permission
404Not FoundResource does not exist
409ConflictResource conflict (e.g., duplicate email)
422UnprocessableLogic error (valid syntax, invalid instruction)
429Too Many RequestsRate limit exceeded
500Internal ErrorServer-side error

Application Error Codes

Validation Errors (VAL_)

CodeMessageSolution
VAL_001Invalid field formatCheck regex/format requirements
VAL_002Missing required fieldProvide mandatory fields
VAL_003Invalid dateUse ISO-8601 format

Authentication Errors (AUTH_)

CodeMessageSolution
AUTH_001Token expiredRefresh token or re-login
AUTH_002Invalid credentialsCheck username/password
AUTH_003Account lockedContact support

Business Logic Errors (BIZ_)

CodeMessageSolution
BIZ_001Appointment slot takenChoose a different time
BIZ_002Insufficient inventoryCannot prescribe item
BIZ_003Patient already registeredUse existing profile

FHIR OperationOutcome

For FHIR endpoints, errors return an OperationOutcome resource:

{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "value",
"diagnostics": "Invalid MRN format"
}
]
}