csrf_token — obtain one from GET /api/security/csrf-token.
Activity Feed
Get filtered activity
GET /api/analytics/filtered-activity
Returns a filtered activity feed of user events for the authenticated user. Use this endpoint to build audit views or personal activity streams.
Required permission: api.analytics.filtered_activity.view
Filter by activity category:
all, page_visits, or actions.AI Analysis
PropOps integrates with Google Gemini to provide AI-assisted analysis of job health, branch performance, and financial data.Trigger AI analysis
POST /api/analytics/ai-analysis
Initiates a Gemini AI analysis. This is the only method — there is no GET variant.
Required permission: api.analytics.ai_analysis
Type of analysis to trigger:
quick_insights— Fast overview of key metrics and anomaliesperformance_deep_dive— In-depth performance analysiscost_optimization— Cost and spend optimisation recommendationsbranch_comparison— Cross-branch comparisonpredictive_trends— Forward-looking trend predictions
Optional scope for the analysis:
jobs, branches, financial, or operational.Period for analysis:
7days, 30days, 90days, 6months, 1year.Optional array of branch IDs to scope the analysis. Omit for platform-wide analysis.
Include AI-generated recommendations in the response.
Optional natural language question to guide the analysis.
CSRF token.
Gemini Usage
This endpoint is restricted to admin accounts only. It provides visibility into AI token consumption for cost management and quota monitoring.
Get Gemini token usage
GET /api/analytics/gemini-usage
Returns token consumption statistics and API call counts for the Gemini integration, broken down by day for the last 30 days.
Required permission: api.analytics.gemini_usage (admin only)
Reports
Financial report
GET /api/reports/financial
Returns job-level financial data grouped by branch, suitable for accountancy review and AI-assisted report generation.
Required permission: page.reports.financial
Optional search string filtered against branch name, address, job ref, and job title.
User report
GET /api/reports/users
Returns user activity and account data for administrative reporting.
Required permission: page.reports.users
Detail table page number.
Detail table page size (max 100).
Optional search against staff name, email, job ref, and job title.
Optional filter by staff account ID.
Branch Performance
Get branch performance metrics
GET /api/analytics/branch-performance
Returns performance scores, rankings, and KPI data for all branches. Supports four views: all branches, top performers, branches needing attention, and side-by-side comparison.
Required permission: api.analytics.branch_performanceAccount types: Staff only
View to return:
all, top, attention, or compare.Maximum branches to return for the
top action.First branch ID for the
compare action.Second branch ID for the
compare action.Start of the metrics window (
YYYY-MM-DD). Defaults to 90 days ago.End of the metrics window (
YYYY-MM-DD). Defaults to today.Compare two branches
GET /api/analytics/branch-performance?action=compare&branch_1=2&branch_2=5
Returns a side-by-side KPI comparison for exactly two branches.
Job Health Check
Get problematic jobs
GET /api/analytics/job-health-check
Automatically detects problematic jobs across eight categories: stuck new orders, overdue quotes, stale quoted jobs, long-running jobs, high cost jobs, cost overrun jobs, missing contractors, and missing certificates. Results help identify jobs that need immediate action.
Required permission: api.analytics.job_health_checkAccount types: Staff only
Filter to a single category. One of:
stuck_new_orders, overdue_quotes, stale_quoted_jobs, long_running_jobs, high_cost_jobs, cost_overrun_jobs, missing_contractors, missing_certificates.Recent Activity
Get recent system activity
GET /api/analytics/recent-activity
Returns a feed of the most recent user and system events — useful for dashboard activity widgets and live audit trails.
Required permission: api.analytics.recent_activity.manageAccount types: Staff only
Number of recent activity items to return (max 100).
Filter activities related to a specific job UUID.
Page Tracking
Track a page view
POST /api/analytics/page-tracking
Records a page view event for the authenticated user. Called automatically by the browser client on every navigation. Not intended for direct integration use.
Required permission: api.analytics.page_tracking.view
Tracking type:
page_visit or user_action.The page path being tracked (e.g.
/jobs). Required for page_visit.Page title. Used with
page_visit.Referrer URL. Used with
page_visit.Client-side action type. Required for
user_action (e.g. button_interaction, form_submission).AI Chat Sessions
List chat sessions
GET /api/analytics/chat-sessions
Returns all AI chat sessions belonging to the authenticated user, ordered by most recently updated. Each session groups a conversation thread with the Gemini AI assistant.
Required permission: api.analytics.chat_sessions
Create a chat session
POST /api/analytics/chat-sessions
Creates a new AI chat session for the authenticated user.
Required permission: api.analytics.chat_sessionsRequires CSRF token.
Display name for the session (e.g. “Branch performance review Q2”). Defaults to
New Chat.CSRF token from
GET /api/security/csrf-token.Update a chat session
PUT /api/analytics/chat-sessions
Updates the display name or active state of an existing chat session.
Required permission: api.analytics.chat_sessionsRequires CSRF token.
ID of the session to update.
New display name (optional).
Set to
true to make this the active session (deactivates all others).CSRF token.
AI Chat Messages
Get messages for a session
GET /api/analytics/chat-messages?session_id=<id>
Returns all messages in a specific AI chat session. Only the owner of the session can retrieve its messages.
Required permission: api.analytics.chat_messages
ID of the chat session.
Save a message
POST /api/analytics/chat-messages
Saves a message to a chat session. Both user and assistant messages are stored this way.
Required permission: api.analytics.chat_messages
ID of the chat session.
Message role:
user or assistant.Message text content.
Credits consumed by this message (applies to assistant messages).
Dashboard & System
Dashboard aggregate stats, chiplets, charts, and job-feed endpoints are documented in the Dashboard API. System health, heartbeat, and maintenance-mode endpoints are documented in the System API.