Introduction
The OpenEyes API provides programmatic access to patient records, clinical events, and other ophthalmology data. The API follows REST principles and returns JSON-formatted responses. This API enables integration with external systems, diagnostic devices, and third-party applications while maintaining security and data integrity.Base URL
All API endpoints are prefixed with:API Versioning
The OpenEyes API uses URL-based versioning. The current version isv1.
URL routing is configured to handle the following pattern:
GET- Retrieve dataPOST- Create or submit dataPUT- Update existing data
Response Format
All API responses are returned in JSON format with appropriate HTTP status codes.Success Response
Error Response
Error responses include descriptive messages:HTTP Status Codes
The API uses standard HTTP status codes defined inBaseApiController.php:
| Status Code | Message | Description |
|---|---|---|
| 200 | OK | Request successful |
| 401 | Unauthorized | Authentication failed |
| 403 | Forbidden | Insufficient permissions |
| 422 | Unprocessable Entity | Invalid request data |
| 500 | Internal Server Error | Server-side error |
protected/modules/Api/controllers/BaseApiController.php:44-50
Headers
Required Headers
Response Headers
All JSON responses include:Error Handling
The API implements consistent error handling through theBaseApiController class:
- 401 Unauthorized: Invalid or missing authentication credentials
- 403 Forbidden: User lacks required permissions (OprnApi role)
- 422 Unprocessable Entity: Request syntax is valid but contains invalid data
- 500 Internal Server Error: System-level errors
Example Error Response
Rate Limiting
Currently, the OpenEyes API does not implement rate limiting at the framework level. However, administrators should configure rate limiting at the web server or reverse proxy level to prevent abuse.API Modules
The API is organized into modules:Core API Module
- Patient search
- Attachment display
- Digital signatures
Request Module
- External device integration
- Queue management for incoming data
- Event attachment handling
Common Response Patterns
renderJSON Method
All API controllers use therenderJSON() method defined in BaseApiController.php:30-41:
Next Steps
Authentication
Learn how to authenticate API requests
Patient API
Search and retrieve patient data
Events API
Manage clinical events and attachments