Skip to content

API Overview

The API powers the dashboard and any external integrations.

All examples below use the /api prefix.

Auth

POST /auth/login

Authenticates a user and returns a bearer token plus the user profile.

GET /auth/me

Returns the current user.

PATCH /auth/me

Updates the current profile and optional password.

Tickets

POST /tickets

Creates a ticket directly.

{
  "title": "Water leak under sink",
  "description": "Water is pooling under the kitchen sink.",
  "building_id": "building-1",
  "apartment_id": "apartment-12",
  "priority": "high",
  "simulate_fast_sla": true
}

GET /tickets

Lists tickets the current user can access.

GET /tickets/{id}

Returns one ticket, including SLA and media fields.

PATCH /tickets/{id}

Updates title, description, status, priority, or assignment.

PATCH /tickets/{id}/status

Updates only the status field.

DELETE /tickets/{id}

Deletes a ticket when the user has permission.

GET /tickets/export

Exports ticket rows as CSV.

POST /tickets/{id}/force-breach

Forces a ticket into breach state for demo and validation.

{
  "ticket": {
    "id": "ticket-123",
    "sla_status": "breached",
    "escalation_level": 1
  }
}

GET /tickets/sla/breaches

Lists breached tickets.

GET /tickets/sla/escalated

Lists escalated tickets.

Chat

POST /chat

Creates a ticket from a maintenance request or returns a chat reply when the message is not a work order.

{
  "message": "There is a water leak in my bathroom.",
  "apartment_id": "apartment-12",
  "building_id": "building-1"
}

GET /chat/recipients

Lists people available for chat.

GET /chat/conversations

Lists active ticket conversations.

POST /chat/messages

Sends a message into a ticket thread.

GET /tickets/{id}/messages

Returns the message history for one ticket.

SLA

GET /tickets/sla/breaches

Returns breached tickets.

GET /tickets/sla/escalated

Returns escalated tickets.

AI

POST /upload-image

Runs the vision flow on uploaded media and creates a ticket from the result.

PATCH /ai/logs/{id}/feedback

Stores feedback on the AI classification.

GET /ai/status

Returns whether the runtime AI provider is available.

Admin

GET /buildings

Lists buildings.

GET /buildings/{building_id}/apartments

Lists apartments in a building.

GET /technicians

Lists technicians with filters and export support.

GET /technicians/available

Lists currently available technicians.

GET /admin/system-config

Returns the saved system settings payload.

PUT /admin/system-config

Updates SLA, AI, notification, and security settings.

GET /audit-logs

Returns audit history.

GET /metrics/system

Returns ticket, SLA, and AI summary metrics.

AI Logs

PATCH /ai/logs/{id}/feedback

Request:

{
  "actual_category": "Plumbing"
}

Response:

{
  "ai_log": {
    "id": "log-1",
    "ticket_id": "ticket-123",
    "predicted_category": "Plumbing",
    "actual_category": "Plumbing",
    "confidence_score": 0.91,
    "auto_assigned": true,
    "model_version": "SmartEstate-v2.1",
    "created_at": "2026-04-09T10:00:00Z"
  }
}

GET /ai/status

  • Returns whether OpenAI is available in the current runtime.

Notes

  • The backend also exposes the same routes without /api for dashboard compatibility.
  • Protected routes require a valid bearer token.