Core REST API/Reference/Media files/File object

The file object represents a file uploaded to a wiki.

Example

{
  "title": "The Blue Marble.jpg",
  "file_description_url": "//commons.wikimedia.org/wiki/File:The_Blue_Marble.jpg",
  "latest": {
    "timestamp": "2011-12-07T05:11:41Z",
    "user": {
      "id": 811185,
      "name": "Ultimate Roadgeek"
    }
  },
  "preferred": {
    "mediatype": "BITMAP",
    "size": null,
    "width": 599,
    "height": 599,
    "duration": null,
    "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/7/78/The_Blue_Marble.jpg/599px-The_Blue_Marble.jpg"
  },
  "original": {
    "mediatype": "BITMAP",
    "size": 7011595,
    "width": 3000,
    "height": 3002,
    "duration": null,
    "url": "https://upload.wikimedia.org/wikipedia/commons/7/78/The_Blue_Marble.jpg"
  },
  "thumbnail": {
    "mediatype": "BITMAP",
    "size": null,
    "width": 1023,
    "height": 1024,
    "duration": null,
    "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/7/78/The_Blue_Marble.jpg/1023px-The_Blue_Marble.jpg"
  }
}

Schema

title

required string

File title
file_description_url

required string

URL for the page describing the file, including license information and other metadata
latest

required object

Object containing information about the latest revision to the file
Properties
timestamp

string

Last modified timestamp in ISO 8601 format
id

object

Object containing information about the user who uploaded the file
Properties
id

integer

User identifier
name

string

Username
preferred

required object

Information about the file's preferred preview format
Properties
mediatype

string

File type, one of: BITMAP, DRAWING, AUDIO, VIDEO, MULTIMEDIA, UNKNOWN, OFFICE, TEXT, EXECUTABLE, ARCHIVE, or 3D
size

integer

File size in bytes or null if not available
width

integer

Maximum recommended image width in pixels or null if not available
height

integer

Maximum recommended image height in pixels or null if not available
duration

integer

Length of the video, audio, or multimedia file or null for other media types
url

string

URL to download the file
original

required object

Information about the file's original format
Properties
mediatype

string

File type, one of: BITMAP, DRAWING, AUDIO, VIDEO, MULTIMEDIA, UNKNOWN, OFFICE, TEXT, EXECUTABLE, ARCHIVE, or 3D
size

integer

File size in bytes or null if not available
width

integer

Maximum recommended image width in pixels or null if not available
height

integer

Maximum recommended image height in pixels or null if not available
duration

integer

Length of the video, audio, or multimedia file or null for other media types
url

string

URL to download the file
Get file only:
thumbnail

required object

Information about the file's thumbnail format
Properties
mediatype

string

File type, one of: BITMAP, DRAWING, AUDIO, VIDEO, MULTIMEDIA, UNKNOWN, OFFICE, TEXT, EXECUTABLE, ARCHIVE, or 3D
size

integer

File size in bytes or null if not available
width

integer

Maximum recommended image width in pixels or null if not available
height

integer

Maximum recommended image height in pixels or null if not available
duration

integer

Length of the video, audio, or multimedia file or null for other media types
url

string

URL to download the file