Create Report
Create a new accident reconstruction report using uploaded vehicle damage photos, vehicle metadata, and accident context. The API uses machine learning to compute crash dynamics (Delta-V, PDOF, impact type) from the uploaded evidence.
VehicleData Structure
Each vehicle (plaintiff and defendant) includes the following fields:
| API Field | SDK Field | Type | Required | Description |
|---|---|---|---|---|
image_file_ids | ImageFileIds | string[] | Conditional | Vehicle damage photo file IDs (1-20 files). Required if edr_file_id not provided. |
edr_file_id | EdrFileId | string | Conditional | EDR (Event Data Recorder) file ID. Required if image_file_ids not provided. |
vehicle_maker | VehicleMaker | string | No | Vehicle manufacturer (e.g., "Toyota") |
vehicle_model | VehicleModel | string | No | Vehicle model (e.g., "Camry") |
vehicle_year | VehicleYear | string | No | 4-digit year (e.g., "2020") |
vehicle_vin | VehicleVIN | string | No | 17-character Vehicle Identification Number |
vehicle_type | VehicleType | string | No | Vehicle type: "sedan", "suv", "truck", "van", "coupe", "compact", "motorcycle" |
Seatbelt and airbag information is provided per-occupant, not per-vehicle. This allows accurate modeling when different occupants have different safety equipment status (e.g., driver wearing seatbelt but passenger not). See OccupantData structure below for seatbeltWorn and airbagDeployed fields.
At least one of imageFileIds or edrFileId must be provided. You can provide both for more accurate analysis.
Request Parameters
| API Field | SDK Field | Type | Required | Description |
|---|---|---|---|---|
case_id | CaseID | string | Yes | Case ID to associate the report with |
type | Type | ReportType | Yes | Report type: technical_report |
plaintiff | Plaintiff | VehicleData | Yes | Plaintiff vehicle data |
defendant | Defendant | VehicleData | No | Defendant vehicle data (omit for single-vehicle crashes) |
accident_description | AccidentDescription | string | No | Narrative description of the accident |
accident_date | AccidentDate | string | No | Date in YYYY-MM-DD format |
accident_time | AccidentTime | string | No | Time in HH:MM format |
accident_location | AccidentLocation | string | No | Location description or address |
occupants | Occupants | OccupantData[] | No | Occupant data for integrated biomechanics analysis (1-10 occupants) |
Report Types
| Value | Description |
|---|---|
technical_report | Accident reconstruction with crash dynamics |
research_scrutinizer | Not implemented yet |
cross_examination | Not implemented yet |
Computed Fields
The following crash parameters are computed automatically by ML inference from your uploaded evidence. You do not provide these as inputs:
- Delta-V (change in velocity) - Computed from damage patterns or EDR data
- PDOF (Principal Direction of Force) - Inferred from damage location and severity
- Impact Type (frontal, rear, side) - Derived from PDOF angle
- Collision Type - Derived from PDOF angle
- Peak Acceleration - Computed from EDR data when available
Response
Returns:
reportId: The created report identifier
Examples
Basic Two-Vehicle Collision
- Go
- TypeScript
package main
import (
"context"
"fmt"
"log"
"os"
silentwitness "github.com/silentwitness/sw-go-sdk"
)
func main() {
// Create client
client := silentwitness.NewClient(silentwitness.Config{
APIKey: os.Getenv("SW_API_KEY"),
})
defer client.Close()
ctx := context.Background()
// Upload vehicle damage photos first (see Files API)
// plaintiffFileIDs := []string{"file_abc123", "file_def456"}
// Create technical report with explicit type
response, err := client.CreateReport(ctx, &silentwitness.CreateReportParams{
CaseID: "case_xyz789",
Type: silentwitness.ReportTypeTechnicalReport,
Plaintiff: &silentwitness.VehicleDataParams{
ImageFileIds: plaintiffFileIDs,
VehicleMaker: silentwitness.String("Toyota"),
VehicleModel: silentwitness.String("Camry"),
VehicleYear: silentwitness.String("2020"),
VehicleVIN: silentwitness.String("4T1BF1FK5LU123456"),
VehicleType: silentwitness.String("sedan"),
// Seatbelt/airbag data is per-occupant - see OccupantDataParams
},
Defendant: &silentwitness.VehicleDataParams{
VehicleMaker: silentwitness.String("Ford"),
VehicleModel: silentwitness.String("F-150"),
VehicleYear: silentwitness.String("2019"),
VehicleType: silentwitness.String("truck"),
},
AccidentDescription: silentwitness.String("Intersection collision, defendant ran red light"),
AccidentDate: silentwitness.String("2024-03-15"),
AccidentTime: silentwitness.String("14:30"),
AccidentLocation: silentwitness.String("Main St & 5th Ave, Springfield"),
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Report ID: %s\n", response.ReportID)
}
import { SilentWitnessClient } from "@silentwitness/sdk";
const client = new SilentWitnessClient({
apiKey: process.env.SW_API_KEY
});
// Upload vehicle damage photos first (see Files API)
// const plaintiffFileIds = ["file_abc123", "file_def456"];
// Create technical report with explicit type
const response = await client.createReport({
caseId: "case_xyz789",
type: "technical_report",
plaintiff: {
imageFileIds: plaintiffFileIds,
vehicleMaker: "Toyota",
vehicleModel: "Camry",
vehicleYear: "2020",
vehicleVin: "4T1BF1FK5LU123456",
vehicleType: "sedan"
},
defendant: {
vehicleMaker: "Ford",
vehicleModel: "F-150",
vehicleYear: "2019",
vehicleType: "truck"
},
accidentDescription: "Intersection collision, defendant ran red light",
accidentDate: "2024-03-15",
accidentTime: "14:30",
accidentLocation: "Main St & 5th Ave, Springfield"
});
console.log(`Report ID: ${response.reportId}`);
With Integrated Biomechanics Analysis
Include occupant data to automatically generate biomechanics analysis alongside the crash reconstruction:
- Go
- TypeScript
// Technical report with biomechanics for one occupant
response, err := client.CreateReport(ctx, &silentwitness.CreateReportParams{
CaseID: "case_xyz789",
Type: silentwitness.ReportTypeTechnicalReport,
Plaintiff: &silentwitness.VehicleDataParams{
ImageFileIds: plaintiffFileIDs,
VehicleMaker: silentwitness.String("Toyota"),
VehicleModel: silentwitness.String("Camry"),
VehicleYear: silentwitness.String("2020"),
VehicleType: silentwitness.String("sedan"),
},
AccidentDescription: silentwitness.String("Rear-end collision at stoplight"),
AccidentDate: silentwitness.String("2024-03-15"),
// Include occupant for biomechanics analysis
// Seatbelt and airbag data is per-occupant, not per-vehicle
Occupants: []silentwitness.OccupantDataParams{
{
Name: silentwitness.String("Sarah Johnson"),
Age: silentwitness.Int32(42),
Gender: silentwitness.String("female"),
HeightInches: silentwitness.Int32(65), // 5'5"
WeightLbs: silentwitness.Int32(150),
Position: silentwitness.String("driver"),
AllegedInjuries: []string{
"cervical_spine", // Neck injury
"lumbar_spine", // Lower back injury
"shoulder", // Shoulder injury
},
InjurySeverity: silentwitness.String("moderate"),
PreExistingConditions: silentwitness.String("Prior lumbar disc herniation at L4-L5"),
SeatbeltWorn: silentwitness.Bool(true),
AirbagDeployed: silentwitness.String("no"),
Vehicle: silentwitness.String("plaintiff"),
SeatingLocation: silentwitness.String("front-left"),
},
},
})
if err != nil {
log.Fatal(err)
}
// The report includes integrated biomechanics analysis when occupants are provided
fmt.Printf("Technical Report ID: %s\n", response.ReportID)
// Technical report with biomechanics for one occupant
const response = await client.createReport({
caseId: "case_xyz789",
type: "technical_report",
plaintiff: {
imageFileIds: plaintiffFileIds,
vehicleMaker: "Toyota",
vehicleModel: "Camry",
vehicleYear: "2020",
vehicleType: "sedan"
},
accidentDescription: "Rear-end collision at stoplight",
accidentDate: "2024-03-15",
// Include occupant for biomechanics analysis
// Seatbelt and airbag data is per-occupant, not per-vehicle
occupants: [{
name: "Sarah Johnson",
age: 42,
gender: "female",
heightInches: 65, // 5'5"
weightLbs: 150,
position: "driver",
allegedInjuries: [
"cervical_spine", // Neck injury
"lumbar_spine", // Lower back injury
"shoulder" // Shoulder injury
],
injurySeverity: "moderate",
preExistingConditions: "Prior lumbar disc herniation at L4-L5",
seatbeltWorn: true,
airbagDeployed: "no",
vehicle: "plaintiff",
seatingLocation: "front-left"
}]
});
// The report includes integrated biomechanics analysis when occupants are provided
console.log(`Technical Report ID: ${response.reportId}`);
OccupantData Structure (for Biomechanics)
When including occupants for integrated biomechanics analysis:
| API Field | SDK Field | Type | Required | Description |
|---|---|---|---|---|
name | Name | string | No | Occupant name |
age | Age | int32 | Yes | Age in years (1-120) |
gender | Gender | string | Yes | "male", "female", or "other" |
height_inches | HeightInches | int32 | No | Height in inches (e.g., 70 for 5'10") |
weight_lbs | WeightLbs | int32 | No | Weight in pounds |
position | Position | string | Yes | "driver", "front_passenger", "rear_left", "rear_center", "rear_right" |
alleged_injuries | AllegedInjuries | string[] | Yes | At least one injury type (see below) |
injury_severity | InjurySeverity | string | No | "minor", "moderate", "serious", "severe", "critical" |
pre_existing_conditions | PreExistingConditions | string | No | Pre-existing medical conditions |
seatbelt_worn | SeatbeltWorn | boolean | No | Per-occupant seatbelt usage (default: true) |
airbag_deployed | AirbagDeployed | string | No | Per-occupant airbag status: "yes", "no", "partial", "unknown" |
vehicle | Vehicle | string | No | "plaintiff" or "defendant" |
seating_location | SeatingLocation | string | No | "front-left", "front-right", "rear-left", "rear-center", "rear-right" |
Injury Types
head_brain- Traumatic brain injury, concussioncervical_spine- Neck injuries, whiplashthoracic_spine- Upper back injurieslumbar_spine- Lower back injuriesshoulder- Shoulder injurieship- Hip injuriesknee- Knee injuriesfoot_ankle- Foot and ankle injuries
Prerequisites
Before creating a report, ensure the following data exists on the case:
- At least one vehicle with a
plaintiffrole - Vehicle damage photos (
image_file_ids) or an EDR file (edr_file_id) attached to the plaintiff vehicle
If these prerequisites are not met, the API returns a 422 Unprocessable Entity error with a diagnostic message explaining what is missing. For example:
{
"success": false,
"error": "Unable to generate report: no crash analysis data available. No vehicles found on this case. Please add at least one vehicle with either an EDR report (PDF) or damage photos."
}
- Create a case
- Upload vehicle damage photos (via Files API)
- Update the case to create a vehicle and link the uploaded file IDs
- Create the report
Errors
| Code | Description |
|---|---|
INVALID_ARGUMENT | Invalid parameters, missing required fields, or format violations |
UNPROCESSABLE_ENTITY | Case is missing required crash data (no vehicles, photos, or EDR). The error message describes exactly what is missing. |
NOT_FOUND | Case or file not found |
FAILED_PRECONDITION | Files not ready for processing |
RESOURCE_EXHAUSTED | Rate limit exceeded |
UNAUTHENTICATED | Invalid or missing API key |
Next Steps
After creating a report, poll for completion:
- Get Result - Check status and download the PDF when ready