Get File Information

Guides Files Get File Information
Edit this page

Get File Information

To get a file's information, not it's content, call the GET /files/:id API with the id of the file.

cURL
curl -i -X GET "https://api.box.com/2.0/files/12345" \
     -H "Authorization: Bearer <ACCESS_TOKEN>"
Java
BoxFile file = new BoxFile(api, "id");
BoxFile.Info info = file.getInfo();
Python
file_id = '11111'
file_info = client.file(file_id).get()
print('File "{0}" has a size of {1} bytes'.format(file_info.name, file_info.size))
iOS
client.files.get(fileId: "11111", fields: ["name", "created_at"]) { (result: Result<File, BoxSDKError>) in
    guard case let .success(file) = result else {
        print("Error retrieving file information")
        return
    }

    print("File \(file.name) was created at \(file.createdAt)")
}

File ID

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/file/123 the file_id is 123.

Additional fields

To get more of the fields for a file, make sure to pass along the fields query parameter.

Learn about requesting extra fields