Skip to main content

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

HeaderRequiredDescription
AuthorizationYesBearer <access_token>

Path Parameters

ParameterTypeRequiredDescription
object_namestring (path)YesObject 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

StatusCodeDescription
401UNAUTHORIZEDInvalid or missing authentication token
403FORBIDDENAccess denied - object_name must be within user's folder
404NOT_FOUNDFile 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>"