Skip to main content

Retrieve File

Retrieves detailed information about a specific file by its ID.

HTTP Request

GET/api/media/files/:id

Authorization

Authorization

  • Required: Yes
  • Permission: Staff or Admin
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Path Parameters

ParameterTypeRequiredDescription
idIntegerYesUnique ID of the file

Example Requests

1import requests
2
3response = requests.get('http://www.example.com/api/media/files/123', 
4  headers={'Authorization': 'Token <your_api_key>'}
5)
6print(response.json())

Status Codes

CodeDescription
200File retrieved successfully
401Unauthorized — authentication required
403Forbidden — insufficient permissions
404File not found
500Internal server error

Response Fields

FieldTypeDescription
idIntegerUnique ID of the file
typeStringFile type (read-only, auto-detected)
userObjectUser who uploaded the file with id, username, full_name
fStringFile URL/path
nameStringOriginal filename
descriptionStringFile description
sizeIntegerFile size in bytes (read-only)
human_readable_sizeStringHuman-readable file size (e.g., "2.5 MB")
widthIntegerImage width in pixels (images only, read-only)
heightIntegerImage height in pixels (images only, read-only)
modeStringImage color mode (images only, read-only)
created_atString (ISO 8601)Timestamp when file was uploaded
updated_atString (ISO 8601)Timestamp when file was last updated

Notes

    • The file ID must exist in the system
    • width, height, and mode fields are only present for image files
    • File type is automatically detected and cannot be modified
    • The user object contains information about who uploaded the file
    • File size is provided in both raw bytes and human-readable format