Get File Metadata
Sprint 3
Get metadata for a file in storage. Users can only access files under their own folder.
Endpoint
GET /api/v1/storage/objects/{object_name}/metadata
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <access_token> |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
object_name | string (path) | Yes | Object name/path in bucket (must be within user's folder: organizations/{org_id}/files/{user_id}/) |
Response
Success (200)
{
"success": true,
"data": {
"name": "organizations/1/files/123/report_20241203_101500_abc123.csv",
"size": 1024000,
"content_type": "text/csv",
"last_modified": "2024-12-03T10:15:00Z",
"etag": "\"d41d8cd98f00b204e9800998ecf8427e\""
},
"message": "File metadata retrieved successfully"
}
Error Codes
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Invalid or missing authentication token |
| 403 | FORBIDDEN | Access denied - object_name must be within user's folder |
| 404 | NOT_FOUND | File not found or failed to get metadata |
Security
- Users can only access files under their own folder:
organizations/{org_id}/files/{user_id}/ - Path validation prevents directory traversal
- Object name must start with user's allowed path prefix
Features
- Returns file size, content type, last modified date
- ETag for cache validation
- Organization-scoped access control
Example
curl -X GET "https://api.rivergen.com/api/v1/storage/objects/organizations/1/files/123/report_20241203_101500_abc123.csv/metadata" \
-H "Authorization: Bearer <access_token>"
Related Endpoints
- Get Presigned URL - Get presigned URL for file access
- List Files - List user's files with metadata