Cases API
Comprehensive case management from creation to resolution
Overview
The Cases API provides comprehensive case management capabilities including case creation from inquiries, follow-up tracking, status management, contractor assignment, and complete lifecycle management from opening to resolution.
Case Statuses
- open
- in_progress
- pending_customer
- pending_contractor
- resolved
- closed
- cancelled
Full metadata (label, description, color, is_terminal) available via GET /api/cases/meta/statuses.
Priority Levels
- low
- normal
- high
- urgent
Features
- Inquiry linking
- Follow-up tracking
- Tag management
- Contractor assignment
- Rich metadata
- Status audit history
- Transition validation
Note: Cases can be created standalone, from inquiries, or from orders (and are designed to extend to other sources). They support parent-child relationships for follow-up tracking and can be linked to orders, offers, and invoices.
Status engine: case status changes are validated against the shared transitions catalog.
Available transitions can be inspected via GET /api/status-definitions/transitions?entity_type=case.
Status history is written to the shared status package when available, with automatic fallback to the legacy case history table.
| Method | Endpoint | Description | Requirements |
|---|---|---|---|
| Case Management | |||
| POST | /api/cases | Create a new case |
|
| GET | /api/cases/{id} | Retrieve case details by ID |
|
| PUT | /api/cases/{id} | Update an existing case |
|
| DELETE | /api/cases/{id} | Soft delete a case |
|
| POST | /api/cases/{id}/restore | Restore a soft-deleted case |
|
| Case Creation from Sources | |||
| POST | /api/cases/from-inquiry/{inquiryId} | Create a case from an existing inquiry |
|
| POST | /api/cases/{parentCaseId}/follow-up | Create a follow-up case for an existing case |
|
| POST | /api/cases/from-order/{orderId} | Create a case from an existing order |
|
| Case Actions | |||
| POST | /api/cases/{id}/action | Unified endpoint for all case actions (status updates, assignments, tags, etc.) |
|
| Specialized Endpoints | |||
| GET | /api/cases/timeline | Get unified timeline of inquiries and orders by user |
|
| GET | /api/cases/stats | Get case statistics and metrics |
|
| Reference Data | |||
| GET | /api/cases/meta/statuses | Get all case status definitions with rich metadata: key, label, description, color, and is_terminal flag |
|
| GET | /api/cases/meta/priorities | Get list of available priority levels |
|
| Status History | |||
| GET | /api/cases/{id}/history | Get the full status change audit trail for a case, ordered oldest first |
|
| GET | /api/status-definitions/transitions?entity_type=case | Get the shared transition rules that define allowed case status changes |
|
| Case Queries | |||
| GET | /api/cases/list | List cases with filtering and pagination |
|
| GET | /api/cases/customer/{customerId} | Get all cases for a specific customer |
|
| GET | /api/cases/contractor/{contractorId} | Get all cases for a specific contractor |
|
| Statistics & Utilities | |||
| GET | /api/cases/timeline | Get unified timeline of inquiries and orders sorted by date |
|
| GET | /api/cases/stats/overview | Get case statistics and analytics |
|
| GET | /api/cases/statuses/available | Get list of all available case statuses |
|
| GET | /api/cases/priorities/available | Get list of all available priorities |
|
Request Examples
Create New Case
POST /api/cases
Create Case Response
Create Case from Inquiry
POST /api/cases/from-inquiry/42
Create Case from Order
POST /api/cases/from-order/987
Create Follow-up Case
POST /api/cases/15/follow-up
Update Case Status (Unified Action Endpoint)
POST /api/cases/15/action
Resolve Case
POST /api/cases/15/action
Add Tags to Case
POST /api/cases/15/action
Get Case Status Definitions
GET /api/cases/meta/statuses
Returns rich metadata for all 7 case statuses, including display label, description, color, and whether the status is terminal (i.e. no further transitions expected).
Get Case Transition Rules
GET /api/status-definitions/transitions?entity_type=case
Use this endpoint to drive frontend transition pickers and to explain why a transition is or is not allowed.
Get Case Status History
GET /api/cases/15/history
Returns the complete append-only audit trail of all status transitions for a case, ordered oldest first. from_status is null for the initial creation entry.
Get Case Details Response
GET /api/cases/15
List Cases Response
GET /api/cases/list?status=in_progress&priority=high
Unified Timeline Response
GET /api/cases/timeline?user_id=123&per_page=5
Case Statistics Response
GET /api/cases/stats/overview