Rigicon API
← Home API Live
v1.0 Stable · PHP 8.4 · PHPUnit · PHPStan Level 6

API Reference

REST API for the Rigicon Healthcare CRM. All patient data is stored encrypted using AES-256-GCM across two isolated databases. Authenticated endpoints require a JWT Bearer token.

Base URL: https://rigicon.per10.net
POST /api/login

Login

Authenticate with email and password. Returns a JWT token valid for 3600 seconds. Pass this token as a Bearer token in all subsequent requests.

Request Body

FieldTypeRequiredDescription
emailstringrequiredUser email address
passwordstringrequiredUser password
RequestcURL
curl -X POST /api/login \ -H "Content-Type: application/json" \ -d '{ "email": "[email protected]", "password": "secret" }'
Response● 200 OK
{ "status": "success", "token": "eyJhbGciOiJIUzI1NiJ9...", "expires_at": "2026-04-03 14:00:00" }
● 200 Success ● 401 Invalid credentials
GET /api/patients Auth required

List Patients

Returns a paginated list of all non-deleted patients. PII fields (name, email, phone) are decrypted on the fly. Supports full-text search across name and email.

Query Parameters

ParameterTypeDescription
searchstringoptionalFilter by name or email (case-insensitive)
pageintegeroptionalPage number. Default: 1
per_pageintegeroptionalResults per page. Default: 20, Max: 100
Request
curl -X GET \ "/api/patients?search=john&page=1" \ -H "Authorization: Bearer {TOKEN}"
Response● 200 OK
{ "data": [ { "id": "a1b2c3d4...", "name": "John Doe", "email": "[email protected]", "phone": "+1-555-0100", "status": "active", "created_at": "2026-04-03 10:00:00" } ], "total": 1, "page": 1, "per_page": 20 }
● 200 Success ● 401 Unauthorized
POST /api/patients Auth required

Create Patient

Registers a new patient. Name, email and phone are encrypted with AES-256-GCM before storage. The email HMAC hash is stored separately for lookup without decrypting.

Request Body

FieldTypeDescription
namestringrequiredPatient full name. Max 255 chars.
emailstringrequiredValid email address.
phonestringoptionalPhone number in any format.
Request
curl -X POST /api/patients \ -H "Authorization: Bearer {TOKEN}" \ -H "Content-Type: application/json" \ -d '{ "name": "Jane Smith", "email": "[email protected]", "phone": "+1-555-0100" }'
Response● 201 Created
{ "id": "a1b2c3d4e5f6...", "name": "Jane Smith", "email": "[email protected]", "phone": "+1-555-0100", "status": "active", "created_at": "2026-04-03 10:00:00", "deleted_at": null }
Validation Error Response● 422 Unprocessable
{ "errors": ["Name is required", "Invalid email format"] }
● 201 Created ● 422 Validation error ● 401 Unauthorized
GET /api/patients/{id} Auth required

Get Patient

Retrieves a single patient by ID. PII fields are fetched from the PII database and decrypted on the fly. Soft-deleted patients return 404.

Path Parameters

ParameterTypeDescription
idstringrequiredPatient UUID (hex string)
Request
curl -X GET /api/patients/a1b2c3d4 \ -H "Authorization: Bearer {TOKEN}"
Response● 200 OK
{ "id": "a1b2c3d4...", "name": "Jane Smith", "email": "[email protected]", "phone": "+1-555-0100", "status": "active", "created_at": "2026-04-03 10:00:00", "updated_at": "2026-04-03 10:00:00", "deleted_at": null }
● 200 Success ● 404 Not found ● 401 Unauthorized
PUT /api/patients/{id} Auth required

Update Patient

Partially updates a patient record. Only provided fields are updated. PII fields (name, email, phone) are re-encrypted on update. Email hash is recalculated if email changes.

Request Body

FieldTypeDescription
namestringoptionalNew name — re-encrypted
emailstringoptionalNew email — re-encrypted, hash updated
phonestringoptionalNew phone — re-encrypted
statusstringoptionalactive · inactive · archived
Request
curl -X PUT /api/patients/a1b2c3d4 \ -H "Authorization: Bearer {TOKEN}" \ -H "Content-Type: application/json" \ -d '{ "name": "Jane Doe", "status": "inactive" }'
Response● 200 OK
{ "status": "success", "data": { "id": "a1b2c3d4...", "name": "Jane Doe", "status": "inactive", "updated_at": "2026-04-03 11:00:00" } }
● 200 Success ● 404 Not found / soft-deleted ● 422 Validation error ● 401 Unauthorized
DELETE /api/patients/{id} Auth required

Delete Patient

Soft-deletes a patient by setting deleted_at. The patient is excluded from all queries but PII data is retained in the PII database for audit compliance.

Soft Delete Only

Records are never permanently deleted. PII is preserved in rigicon_pii even after deletion.

Request
curl -X DELETE /api/patients/a1b2c3d4 \ -H "Authorization: Bearer {TOKEN}"
Response● 204 No Content
// Empty response body
● 204 Deleted ● 404 Not found ● 401 Unauthorized
GET /api/health

Health Check

No authentication required. Returns server status and PHP version.

Request
curl -X GET /api/health
Response● 200 OK
{ "status": true, "time": 1743673200, "php": "8.4.19" }

Error Reference

StatusMeaningBody
200OKRequested data
201CreatedNew resource
204No ContentEmpty
400Bad Request{"error": "message"}
401Unauthorized{"error": "Unauthorized: Token missing"}
404Not Found{"error": "Patient not found"}
422Validation Error{"errors": ["Name is required"]}