Skip to main content

Create Report

Creates a new report for a case.

Endpoint

POST /api/reports

Request Body

FieldTypeRequiredDescription
case_idstringYesThe ID of the case to generate the report for
typestringYesThe type of report to generate. Currently supported: technical_report
optionsobjectNoOptional configuration for report generation
options.include_biomechanicsbooleanNoWhether to include biomechanics analysis (default: false)
options.use_demo_databooleanNoUse synthetic demo data instead of ML inference (default: false). See below.

Demo Data Option

When use_demo_data is set to true, the system uses pre-generated synthetic crash parameters instead of running the ML inference model. This is useful for:

  • SDK testing: Validate your integration without waiting for ML processing
  • Development environments: Test report generation without a configured ML model
  • Quick demonstrations: Generate reports immediately with realistic sample data

Demo data provides representative delta-v values and crash parameters that produce a valid technical report, but does not reflect actual analysis of uploaded vehicle photos.

Prerequisites

Before creating a report, ensure the case has the required crash data:

  • At least one vehicle must be added to the case
  • Vehicle damage photos or an EDR report (PDF) must be uploaded and linked to the plaintiff vehicle
  • If include_biomechanics is true, occupants must be defined with age, gender, and position

If these prerequisites are not met, the API returns a 422 Unprocessable Entity error with a diagnostic message explaining what is missing.

Request Example

curl -X POST https://api.silentwitness.ai/api/reports \
-H "X-API-Key: sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"case_id": "case_abc123",
"type": "technical_report",
"options": {
"include_biomechanics": true
}
}'

Response

Success (200 OK)

{
"success": true,
"data": {
"id": "rpt_xyz789",
"case_id": "case_abc123",
"type": "technical_report",
"status": "pending",
"progress": {
"message": "Starting analysis..."
},
"output": null,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}

Error (400 Bad Request)

{
"success": false,
"error": "case_id is required"
}
{
"success": false,
"error": "Invalid report type: invalid_type. Supported types: technical_report"
}

Error (422 Unprocessable Entity)

Returned when the case is missing required crash data for report generation:

{
"success": false,
"error": "Unable to generate report: no crash analysis data available. Found 1 vehicle(s) but none have damage photos or EDR data attached. Please upload vehicle damage photos or an EDR report (PDF) to the plaintiff vehicle. No EDR files were detected. If you uploaded an EDR report, it may not have been recognized — ensure it is a valid PDF."
}

Notes

  • The report generation is asynchronous. The response returns immediately with status: "pending".
  • Poll GET /api/reports/:id to check the status and get the final output URLs.
  • For technical_report type, the workflow automatically:
    • Triggers delta-v calculation if vehicle images are available
    • Runs biomechanics analysis if include_biomechanics is true and occupants are defined
    • Generates the final PDF and DOCX reports