Error Codes
Overview
When an error occurs, the API returns a JSON response containing error details. The response includes a general error code and an array of detailed errors. Each detailed error provides specific information about what went wrong.
Error Response Structure
{
"code": "BAD_REQUEST",
"detail": "Bad request. Check documentation if you send all the fields in a proper format.",
"errors": [
{
"details": "The timeslot for the given parameters was not found",
"emr_error": null,
"error_code": "NO_TIMESLOTS_AVAILABLE",
"path": null
}
],
"instance": "d3e84cc1-148a-4edf-9579-5dcef1d6dbfa",
"status": 400,
"title": "Request validation failed",
"type": "https://docs.leyr.io/api/error-handling/bad_request"
}
Note: Multiple detailed errors may be returned in the errors
array. For example, if a request contains an invalid parameter and no available timeslot, both errors will be included in the response.
400 Bad Request
Error Code | Default Description |
---|---|
INVALID_PATIENT_ID | Provided patient_id is not valid |
INVALID_CARE_UNIT_ID | Provided care_unit_id is not valid |
INVALID_HEALTHCARE_SERVICE_ID | Provided healthcare_service_id is not valid |
INVALID_RESOURCE_ID | Provided resource_id is not valid |
INVALID_APPOINTMENT_ID | Provided appointment_id is not valid |
NO_TIMESLOTS_AVAILABLE | No timeslots available for the given parameters |
INVALID_COMMENT_LENGTH | Provided comment is too long |
INVALID_CREATED_BY_ID | Provided created_by_id is not valid |
INVALID_NOTE_CONTENT | Provided content for medical note is not valid |
MISSING_REQUIRED_FIELD | Missing required field in the request |
MAX_ITEMS_EXCEEDED | Max items exceeded |
BAD_INPUT | Invalid input, EHR rejected your request |
PATIENT_ID_LOOKUP_TYPE_NOT_SUPPORTED | EHR does not support patient lookup by the given lookup type |
INVALID_PATIENT_ID_TYPE | Provided patient id type is not valid |
AMBIGUOUS_TIMESLOTS | More than one timeslot found for the given parameters |
NOT_SUPPORTED | Not supported |
BAD_TIME_RANGE | Bad time range. End time must be greater than start time |
MEDICAL_NOTE_MAPPING_BAD_MAPPING | Medical note mapping is not configured correctly for provided template id |
INVALID_PARAMETER | One or more provided parameters are invalid |
INVALID_CONFIRMATION_CODE | Invalid confirmation code for the appointment |
INVALID_POSTAL_CODE | Provided postal code is not valid |
INVALID_COUNTRY | Provided country is not valid |
INVALID_PAGINATION_TOKEN | Provided pagination token is not valid |
INVALID_TEMPLATE_ID | Provided template_id is not valid |
AMBIGUOUS_PATCH_PARAMS | Cannot both reschedule/change and confirm/cancel an appointment in the same request |
INVALID_PATCH_PARAMS | Patch params must include either reschedule/change or confirm/cancel set of parameters |
RESCHEDULE_NOT_POSSIBLE | Rescheduling is not possible for the given appointment |
CANCEL_NOT_POSSIBLE | Cancelling is not possible for the given appointment |
CHANGE_NOT_POSSIBLE | Changing is not possible for the given appointment |
CONFIRMATION_NOT_REQUIRED | The given EHR does not require confirmation for scheduling or canceling the appointment |
AMBIGUOUS_HEALTHCARE_SERVICES | More than one healthcare service found for the given parameters |
AMBIGUOUS_PATIENTS | More than one patient found for the given parameters |
AMBIGUOUS_RESOURCES | More than one resource found for the given parameters |
401 Unauthorized
Error Code | Default Description |
---|---|
BAD_CREDENTIALS | Bad EHR credentials provided for the request |
FAILED_EMR_AUTH | Failed to authenticate with the EHR |
403 Forbidden
Error Code | Default Description |
---|---|
NO_DATA_ACCESS | EHR responded with data access error |
CORRUPTED_OR_INVALID_TOKEN | Auth token you provided is corrupted or invalid |
404 Not Found
Error Code | Default Description |
---|---|
APPOINTMENT_NOT_FOUND | Given appointment couldn't be found in the EHR |
PATIENT_NOT_FOUND | Given patient couldn't be found in the EHR |
CARE_UNIT_NOT_FOUND | Given care unit couldn't be found in the EHR |
RESOURCE_NOT_FOUND | Given resource couldn't be found in the EHR |
INSTANCE_CONFIG_NOT_FOUND | Instance config not found |
HEALTHCARE_SERVICE_NOT_FOUND | Given healthcare service couldn't be found in the EHR |
MEDICAL_NOTE_MAPPING_NOT_FOUND | Medical note mapping not found for provided template id |
409 Conflict
Error Code | Default Description |
---|---|
PATIENT_ALREADY_EXISTS | The EHR reported that the given patient already exists in their records |
500 Internal Server Error
Error Code | Default Description |
---|---|
UNEXPECTED_EMR_CHANGE | There seem to be an unexpected change in the EHR |
501 Not Implemented
Error Code | Default Description |
---|---|
MEDICAL_NOTE_TEMPLATE_NOT_IMPLEMENTED | This medical note template is not implemented for the given EHR |