Case States

Every case exists in exactly one state at any moment. State transitions are logged as events. The status field on the case_instances table always reflects the authoritative current state.

State Description SLA Clock Visible In Queue?
open Case created, not yet claimed or assigned to an agent. Visible in the unassigned queue. Running Yes (unassigned queue)
in_progress Claimed by an agent and actively being worked. Agent is completing steps in the current stage. Running Yes (my cases queue)
on_hold Paused pending external input (e.g., waiting for customer to provide documents, waiting for third-party check). SLA can be paused depending on case type configuration. Paused (if configured) Yes (on-hold queue)
escalated Flagged for senior attention — triggered automatically by SLA breach escalation rules or manually by an agent. Appears in the escalations queue for managers. Running Yes (escalations queue)
resolved Successfully completed. All required steps finished, case closed with a resolution. Terminal — cannot be reopened without admin action. Stopped No (archive only)
cancelled Closed without completion — customer withdrew, duplicate detected, or admin cancelled. Terminal — cannot be reopened. Stopped No (archive only)

SLA Status Indicators

Every active case displays a color-coded SLA indicator in the Agent Portal work queue and case list. The indicator is computed in real time based on the SLA deadline stored in cases.sla_deadline.

Indicator Color Condition What It Means
🟢 Green Green More than 25% of SLA time remaining On track. No action required.
🟡 Amber Yellow Less than 25% of SLA time remaining Warning threshold reached. Agent should prioritize this case. Warning notification may have been sent depending on escalation configuration.
🔴 Red Red SLA deadline has passed SLA breached. Escalation action has fired (notify/reassign/advance). Case appears in the manager's breach queue.
⚫ Grey Grey No SLA configured for this case type No SLA applies. Case can remain open indefinitely without triggering alerts.

Case Detail View — 3-Panel Layout

The Agent Portal case detail view is designed for efficient case processing without switching context. The layout adapts to screen size, collapsing to a single-column tabbed view on mobile.

  ┌──────────────────────────────────────────────────────────────────┐
  │  CASE-00042  •  Customer Onboarding  •  in_progress  •  🟡 Amber  │
  │  Assignee: agent1  •  Stage: Review  •  SLA: 4h 23m remaining   │
  ├────────────────┬──────────────────────────┬──────────────────────┤
  │  TIMELINE       │  ACTIVE STEP              │  CASE INFO            │
  │                │                          │                      │
  │  09:12 Submit  │  Step: Identity Review   │  Case Number:        │
  │  [customer1]   │  ─────────────────────   │  CASE-00042          │
  │                │  Full Name               │                      │
  │  09:15 Claimed │  ┌───────────────────┐   │  Case Type:          │
  │  [agent1]      │  │ John Doe          │   │  Customer Onboarding │
  │                │  └───────────────────┘   │                      │
  │  09:18 Note:   │  Date of Birth           │  Submitter:          │
  │  "Called cust" │  ┌───────────────────┐   │  customer1           │
  │  [agent1]      │  │ 1985-06-15        │   │                      │
  │                │  └───────────────────┘   │  Access Group:       │
  │  09:22 Step    │  ID Type                 │  KYC Team            │
  │  completed     │  ┌───────────────────┐   │                      │
  │  [agent1]      │  │ Passport       ▼  │   │  Created:            │
  │                │  └───────────────────┘   │  2026-05-17 09:12    │
  │  [+ Add Note]  │                          │                      │
  │                │  [Complete Step]          │  Linked Cases: 0     │
  └────────────────┴──────────────────────────┴──────────────────────┘

Case Actions

Velaris provides a rich set of actions that can be applied to a case. Each action is role-gated and generates an immutable case_event entry.

