Skip to main content

Retrieve media file details

Retrieves detailed information about a specific media file by its ID.

HTTP Request

GET/api/media/files/:id

Authorization

Authorization

  • Required: Yes
  • Permission: Staff with FilePermission or Admin
  • Permission Code: 3802
  • 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())

Response Fields

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

Thumbnail Data Structure

FieldTypeDescription
idIntegerUnique ID of the thumbnail (unique)
fStringURL to access the thumbnail file
sizeIntegerFile size in bytes (nullable)

*** User Object Structure

FieldTypeDescription
idIntegerUnique id of the uploader user
usernameStringUsername of the user
full_nameStringFull name of the user (computed value from first and last name)

Example Response (Image)

{
"id": 10,
"type": "image",
"user": {
"id": 1,
"username": "BehroozGhorbani",
"full_name": "بهروز قربانی"
},
"f": "http://127.0.0.1:8000/media/core_media/2025/12/22/Fantasticheskie_kartinki_dlja_monitora_68_68.jpg",
"name": "slipknot member chris fehn",
"description": "some description for image if required",
"size": 1728593,
"human_readable_size": "1.65 MB",
"width": 2560,
"height": 1600,
"mode": "RGB",
"created_at": "2025-12-22T17:43:06.351315Z",
"updated_at": "2025-12-22T17:43:06.351324Z",
"thumbnails": [
{
"id": 313,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_64x64.jpg",
"size": 64
},
{
"id": 314,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_128x128.jpg",
"size": 128
},
{
"id": 315,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_512x512.jpg",
"size": 512
},
{
"id": 316,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_1080x1080.jpg",
"size": 1080
}
]
}

Example Response (Non-Image)

{
"id": 9,
"type": "text",
"user": {
"id": 14,
"username": "Shakira_Anderson47",
"full_name": "بهرام نوروزی"
},
"f": "http://127.0.0.1:8000/media/core_media/2025/12/22/askari.txt",
"name": "textfile",
"description": "",
"size": 1408,
"human_readable_size": "1.38 KB",
"created_at": "2025-12-22T17:29:34.807896Z",
"updated_at": "2025-12-22T17:29:34.807905Z"
}

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
    • Thumbnails are only auto generated for image-type files