Retrieves the details about a file.
This operation is performed by calling function getFileById.
See the endpoint docs at API Reference.
await client.files.getFileById(uploadedFile.id, {
queryParams: {
fields: ['is_externally_owned', 'has_collaborations'],
} satisfies GetFileByIdQueryParams,
} satisfies GetFileByIdOptionalsInput);
string
https://*.app.box.com/files/123 the file_id is 123. Example: “12345”GetFileByIdOptionalsInputThis function returns a value of type FileFull.
Returns a file object.
Not all available fields are returned by default. Use the fields query parameter to explicitly request any specific fields.
Updates a file. This can be used to rename or move a file, create a shared link, or lock a file.
This operation is performed by calling function updateFileById.
See the endpoint docs at API Reference.
await client.files.updateFileById(fileToUpdate.id, {
requestBody: {
name: updatedName,
description: 'Updated description',
} satisfies UpdateFileByIdRequestBody,
} satisfies UpdateFileByIdOptionalsInput);
string
https://*.app.box.com/files/123 the file_id is 123. Example: “12345”UpdateFileByIdOptionalsInputThis function returns a value of type FileFull.
Returns a file object.
Not all available fields are returned by default. Use the fields query parameter to explicitly request any specific fields.
Deletes a file, either permanently or by moving it to the trash.
The enterprise settings determine whether the item will be permanently deleted from Box or moved to the trash.
This operation is performed by calling function deleteFileById.
See the endpoint docs at API Reference.
await client.files.deleteFileById(thumbnailFile.id);
string
https://*.app.box.com/files/123 the file_id is 123. Example: “12345”DeleteFileByIdOptionalsInputThis function returns a value of type undefined.
Returns an empty response when the file has been successfully deleted.
Creates a copy of a file.
This operation is performed by calling function copyFile.
See the endpoint docs at API Reference.
await client.files.copyFile(fileOrigin.id, {
parent: { id: '0' } satisfies CopyFileRequestBodyParentField,
name: copiedFileName,
} satisfies CopyFileRequestBody);
string
https://*.app.box.com/files/123 the file_id is 123. Example: “12345”CopyFileRequestBody
CopyFileOptionalsInputThis function returns a value of type FileFull.
Returns a new file object representing the copied file.
Not all available fields are returned by default. Use the fields query parameter to explicitly request any specific fields.
Get the download URL without downloading the content.
This operation is performed by calling function getFileThumbnailUrl.
See the endpoint docs at API Reference.
await client.files.getFileThumbnailUrl(
thumbnailFile.id,
'png' as GetFileThumbnailUrlExtension,
);
string
https://*.app.box.com/files/123 the file_id is 123. Example: “12345”GetFileThumbnailUrlExtension
GetFileThumbnailUrlOptionalsInputThis function returns a value of type string.
When a thumbnail can be created the thumbnail data will be
returned in the body of the response.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.
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.
This operation is performed by calling function getFileThumbnailById.
See the endpoint docs at API Reference.
await client.files.getFileThumbnailById(
thumbnailFile.id,
'png' as GetFileThumbnailByIdExtension,
);
string
https://*.app.box.com/files/123 the file_id is 123. Example: “12345”GetFileThumbnailByIdExtension
GetFileThumbnailByIdOptionalsInputThis function returns a value of type undefined | ByteStream.
When a thumbnail can be created the thumbnail data will be
returned in the body of the response.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.