Box Developer Documentation
 
    Latest version

    Get file thumbnail

    get
    https://api.box.com/2.0
    /files/:file_id/thumbnail.:extension

    This endpoint is in the version 2024.0. No changes are required to continue using it. For more details, see Box API versioning.

    Retrieves a thumbnail, or smaller image representation, of a file.

    Sizes of 32x32,64x64, 128x128, and 256x256 can be returned in the .png format and sizes of 32x32, 160x160, and 320x320 can be returned in the .jpg format.

    Thumbnails can be generated for the image and video file formats listed found on our community site.

    Request

    bearer [ACCESS_TOKEN]
    application/json

    Path Parameters

    stringin pathrequired
    png

    The file format for the thumbnail

    Value is one of png,jpg

    stringin pathrequired
    12345

    The unique identifier that represents a file.

    The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL https://*.app.box.com/files/123 the file_id is 123.

    Query Parameters

    integerin queryoptional
    320
    32
    320

    The maximum height of the thumbnail

    integerin queryoptional
    320
    32
    320

    The maximum width of the thumbnail

    integerin queryoptional
    32
    32
    320

    The minimum height of the thumbnail

    integerin queryoptional
    32
    32
    320

    The minimum width of the thumbnail

    Response

    image/jpg

    When a thumbnail can be created the thumbnail data will be returned in the body of the response.

    image/png

    When a thumbnail can be created the thumbnail data will be returned in the body of the response.

    none

    Sometimes generating a thumbnail can take a few seconds. In these situations the API returns a Location-header pointing to a placeholder graphic for this file type.

    The placeholder graphic can be used in a user interface until the thumbnail generation has completed. The Retry-After-header indicates when to the thumbnail will be ready. At that time, retry this endpoint to retrieve the thumbnail.

    none

    Returns an error when Box is not able to create a thumbnail for this file type.

    Instead, a Location-header pointing to a placeholder graphic for this file type will be returned.

    application/jsonClient error

    Returns an error if some of the parameters are missing or not valid.

    • requested_preview_unavailable - an incorrect dimension was requested. This will happen if the dimension requested is larger or smaller than the available file sizes for the thumbnail format, or when when any of the size constraints contradict each other.
    application/jsonClient error

    Returned when the access token provided in the Authorization header is not recognized or not provided.

    application/jsonClient error

    Returned if the file is not found, or the user does not have access to the file, or for additional reasons.

    • preview_cannot_be_generated - Box does not support thumbnails for this type of file
    application/jsonClient error

    An unexpected client error.

    get
    Get file thumbnail
    You can now try out some of our APIs live, right here in the documentation.
    Log in

    Request Example

    cURL
    curl -i -X GET "https://api.box.com/2.0/files/12345/thumbnail.png" \
         -H "authorization: Bearer <ACCESS_TOKEN>"