Skip to content

API Reference

Conventions

  • Base URL in local development: http://localhost:3001
  • All application routes live under /api/v1
  • Responses use { data } envelopes for success and { error } for failures
  • Most routes require Supabase bearer auth

Health

MethodPathNotes
GET/healthunauthenticated service health

Tickets

MethodPathPurpose
GET/api/v1/ticketslist tickets with role-aware scoping and filters
POST/api/v1/ticketscreate a new Arabic ticket
POST/api/v1/tickets/bulkbulk ticket operations for agents/admins
GET/api/v1/tickets/by-number/:ticketNumberresolve display number to UUID
GET/api/v1/tickets/:idfetch single ticket
PATCH/api/v1/tickets/:idupdate status, priority, assignee, department
PATCH/api/v1/tickets/:id/routingoverride routing fields
POST/api/v1/tickets/:id/reclassifyrerun classifier
GET/api/v1/tickets/:id/audit-logfetch audit entries

Ticket filters

GET /api/v1/tickets supports:

  • status
  • priority
  • department_id
  • assigned_agent_id
  • routing_mode
  • q
  • created_after
  • created_before
  • page
  • page_size
  • sort_by
  • sort_dir

Comments

MethodPathPurpose
GET/api/v1/tickets/:id/commentslist comments for a ticket
POST/api/v1/tickets/:id/commentsadd a comment

Classifier preview

MethodPathPurpose
POST/api/v1/classifypreview classifier output without creating a ticket

Departments

MethodPathPurpose
GET/api/v1/departmentslist departments

Notifications

MethodPathPurpose
GET/api/v1/notificationspaginated user notifications
PATCH/api/v1/notifications/readmark selected or all notifications as read

Quick actions

MethodPathPurpose
GET/api/v1/quick-actionsrole-authenticated taxonomy-aware quick actions
GET/api/v1/quick-actions/alladmin list of all quick actions
POST/api/v1/quick-actionsadmin create
PATCH/api/v1/quick-actions/:idadmin update
DELETE/api/v1/quick-actions/:idadmin delete

Stats

MethodPathPurpose
GET/api/v1/stats/routingauto/review/manual counts and percentages
GET/api/v1/stats/confidence10-bin confidence histogram
GET/api/v1/stats/taxonomyL1 and L2 classification counts
GET/api/v1/stats/departmentsdepartment totals and override rates
GET/api/v1/stats/workloadper-agent open ticket counts

Admin-only stats utilities

MethodPathPurpose
GET/api/v1/stats/admin/dev-configexpose local classifier and demo config
DELETE/api/v1/stats/admin/ticketsdelete all tickets
POST/api/v1/stats/admin/tickets/reseedgenerate demo tickets
DELETE/api/v1/stats/admin/notificationsdelete all notifications
POST/api/v1/stats/admin/quick-actions/reseedreseed quick action templates

Users

MethodPathPurpose
GET/api/v1/usersagent/admin user listing
GET/api/v1/users/mecurrent profile
PATCH/api/v1/users/meupdate own profile
POST/api/v1/users/inviteadmin invite flow
GET/api/v1/users/:idadmin or self lookup
PATCH/api/v1/users/:id/roleadmin role change
DELETE/api/v1/users/:idadmin deactivation

Auth behavior

The API does not manage sessions itself. It expects a Supabase access token in the Authorization header and derives app authorization from Supabase user metadata.

Built from the current monorepo implementation.