Skip to content
ACM-AI Documentation

API Endpoints

REST API reference for ACM-AI backend — records, extraction, export, chat, and AG-UI endpoints

API 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.

ACM Records

MethodEndpointDescription
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)

GET /api/acm/records

Query Parameters:

ParameterTypeRequiredDescription
source_idstringYesFilter records by source document
building_idstringNoFilter by building
room_idstringNoFilter by room
risk_statusLow | Medium | HighNoFilter by risk level
searchstringNoFull-text search across all fields
pageintNoPage number (default: 1)
limitintNoRecords per page (default: 100, max: 1000)

Response:

{
  "records": [ /* ACMRecord[] */ ],
  "total": 533,
  "page": 1,
  "pages": 6
}

Extraction

MethodEndpointDescription
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

POST /api/acm/extract

Request Body:

{
  "source_id": "source:abc123"
}

Response:

{
  "command_id": "cmd_xyz789",
  "status": "queued"
}

GET /api/acm/extraction-progress/{command_id}/stream

Returns a text/event-stream SSE stream. Events follow the AG-UI protocol:

Event TypeWhen 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

Export

MethodEndpointDescription
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:

ParameterTypeRequiredDescription
source_idstringYesSource document to export
building_filterstring[]NoLimit export to specific buildings

Statistics

MethodEndpointDescription
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 }
  ]
}

Site Configuration

MethodEndpointDescription
GET/api/acm/configGet site configuration for a source
POST/api/acm/configCreate or update site configuration

Field Schema

MethodEndpointDescription
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

BAR Templates

MethodEndpointDescription
GET/api/acm/templatesList available BAR templates
GET/api/acm/templates/{id}Get a specific BAR template

AI Classification

MethodEndpointDescription
POST/api/acm/classifyAI classification for Product Group/Type

Chat (AG-UI)

MethodEndpointDescription
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.

A2A (Agent-to-Agent)

MethodEndpointDescription
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

TypeScript Response Types

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;
}