Skip to content

Quality Events API

The Quality Events API manages quality-related events including deviations, Corrective and Preventive Actions (CAPAs), and audit findings. These events integrate with workflows for approval and tracking.

{
"id": "qe_abc123def456",
"type": "deviation",
"number": "DEV-2024-0042",
"title": "Out-of-specification result for Assay test",
"description": "Batch 2024-001 of Magnesium Stearate showed assay result of 97.2%, below the specification of 98.0-102.0%.",
"status": "investigation",
"priority": "high",
"classification": "major",
"category": "laboratory",
"related_entities": [
{
"type": "component",
"id": "ent_component_456",
"name": "Magnesium Stearate"
},
{
"type": "supplier",
"id": "ent_supplier_789",
"name": "Acme Chemicals GmbH"
},
{
"type": "certificate",
"id": "cert_xyz123",
"name": "CoA - Batch 2024-001"
}
],
"root_cause": {
"category": "pending",
"description": null,
"identified_date": null
},
"impact_assessment": {
"products_affected": ["PRD-001", "PRD-002"],
"batches_affected": ["2024-001"],
"patient_impact": "none",
"regulatory_reportable": false
},
"assigned_to": "user_quality_lead",
"due_date": "2024-02-15",
"created_at": "2024-01-20T08:30:00Z",
"updated_at": "2024-01-20T14:00:00Z",
"created_by": "user_lab_analyst"
}
TypeDescription
deviationDeparture from approved procedures or specifications
capaCorrective and Preventive Action
audit_findingFinding from internal or external audit
complaintCustomer or regulatory complaint
change_requestChange control request
StatusDescription
draftInitial creation, not yet submitted
submittedSubmitted for review
investigationUnder investigation
root_cause_identifiedRoot cause determined
action_planningPlanning corrective actions
implementationActions being implemented
verificationVerifying effectiveness
closedEvent closed
rejectedEvent rejected or cancelled
LevelDescription
criticalSignificant impact on product quality or patient safety
majorNotable deviation requiring investigation
minorSmall deviation with limited impact
observationNoted for tracking, no immediate action required
GET /v1/quality-events
ParameterTypeDescription
typestringFilter by event type
statusstringFilter by status
prioritystringFilter by priority
classificationstringFilter by classification
categorystringFilter by category
assigned_tostringFilter by assignee
related_entity_idstringFilter by related entity
due_beforedateEvents due before date
overduebooleanOnly overdue events
Terminal window
curl -X GET "https://api.cohera.io/v1/quality-events?type=deviation&status=investigation&priority=high" \
-H "Authorization: Bearer YOUR_API_KEY"
POST /v1/quality-events
FieldTypeRequiredDescription
typestringYesEvent type
titlestringYesBrief title
descriptionstringYesDetailed description
prioritystringNoPriority level (default: medium)
classificationstringNoEvent classification
categorystringNoEvent category
related_entitiesarrayNoRelated entity IDs
assigned_tostringNoAssignee user ID
due_datedateNoDue date
Terminal window
curl -X POST "https://api.cohera.io/v1/quality-events" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "deviation",
"title": "Out-of-specification result for Assay test",
"description": "Batch 2024-001 of Magnesium Stearate showed assay result of 97.2%, below the specification of 98.0-102.0%.",
"priority": "high",
"classification": "major",
"category": "laboratory",
"related_entities": [
{"type": "component", "id": "ent_component_456"},
{"type": "supplier", "id": "ent_supplier_789"},
{"type": "certificate", "id": "cert_xyz123"}
],
"assigned_to": "user_quality_lead",
"due_date": "2024-02-15"
}'
PATCH /v1/quality-events/{event_id}
Terminal window
curl -X PATCH "https://api.cohera.io/v1/quality-events/qe_abc123" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"root_cause": {
"category": "supplier_quality",
"description": "Supplier process variation led to sub-specification material"
},
"status": "root_cause_identified"
}'

Link a CAPA to an existing deviation.

POST /v1/quality-events/{deviation_id}/capa
Terminal window
curl -X POST "https://api.cohera.io/v1/quality-events/qe_deviation_123/capa" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Implement incoming material testing enhancement",
"description": "Enhance incoming QC testing for Magnesium Stearate to include additional assay verification",
"corrective_actions": [
{
"description": "Reject affected batch 2024-001",
"assigned_to": "user_qc_manager",
"due_date": "2024-01-25"
},
{
"description": "Request supplier investigation report",
"assigned_to": "user_supplier_qual",
"due_date": "2024-02-01"
}
],
"preventive_actions": [
{
"description": "Add duplicate assay testing for critical excipients",
"assigned_to": "user_qc_manager",
"due_date": "2024-03-01"
},
{
"description": "Review supplier qualification criteria",
"assigned_to": "user_supplier_qual",
"due_date": "2024-03-15"
}
],
"effectiveness_criteria": "No OOS results for Magnesium Stearate in 6 months following implementation"
}'

Update the status of individual corrective or preventive actions.

PATCH /v1/quality-events/{capa_id}/actions/{action_id}
{
"status": "completed",
"completion_date": "2024-01-24",
"completion_notes": "Batch 2024-001 rejected and quarantined. Supplier notified.",
"evidence": ["doc_rejection_form_123"]
}
POST /v1/quality-events
{
"type": "audit_finding",
"title": "Incomplete batch record documentation",
"description": "Batch records for Product X missing operator initials on 3 of 15 steps.",
"priority": "medium",
"classification": "minor",
"category": "documentation",
"audit_details": {
"audit_type": "internal",
"audit_date": "2024-01-18",
"auditor": "user_internal_auditor",
"audit_reference": "INT-AUD-2024-005",
"area": "Manufacturing - Building A"
},
"response_due_date": "2024-02-18"
}

Trigger AI analysis to identify affected products and batches.

POST /v1/quality-events/{event_id}/impact-analysis
Terminal window
curl -X POST "https://api.cohera.io/v1/quality-events/qe_abc123/impact-analysis" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"data": {
"event_id": "qe_abc123",
"analysis_timestamp": "2024-01-20T15:00:00Z",
"products_affected": [
{
"id": "ent_product_001",
"name": "Product Alpha 100mg",
"impact_level": "direct",
"reason": "Uses affected component in formulation"
},
{
"id": "ent_product_002",
"name": "Product Beta 50mg",
"impact_level": "indirect",
"reason": "Shares manufacturing equipment"
}
],
"batches_affected": [
{
"batch_number": "2024-001",
"product": "Product Alpha 100mg",
"status": "in_production",
"units": 50000
}
],
"regulatory_impact": {
"reportable": false,
"reason": "No distributed product affected",
"jurisdictions": []
},
"recommended_actions": [
"Quarantine batch 2024-001 pending investigation",
"Review all batches using same material lot",
"Document impact assessment in deviation record"
]
}
}
GET /v1/quality-events/metrics
ParameterTypeDescription
periodstringTime period: 30d, 90d, 1y
group_bystringGrouping: type, category, classification
{
"data": {
"period": "90d",
"summary": {
"total_events": 45,
"open_events": 12,
"closed_events": 33,
"overdue_events": 3,
"average_closure_days": 18.5
},
"by_type": {
"deviation": {"total": 28, "open": 8},
"capa": {"total": 12, "open": 4},
"audit_finding": {"total": 5, "open": 0}
},
"by_classification": {
"critical": 2,
"major": 15,
"minor": 23,
"observation": 5
},
"trends": {
"events_by_week": [
{"week": "2024-W03", "count": 8},
{"week": "2024-W04", "count": 5},
{"week": "2024-W05", "count": 12}
]
}
}
}