Action API Endpoint Who Can Do It What It Does
Claim POST /api/v1/cases/{id}/claim Agent, Manager, Admin Assigns the case to the calling user. Changes status from open > in_progress. Starts SLA clock if not already running.
Reassign PATCH /api/v1/cases/{id}/assign Manager, Admin Reassigns to a different agent. Logs old and new assignee. Does not change case status.
Complete Step POST /api/v1/cases/{id}/complete-step Assigned Agent, Manager, Admin Submits the active step's form data. Merges submitted fields into cases.data JSONB. Advances to next step in stage, or triggers stage transition if all steps complete.
Advance Stage POST /api/v1/cases/{id}/advance Manager, Admin Manually forces stage transition (bypassing guard conditions). Use sparingly — records a "manual advance" event with actor and reason.
Return POST /api/v1/cases/{id}/return Manager, Admin Sends the case back to a previous stage (loopback). Requires a target_stage_id. Only valid if the case type has a loopback transition defined from the current stage.
Escalate POST /api/v1/cases/{id}/escalate Agent, Manager, Admin Changes status to escalated. Notifies the escalation target defined in the case type's SLA config. Appears in manager's escalation queue.
Place on Hold POST /api/v1/cases/{id}/hold Agent, Manager, Admin Changes status to on_hold. Requires a reason. SLA clock is paused if pause_on_hold is configured in the case type's SLA settings.
Resume POST /api/v1/cases/{id}/resume Agent, Manager, Admin Resumes a case from on_hold back to in_progress. Restarts SLA clock if it was paused.
Close / Resolve POST /api/v1/cases/{id}/resolve Agent, Manager, Admin Marks case as resolved. All required steps must be complete unless forced by Manager/Admin. Requires a resolution_summary.
Cancel POST /api/v1/cases/{id}/cancel Manager, Admin Marks case as cancelled. Requires a cancel_reason. Notifies assigned agent. Sends cancellation notification to customer if configured in the case type.
Add Note POST /api/v1/cases/{id}/notes Agent, Manager, Admin Appends an internal note to the case timeline. Notes are not visible to customers by default. Set visible_to_customer: true in the request body to make a note customer-visible.
Link Case POST /api/v1/cases/{id}/links Agent, Manager, Admin Creates a directional relationship to another case. Link types: related_to, blocks, duplicate_of. Linked cases are shown in the Case Info panel sidebar.

Filtering and Sorting

The GET /api/v1/cases endpoint supports a rich set of filter parameters for building custom queues, exports, and analytics queries.

Parameter Type Example Description
status string (enum, comma-separated) status=open,in_progress Filter by one or more case statuses
case_type string (slug) case_type=loan_application Filter by case type slug
assignee string (user ID or me) assignee=me Filter by assigned agent. me uses the caller's user ID.
access_group string (slug) access_group=mortgage-team Filter to cases belonging to a specific access group
sla_status string (enum) sla_status=breached One of green, amber, breached, none
created_after ISO 8601 datetime created_after=2026-05-01T00:00:00Z Filter cases created after this timestamp
created_before ISO 8601 datetime created_before=2026-05-31T23:59:59Z Filter cases created before this timestamp
sort string sort=sla_deadline:asc Sort field and direction. Sortable: created_at, updated_at, sla_deadline, case_number
page / page_size integer page=2&page_size=25 Pagination. Default page_size is 20, maximum is 100.

Bulk Operations

Managers can perform bulk operations on multiple cases simultaneously via the Manager Portal's case list or the API.

API Examples

List cases with filters

# List open and in_progress cases assigned to me, sorted by SLA deadline
curl -s \
  -H "Authorization: Bearer $TOKEN" \
  "http://localhost:8200/api/v1/cases?status=open,in_progress&assignee=me&sort=sla_deadline:asc&page_size=50" \
  | python3 -m json.tool

Complete a step with form data

# Complete the active step on case CASE-00042
curl -s -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "form_data": {
      "full_name": "John Doe",
      "date_of_birth": "1985-06-15",
      "id_type": "passport",
      "id_number": "P123456789"
    }
  }' \
  http://localhost:8200/api/v1/cases/CASE-00042/complete-step

Query breached SLA cases

# All cases with breached SLA, across all case types
curl -s \
  -H "Authorization: Bearer $TOKEN" \
  "http://localhost:8200/api/v1/cases?sla_status=breached&sort=sla_deadline:asc"