Get File
Retrieves a file by its ID. This endpoint serves the actual file content.
Endpoint
GET /api/files/:fileId
Authentication
Requires API Key authentication.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
fileId | string | Yes | File ID |
Response
Returns the file content with appropriate content-type headers.
For binary files (images, PDFs), the response is the file itself with headers:
Content-Type: image/jpeg
Content-Disposition: inline; filename="front_damage.jpg"
Example
View in Browser
curl -X GET "https://api.silentwitness.ai/api/files/file_abc123def456" \
-H "X-API-Key: $API_KEY" \
--output front_damage.jpg
Get File Status
To get metadata about a file instead of the file content:
GET /api/files/:fileId/status
curl -X GET "https://api.silentwitness.ai/api/files/file_abc123def456/status" \
-H "X-API-Key: $API_KEY"
Response:
{
"success": true,
"data": {
"id": "file_abc123def456",
"file_name": "front_damage.jpg",
"file_size": 2456789,
"file_type": "image/jpeg",
"status": "ready",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:31:00Z"
}
}
Errors
| Code | Description |
|---|---|
| 401 | Unauthorized - Invalid or missing token |
| 403 | Forbidden - Access denied to this file |
| 404 | File not found |
| 500 | Internal server error |