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
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | Integer | Yes | Unique ID of the file |
Example Requests
- 🐍 Python
- 🌐 Curl
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())1curl "http://www.example.com/api/media/files/123" \
2-H "Authorization: Token <your_api_key>"Response Fields
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the file |
| type | String | File type(Choices) |
| user | Object | User who uploaded the file with id, username, full_name (nullable) |
| f | String | File URL/path |
| name | String | Original filename (nullable) |
| description | String | File description (nullable) |
| size | Integer | File size in bytes (nullable) |
| human_readable_size | String | Human-readable file size (e.g., "2.5 MB", nullable) |
| width | Integer | Image width in pixels (images only, nullable) |
| height | Integer | Image height in pixels (images only, nullable) |
| mode | String | Image color mode (images only, nullable) |
| created_at | String (ISO 8601) | Timestamp when file was uploaded |
| updated_at | String (ISO 8601) | Timestamp when file was last updated |
| thumbnails | List of thumbnail objects | thumbnails of the image |
Thumbnail Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the thumbnail (unique) |
| f | String | URL to access the thumbnail file |
| size | Integer | File size in bytes (nullable) |
*** User Object Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique id of the uploader user |
| username | String | Username of the user |
| full_name | String | Full 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