API Guide
The OwlSure WhatIf API is a REST API that powers the WhatIf Scenario Builder. It manages the full lifecycle of what-if analysis, from authentication and user administration through scenario execution, rate table modifications, KPI profiling, and results retrieval.
All endpoints return JSON and require a Bearer JWT token (except the auth endpoints used to obtain one).
Base URL: https://<your-environment>/api
Authentication
All protected endpoints require the following header:
Authorization: Bearer <access_token>
Tokens are obtained via the Login endpoint and refreshed via Refresh Token.
API Areas
| Area | Description |
|---|---|
| Authentication | Login, logout, token refresh, password management |
| Administration | Users, environments, settings |
| Scenarios | Create, run, and manage what-if scenarios |
| Books of Business | Manage policy books and filters |
| Rate Tables | Browse rate tables and save modifications |
| KPI Profiles | Define and manage KPI dimension mappings |
| Report Configs | Configure analysis report structures |
| Dashboard & Results | Retrieve scenario summaries and analytics |
| Fabric / Power BI | Token acquisition and capacity management |
Authentication Endpoints
These endpoints do not require a Bearer token (except Change Password and Logout).
Login
POST /api/auth/login
Authenticates a user by username or email and password. Returns an access token and a refresh token.
Refresh Token
POST /api/auth/refresh
Issues a new access token from a valid refresh token. The old refresh token is revoked on use (rotation). Call this before the access token expires to maintain a session without re-authenticating.
Logout
POST /api/auth/logout/{id}
Records a logout event for the specified user and invalidates the session server-side.
Forgot Password
POST /api/auth/forgot-password
Initiates a password reset by sending a reset link to the user's registered email. Always returns 200 regardless of whether the email exists, to prevent user enumeration.
Reset Password
POST /api/auth/reset-password
Resets a user's password using a valid, unexpired reset token received via email.
Change Password
POST /api/auth/change-password/{id}
Changes the password for an authenticated user after verifying the current password.
Administration
Admin endpoints manage users, environments, and application-wide settings. These are typically called by administrator roles only.
Users
| Method | Endpoint | Description |
|---|---|---|
GET | /api/admin/users | List all users |
POST | /api/admin/users | Create a user |
GET | /api/admin/users/{id} | Get a user by ID |
PUT | /api/admin/users/{id} | Update a user |
DELETE | /api/admin/users/{id} | Delete a user |
Environments
Environments represent rating engine connections. Each scenario runs against a specific environment.
| Method | Endpoint | Description |
|---|---|---|
GET | /api/admin/environments | List all environments |
POST | /api/admin/environments | Create an environment |
GET | /api/admin/environments/{id} | Get an environment |
PUT | /api/admin/environments/{id} | Update an environment |
DELETE | /api/admin/environments/{id} | Delete an environment |
POST | /api/admin/environments/health-check | Health Check (TCP) |
POST | /api/admin/environments/health-check-v2 | Health Check (HTTP) |
Use the health check endpoints to verify connectivity to a rating engine before running scenarios. The TCP check tests raw port connectivity; the HTTP check calls the engine's /health endpoint.
Settings
| Method | Endpoint | Description |
|---|---|---|
GET | /api/admin/settings | Get all settings |
PUT | /api/admin/settings | Save settings |
Settings control application-wide configuration such as currency.
Scenarios
Scenarios are the core resource of the WhatIf platform. A scenario defines a set of rate table modifications applied to a book of business, which the rating engine then executes to produce comparison results.
Lifecycle
Create → Validate Name → Run (status: Pending → Running → Completed/Failed) → View Results
Endpoints
| Method | Endpoint | Description |
|---|---|---|
GET | /api/Scenarios | List scenarios, filter by user or book |
POST | /api/Scenarios | Create a scenario |
GET | /api/Scenarios/{id} | Get a scenario |
PUT | /api/Scenarios/{id} | Update a scenario |
DELETE | /api/Scenarios/{id} | Delete a scenario |
GET | /api/Scenarios/validate-name | Validate scenario name |
GET | /api/Scenarios/{id}/status | Get scenario status |
PUT | /api/Scenarios/{id}/status | Update scenario status |
GET | /api/Scenarios/{id}/failed-policies | Get failed policies |
Checking Execution Status
Poll GET /api/Scenarios/{id}/status after triggering a run. Possible status values include Pending, Running, Completed, and Failed.
Failed Policies
If a scenario completes with errors, GET /api/Scenarios/{id}/failed-policies returns the list of policies that failed rating during the last execution. Use this to diagnose data or configuration issues.
Books of Business
A book of business is a filtered snapshot of policies used as the input data for a scenario.
| Method | Endpoint | Description |
|---|---|---|
GET | /api/Books | List books, filter by LOB, owner, or state |
POST | /api/Books | Create a book |
DELETE | /api/Books/{id} | Delete a book |
POST | /api/book-filters | Get book filters |
Book Filters
POST /api/book-filters returns the distinct policy field values (e.g. states, coverage types) available for a given line of business and effective date range. Use this to populate filter dropdowns in the UI before creating a book.
Rate Tables
Rate tables define the pricing factors used by the rating engine. The WhatIf platform lets you apply modifications to these tables per scenario without changing the underlying production data.
| Method | Endpoint | Description |
|---|---|---|
GET | /api/RateTables | List all rate tables |
GET | /api/RateTables/modifications/{scenarioId} | Get modifications for a scenario |
POST | /api/RateTables/modifications | Save modifications for a scenario |
How Modifications Work
Modifications are stored per scenario. When the rating engine executes a scenario, it applies the saved modifications on top of the base rate tables. Saving new modifications replaces the previous set for that scenario.
KPI Profiles
KPI profiles define which dimensions (risk attributes) are used to aggregate and display results in reports. Each profile maps report types to specific data dimensions.
| Method | Endpoint | Description |
|---|---|---|
GET | /api/KpiProfiles | List all KPI profiles |
POST | /api/KpiProfiles | Create a KPI profile |
GET | /api/KpiProfiles/by-config/{configId} | Get profiles by report config |
PUT | /api/KpiProfiles/{id} | Update a KPI profile |
DELETE | /api/KpiProfiles/{id} | Delete a KPI profile |
Report Configs
Report configurations define the structure of analysis reports, which risks, coverages, and segments are included. A report config is linked to a scenario and drives how results are presented.
| Method | Endpoint | Description |
|---|---|---|
GET | /api/ReportConfigs | List report configs |
POST | /api/ReportConfigs | Create a report config |
GET | /api/ReportConfigs/{id} | Get a report config |
PUT | /api/ReportConfigs/{id} | Update a report config |
DELETE | /api/ReportConfigs/{id} | Delete a report config |
Dashboard & Results
Dashboard Summary
GET /api/Dashboard/latest-scenario-summary
Returns the latest scenario run summary cards for a user's dashboard, including premium metrics, execution status, and comparison highlights.
→ Get Dashboard Summary reference
User Scenarios
GET /api/Dashboard/user-scenarios
Returns the scenarios associated with a specific user, used to populate the dashboard scenario list.
→ Get User Scenarios reference
Warm Up
POST /api/Dashboard/warm-up
Opens Lakehouse connections to warm up the connection pool. Called fire-and-forget after login so subsequent dashboard queries are fast. No response body is expected.
Fabric / Power BI
These endpoints manage the integration with Microsoft Fabric and Power BI for embedded analytics.
Get Fabric Token
POST /api/fabric/token
Acquires an OAuth2 client-credentials token scoped to the Fabric/Power BI API. The token is used client-side to embed Power BI reports.
Ensure Capacities
POST /api/fabric/ensure-capacities
Checks each resolved Fabric capacity and resumes any that are in a Paused state. Call this before rendering embedded reports to avoid cold-start delays.
Error Responses
All endpoints return standard HTTP status codes. Error responses follow the ProblemDetails schema (RFC 7807):
{
"type": "https://tools.ietf.org/html/rfc7807",
"title": "Not Found",
"status": 404,
"detail": "The requested resource was not found."
}
| Status | Meaning |
|---|---|
200 | Success |
201 | Created |
204 | No Content (success with no body) |
400 | Bad Request, invalid input |
401 | Unauthorized, missing or invalid token |
404 | Not Found, resource does not exist |
409 | Conflict, duplicate resource |
500 | Internal Server Error |