Skip to main content

Upload File

Uploads a file to an existing case. Files can be vehicle damage photos or EDR data.

Endpoint

POST /api/files/upload

Authentication

Requires API Key authentication.

Request

This endpoint uses multipart/form-data for file upload.

Form Fields

FieldTypeRequiredDescription
filefileYesThe file to upload
case_idstringYesCase ID to associate the file with
file_categorystringNoFile category (see below)
vehicle_rolestringNoplaintiff (default) or defendant

File Categories

ValueDescriptionAccepted TypesNotes
vehicle_photoVehicle damage photosImagesUpload 4-8 photos for best results
edr_documentEvent Data Recorder (crash data)PDF onlyReplaces previous EDR if one exists
tcr_documentTraffic Collision Report (police report)PDFAccident fields are extracted automatically during report generation

Supported File Types

TypeMIME typeExtensionsUse Case
JPEGimage/jpeg.jpg, .jpegVehicle damage photos
PNGimage/png.pngVehicle damage photos
GIFimage/gif.gifVehicle damage photos
WebPimage/webp.webpVehicle damage photos
PDFapplication/pdf.pdfEDR reports, medical records, other documents

The server determines the file type by inspecting the file's bytes, not by trusting the Content-Type header your client sends. Uploads whose detected type is not in the table above are rejected with 400 Bad Request — the error message includes the detected type so you can tell what happened.

File Constraints

  • Maximum file size: 50MB
  • Empty files: Not allowed
  • Supported types: see the table above. No other types (including HEIC, HEIF, DOC, DOCX, CSV, CDR, or ZIP) are accepted.

Response

Returns the uploaded file information.

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

Example

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

Upload Defendant Vehicle Photo

curl -X POST "https://api.silentwitness.ai/api/files/upload" \
-H "X-API-Key: $API_KEY" \
-F "file=@/path/to/defendant_damage.jpg" \
-F "case_id=case_abc123def456" \
-F "file_category=vehicle_photo" \
-F "vehicle_role=defendant"

Upload EDR File

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

Errors

CodeDescription
400Missing case_id, no file provided, empty file, file too large, EDR not PDF, or vehicle_role passed with tcr_document
401Unauthorized - Invalid or missing token
404Case not found or access denied
500Internal server error

Example Error

{
"success": false,
"error": "case_id is required"
}

Notes

  • Maximum file size: 50MB
  • Files are automatically processed after upload
  • Status changes from processing to ready when complete
  • Empty files are not allowed