Skip to main content

Uploading Evidence

This guide covers everything about uploading files to a case: file categories, auto-linking to vehicles, supported types, and best practices.

How It Works

Every file is uploaded individually via POST /api/files/upload as multipart form-data. You pass:

  • case_id (required) — which case this file belongs to
  • file_category — what type of file it is
  • vehicle_role — which vehicle it belongs to (plaintiff or defendant)

The API automatically links files to the correct vehicle based on vehicle_role. No separate linking step is needed.

File Categories

CategoryVehicle role required?What it does
vehicle_photoYesDamage photo appended to that vehicle's image gallery
edr_documentYesSets as that vehicle's EDR file (replaces previous)
tcr_documentNoCase-level police report, accident fields extracted automatically

Vehicle Photos

Upload 4-8 damage photos per vehicle for best analysis results. Include front, rear, sides, and close-ups of damage areas.

curl -X POST "https://api.silentwitness.ai/api/files/upload" \
-H "X-API-Key: $API_KEY" \
-F "file=@front_damage.jpg" \
-F "case_id=$CASE_ID" \
-F "file_category=vehicle_photo" \
-F "vehicle_role=plaintiff"

Each upload appends to the vehicle's photo gallery. Upload as many as needed.

EDR Documents

Event Data Recorder reports must be PDF files. Each vehicle can have one EDR file — uploading a new one replaces the previous.

curl -X POST "https://api.silentwitness.ai/api/files/upload" \
-H "X-API-Key: $API_KEY" \
-F "file=@edr_report.pdf" \
-F "case_id=$CASE_ID" \
-F "file_category=edr_document" \
-F "vehicle_role=plaintiff"

Traffic Collision Reports (TCR)

Police reports are case-level — do not pass vehicle_role. The API automatically extracts accident details (date, time, location, description) from the PDF during report generation.

curl -X POST "https://api.silentwitness.ai/api/files/upload" \
-H "X-API-Key: $API_KEY" \
-F "file=@police_report.pdf" \
-F "case_id=$CASE_ID" \
-F "file_category=tcr_document"

Supported File Types

TypeMIMEExtensionsUse case
JPEGimage/jpeg.jpg, .jpegVehicle photos
PNGimage/png.pngVehicle photos
GIFimage/gif.gifVehicle photos
WebPimage/webp.webpVehicle photos
PDFapplication/pdf.pdfEDR reports, police reports

The server detects file type from the file's bytes, not the Content-Type header. Unsupported types are rejected with 400 Bad Request.

Constraints

  • Maximum file size: 50MB per file
  • Empty files: Not allowed
  • EDR documents: Must be PDF
  • TCR documents: Do not pass vehicle_role (returns 400 if you do)

Upload Order

Files can be uploaded in any order and in parallel. The only requirement is that the case (and its vehicles) must exist before uploading. Since POST /api/cases creates vehicles in the same request, this is always satisfied.

POST /api/cases                  → creates case + vehicles
POST /api/files/upload (photo 1) ┐
POST /api/files/upload (photo 2) ├─ can run in parallel
POST /api/files/upload (EDR) ┤
POST /api/files/upload (TCR) ┘
POST /api/reports → all files already linked

Response

Each upload returns the file ID and status:

{
"success": true,
"data": {
"file_id": "file_abc123",
"file_name": "front_damage.jpg",
"status": "ready",
"download_url": "https://api.silentwitness.ai/api/files/file_abc123/download",
"url": "https://storage.silentwitness.ai/..."
}
}

You don't need to save or use the file_id — the report workflow automatically picks up all files linked to the case's vehicles.

Common Errors

ErrorCodeResolution
case_id is requiredcase_id_missingInclude case_id in the form data
No file providedfile_missingInclude a file field in the multipart form
File size exceeds maximum limitfile_too_largeFile must be under 50MB
EDR documents must be PDF filesunsupported_file_typeEDR uploads only accept PDF
do not pass vehicle_rolevehicle_index_not_allowedTCR is case-level, remove vehicle_role

Next Steps