API Endpoints REST API reference for ACM-AI backend — records, extraction, export, chat, and AG-UI endpoints
The ACM-AI backend exposes a FastAPI REST API on port 5055. The Next.js frontend proxies all /api/* requests to this backend. All endpoints return JSON unless otherwise noted.
Method Endpoint Description GET/api/acm/recordsList ACM records with optional filters GET/api/acm/records/{id}Get a single ACM record by ID PUT/api/acm/records/{id}Update an ACM record (e.g. site config fields)
Query Parameters:
Parameter Type Required Description source_idstring Yes Filter records by source document building_idstring No Filter by building room_idstring No Filter by room risk_statusLow | Medium | HighNo Filter by risk level searchstring No Full-text search across all fields pageint No Page number (default: 1) limitint No Records per page (default: 100, max: 1000)
Response:
{
"records" : [ /* ACMRecord[] */ ],
"total" : 533 ,
"page" : 1 ,
"pages" : 6
}
Method Endpoint Description POST/api/acm/extractTrigger ACM extraction for a source document GET/api/acm/extraction-progress/{command_id}/streamSSE stream of real-time pipeline events GET/api/acm/extraction-progress/{command_id}REST polling fallback for current extraction state
Request Body:
{
"source_id" : "source:abc123"
}
Response:
{
"command_id" : "cmd_xyz789" ,
"status" : "queued"
}
Returns a text/event-stream SSE stream. Events follow the AG-UI protocol:
Event Type When Emitted RunStartedPipeline begins StepStartedA pipeline stage begins StateDeltaState update (e.g. new records extracted) ToolCallStartA tool call begins (e.g. MinerU extraction) ToolCallArgsTool call arguments ToolCallEndTool call completes StepFinishedA pipeline stage completes RunFinishedPipeline completes successfully RunErrorPipeline failed
Method Endpoint Description GET/api/acm/export/csvExport records as CSV with all BAR columns GET/api/acm/export/excelExport records as BAR-compliant .xlsx
Query Parameters for export:
Parameter Type Required Description source_idstring Yes Source document to export building_filterstring[] No Limit export to specific buildings
Method Endpoint Description GET/api/acm/statsSummary statistics for dashboard
Response:
{
"total_records" : 533 ,
"by_risk_status" : {
"Low" : 412 ,
"Medium" : 89 ,
"High" : 32 ,
"Very High" : 0
},
"by_building" : [
{ "building_id" : "B00A" , "building_name" : "Admin Block" , "count" : 87 }
],
"by_department" : [
{ "department" : "DHHS" , "count" : 533 }
]
}
Method Endpoint Description GET/api/acm/configGet site configuration for a source POST/api/acm/configCreate or update site configuration
Method Endpoint Description GET/api/acm/field-schemaActive field schema config for dynamic AG Grid column definitions GET/api/acm/mappingsGet field mapping configuration PUT/api/acm/mappingsUpdate field mapping configuration
Method Endpoint Description GET/api/acm/templatesList available BAR templates GET/api/acm/templates/{id}Get a specific BAR template
Method Endpoint Description POST/api/acm/classifyAI classification for Product Group/Type
Method Endpoint Description POST/api/agui/chatAG-UI SSE endpoint for supervisor agent chat
The chat endpoint accepts RunAgentInput and returns an AG-UI compatible SSE event stream. It is consumed by the CopilotKit frontend components.
Method Endpoint Description GET/.well-known/agent.jsonA2A agent card — machine-readable agent capabilities POST/api/a2a/tasksCreate an extraction task via A2A protocol GET/api/a2a/tasks/{id}Get task status
interface ACMRecord {
id : string ;
source_id : string ;
department ?: string ;
agency ?: string ;
sub_agency ?: string ;
site_name ?: string ;
building_id : string ;
building_name : string ;
building_type ?: string ;
building_address ?: string ;
suburb ?: string ;
postcode ?: string ;
area_type : 'Internal' | 'External' ;
level ?: string ;
room_name ?: string ;
location : string ;
product : string ;
friable ?: 'Friable' | 'Non-friable' ;
acm_product_group ?: string ;
acm_product_type ?: string ;
sample_result ?: 'Negative' | 'Positive' | 'Assumed Positive' | 'Assumed Negative' ;
material_condition ?: string ;
disturbance_potential ?: 'Low' | 'Moderate' | 'High' ;
risk_status ?: 'Low' | 'Medium' | 'High' | 'Very High' ;
hygienist_recommendations ?: string ;
assumed_removed ?: string ;
date_of_removal ?: string ;
page_number ?: number ;
extraction_confidence ?: number ;
created_at : string ;
updated_at : string ;
}