Skip to main content

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:
Example full URL:

API Versioning

The OpenEyes API uses URL-based versioning. The current version is v1. URL routing is configured to handle the following pattern:
Supported HTTP methods:
  • GET - Retrieve data
  • POST - Create or submit data
  • PUT - 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 in BaseApiController.php: Source reference: protected/modules/Api/controllers/BaseApiController.php:44-50

Headers

Required Headers

Response Headers

All JSON responses include:
Unauthorized responses (401) include:

Error Handling

The API implements consistent error handling through the BaseApiController 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
URL pattern for Request module:

Common Response Patterns

renderJSON Method

All API controllers use the renderJSON() method defined in BaseApiController.php:30-41:
This ensures consistent JSON responses across all endpoints.

Next Steps

Authentication

Learn how to authenticate API requests

Patient API

Search and retrieve patient data

Events API

Manage clinical events and attachments