Files
The File and Folder resources allow you to operate on files and folders. While the two resources are similar, they are not exactly the same, so pay close attention to the documentation to ensure that you are operating on the correct resource for the operation you are trying to perform.
Using SDKs for File/Folder Operations
Wherever possible, Files.com SDKs have implemented file operation interfaces that are as idiomatic as possible in your target language. Meaning that operating on a remote file on Files.com is as close as possible to operating on a local file.
We strongly recommend using SDKs for file/folder operations if we have one in your language.
In most cases, our SDKs have built-in support for file transfer acceleration, retries, and idiomatic error handling. Plus the retry handling that is built into our SDKs is tuned for higher performance when using Files.com in conjunction with other cloud providers such as Azure.
If you are going to use the REST API directly for file uploads or downloads, we offer two approaches for you to consider: Optimized file transfers, and Single Stream file transfers.
Optimized file transfers offer the best performance and reliability, but require a lot more work to implement correctly. In an Optimized file transfer, the Files.com API orchestrates data channel connections directly to the underlying file storage, which may either be Files.com's built in storage or a remote server connection. Within the data channel, you may use parallelism and retries.
Our SDKs use the Optimized file transfer approach, and that's why we strongly recommend using SDKs for file operations if we have one in your language. Why rebuild something we've already built?
Single Stream file transfers exist primarily to support API integrations with services where use of our SDK is not realistic or easily achieved. They do not perform as well as Optimized transfers.
In our Single Stream API endpoints, a single HTTPS request/stream is used for each upload or download.
Character Encoding when Using Raw HTTP API
If special characters exist in the path name, you will need to encode them in UTF-8 first, and then
URL encode the bytes. For example, to list the contents of a folder with a complete path of
Engineering Candidates/Résumés, a GET request would be sent to
/folders/Engineering%20Candidates/R%c3%a9sum%c3%a9s.
Download File (Optimized)
In the Optimized download approach, the file is not downloaded directly from the API endpoint. Instead, the API returns a URL that points directly to the underlying storage provider where the file is stored. This allows for maximum performance when downloading files, especially large ones.
The download_uri attribute of the API response contains this URL.
The file contents can then be retrieved by making a GET request to that URL, and Range requests and
parallelism are supported.
Noteworthy
If you are using a Files.com SDK, you do not need to manually implement this process, it's all handled for you by the SDK.
Endpoint
GET/files/{path}
Return Object
File
Authorization Requirement
Available to all authenticated keys or sessions.
Request Parameters
| Parameter | Description |
|---|---|
| path string Required | Path to operate on. |
| preview_size string | Request a preview size. Can be small (default), large, xlarge, or pdf. |
| with_previews boolean | Include file preview information? |
| with_priority_color boolean | Include file priority color information? |
| with_direct_connection_info boolean | Include optional direct connection information for a direct Agent transfer attempt? |
Download File (Single Stream)
A single stream file download returns the contents of any file as the raw body of the HTTPS response. This approach is slower than an optimized download because it does not use any parallelism and retries typically require re-downloading the entire file.
This approach is recommended when use of our SDKs is not pratical for a given application and when performance and reliability are not major concerns.
Endpoint
GET/file_contents/{path}
Return Object
Returns file contents as the raw HTTPS request stream.
Authorization Requirement
Available to all authenticated keys or sessions.
Upload File (Optimized)
In the Optimized Upload approach, the file is not uploaded directly to the API endpoint. Instead, you perform the following series of steps:
- Start a new upload by sending a request to REST API to indicate intent to upload a file.
- Upload the file contents to the URL(s) provided in the API response, via multiple uploads with parallelism and independent retries.
- Complete the upload by notifying the REST API that the file upload has completed.
When completing the upload, send size as the total file size in bytes, including all parts of a
multipart upload. Files.com trusts this client-reported value and records it as the file's size
without verifying it against the uploaded bytes. Your client is responsible for reporting the
correct size.
Noteworthy
If you are using a Files.com SDK, you do not need to manually implement this process, it's all handled for you by the SDK.
The Upload Object
| Attribute | Description |
|---|---|
| ref string | Unique identifier to reference this file upload. This identifier is needed for subsequent requests to the REST API to complete the upload or request more upload URLs. |
| http_method string | The HTTP method to use when sending file data to upload_uri, usually PUT or POST. |
| upload_uri string | The URL where the file is uploaded to. |
| partsize integer | Size in bytes to use for this part in a server-managed plan. A client-side plan may choose a different size only when the backend and returned upload instructions permit it. |
| next_partsize integer | Size in bytes recommended for the next part in a server-managed plan. |
| part_number integer | Number of this part, starting at 1 for a new upload. S3 part numbers are limited to 1 through 10,000; that limit does not apply to remote server integration or Files Agent uploads. |
| available_parts integer | Part availability reported by the backend. Respect the returned constraints when requesting upload URLs; do not apply S3's 10,000-part limit to every backend. |
| parallel_parts boolean | If true, parts may be uploaded in parallel. Otherwise, upload one part at a time, in order. |
| retry_parts boolean | If true, a failed part may be retried. Otherwise, restart the upload after a failed part. |
| expires string | Expiration time of this upload URL. Request a replacement URL if it expires. |
| direct_connection_info object | Optional Files Agent or remote server integration connection information, requested with with_direct_connection_info=true. It can identify the backend for part planning; file data still follows the returned upload instructions. |
| headers key-value pairs | A list of required headers and their exact values to send in the file upload. It may be empty if no headers with fixed values are required. |
| parameters key-value pairs | A list of required parameters and their exact values to send in the file upload. If any values are in this array, it is implied that the upload request is formatted appropriately to send form data parameters. It will always be empty if the body of the request is specified to be where the file upload data goes (see send below). |
| send key-value pairs | This is an array of values to be sent in the file upload request. Possible sub-values are partsize, partdata, file, and Content-Type:
Possible values for these parameters:
|
| path string | Intended destination path of the file upload. Path may change upon finalization, depending on existence of another upload to the same location and the site's overwrite setting. |
| action string | Value is always write or put for this action. |
| ask_about_overwrites boolean | If true, a file by this name already exists and will be overwritten when this upload completes if it continues. |
Server-Managed Part Sizes
For a simple custom client, let Files.com size the parts. This also works when the total size is not known before reading the file.
- Start the upload, including
sizewhen the total byte count is known. - Read up to the returned
partsizebytes and upload that part. The final part contains the remaining bytes and may be smaller. - If bytes remain, request the next part's instructions
using the same destination path and
ref, and the nextpartnumber. Use the returned size and repeat until all bytes have been sent. Trust the API's backend-specific part plan rather than rejecting every upload that exceeds 10,000 parts. - Complete the upload after every part succeeds, reporting the exact total bytes sent.
This recipe is easier to implement, but waiting for the API to choose each next part's size adds round trips. For higher throughput, prefer client-side part planning with batched URL requests and parallel data uploads when the returned instructions allow them.
Client-Side Part Planning
For a file with a known size, a client can plan its byte ranges before uploading them:
- Start with POST
/file_actions/begin_upload/{path}, supplyingsizeandwith_direct_connection_info=true. Identify remote server integration and Files Agent destinations from the returneddirect_connection_info; otherwise, plan as S3. Files.com-managed S3 and customer-owned S3 buckets use the same part limits, even when their bucket names, credentials, or URLs differ. - Check that
send,headers, andparameterspermit the planned part sizes and bytes. Backend classification does not override these instructions or any signed length or checksum. If the instructions require server-selected sizes, use the server-managed recipe. - Choose a part size that bounds memory use and the bytes resent on a retry. For S3, choose at
least
max(5 MiB, ceil(size / maximum_parts)), wheremaximum_partsis 10,000, reduced when the API supplies a smaller positive part budget. Each part must be at most 5 GiB; only the final part may be smaller than 5 MiB. See S3 multipart upload limits. Remote server integration and Files Agent uploads do not inherit these S3 part-size or part-count limits. Files.com and destination file-size limits still apply separately. - Number the ranges consecutively from 1. For a fixed part size, each range starts at
(part_number - 1) * part_sizeand containsmin(part_size, size - offset)bytes. For the remote server integration and Files Agent offset protocol, setpart_numberand zero-basedpart_offsetin the upload URL query, replacing any existingpartNumber/offsetaliases. Preserve every other encoded query parameter, signature, authentication value, header, and body instruction. Use S3 URLs exactly as returned; do not add these offsets or replace their signed part numbers. - Request upload URLs in batches and prefetch the next batch
while data uploads are running. Match every returned instruction to its
part_numberand keep the same destination path andref. Upload with bounded concurrency only whenparallel_partsis true; otherwise, send the parts one at a time, in order. - Keep each part's number, byte offset, length, and returned ETag until completion. A retried part must use the same number and bytes, including after URL renewal. Local planning still requires the Files.com API for upload setup, authentication, upload URLs, and finalization.
Starting a New Upload
The first request to upload a new file is a POST request to /files/PATH_AND_FILENAME.EXT with
an action parameter with the value of put.
Include size when known so Files.com can plan for the full file.
Endpoint
POST/files/{path}
Uploading the File or File Parts
Send the file data to the returned upload_uri using http_method and the exact headers,
parameters, and send instructions from Files.com. For a raw-body upload, send only the bytes
for that part and set Content-Length to their exact count when instructed. The PUT example below
illustrates that form; other instructions may require POST or form data.
Use the URL before its returned expires time. Preserve its signature and authentication
parameters. Record the ETag response header, when supplied, as an opaque value associated with
this part number; do not derive it from the bytes or treat it as a file checksum.
S3 requires multiple parts when a part would exceed 5 GiB. Other backends follow their own upload
instructions. Request additional URLs as described below. Retry a failed data upload only when
retry_parts allows it, retaining the same part number, offset, and bytes.
Requesting Additional Upload URLs
Once an upload has been opened and before it is completed, additional upload URLs can be requested from the REST API. Send a POST request to /files/PATH_AND_FILENAME.EXT with parameter action set to put, parameter ref set to the reference ID returned at the start of the upload, and parameter part set to the part number the upload URL should refer to. The part number can be the same as one previously used if a new URL is required, either because the part is to be re-uploaded or because a prior upload attempt failed and the prior URL's signature has expired.
For batched instructions, use POST /file_actions/begin_upload/{path} with ref, part
(the first part number), and parts (the requested batch count), omitting action. This endpoint
returns an array of upload instructions. It also starts a new upload when ref is omitted;
include size when known and with_direct_connection_info=true to request backend information.
Keep requesting the same destination path and ref throughout an upload, including URL renewal.
Check the returned part numbers and expiration times before scheduling their bytes.
Endpoint
POST/files/{path}
Completing an Upload
After uploading the file to the file storage environment, the REST API needs to be notified that the
upload was completed. This is done by sending another POST request to
/files/PATH_AND_FILENAME.EXT with parameter action set to end and parameter ref set to the
reference ID returned at the start of the upload. Include size with the total file size in bytes.
When the data uploads return ETags, include every part's ETag in an etags array, ordered by part
number, with entries such as {"part": 1, "etag": "ETAG_FROM_PART_1"}. Preserve each returned ETag
exactly. Destinations that return no ETags do not require that array; a mix of parts with and
without ETags is not a complete set for finalization.
If the completion request's response is lost or an error leaves the outcome uncertain, reconcile the destination's content and metadata with the intended file before deciding whether to retry completion or start another upload. A file already existing at that path does not prove this upload succeeded. Finalization can consume the upload reference, so repeating it blindly can report an already completed upload as missing. If the outcome cannot be determined, do not automatically repeat finalization or re-upload the file.
Custom Metadata
Custom metadata map to save when action=end completes the upload. Replaces existing metadata; an empty map clears it. No separate metadata-edit permission is required. Supported on native files and configured remote mounts, excluding remote server automount paths. Limited to 32 keys, 256 characters per key and 1024 characters per value.
Include custom_metadata alongside the upload's ref and any other required completion fields.
Sending metadata only when starting the upload does not save it. Later metadata edits follow the
Custom Metadata permission rules.
Files.com stores custom metadata separately from the remote provider's native metadata fields,
which it leaves unchanged.
Configured Remote Server Mounts support it with indexing enabled or disabled. The automount
restriction applies to virtual _/RemoteServers/ paths, which do not store custom metadata.
With Buffered Uploads, Files.com confirms completion after receiving the file and its metadata. Files.com then delivers the file to the Remote Server in the background and retains the metadata after delivery.
Files.com validates metadata before completing the upload. If the metadata is invalid, correct it
and resend the completion request with the same ref while that upload reference remains valid.
For remote uploads without buffering, Files.com writes the file before saving its metadata. A later completion error can leave the file at the destination without its metadata. Check the destination file and its Custom Metadata in Files.com before retrying completion or starting another upload. If your account cannot view the file, ask a Site Administrator to check it. Repeating completion does not guarantee that the missing metadata will be saved.
Endpoint
POST/files/{path}
Upload File (Single Stream)
A single stream file upload is a single POST request sent to the API with the file content included as the request body. This approach is slower than an optimized upload because it does not use any parallelism and retries typically require re-uploading the entire file.
This approach is recommended when use of our SDKs is not pratical for a given application and when performance and reliability are not major concerns.
Endpoint
POST/file_contents/{path}
Return Object
No return value.
Authorization Requirement
Available to all authenticated keys or sessions.
Find File/Folder by Path
Endpoint
GET/file_actions/metadata/{path}
Return Object
File
Authorization Requirement
Available to all authenticated keys or sessions.
Request Parameters
| Parameter | Description |
|---|---|
| path string Required | Path to operate on. |
| preview_size string | Request a preview size. Can be small (default), large, xlarge, or pdf. |
| with_previews boolean | Include file preview information? |
| with_priority_color boolean | Include file priority color information? |
List Folders by Path
For historical reasons, and to maintain compatibility with a variety of other cloud-based MFT and EFSS services, Folders will always be listed before Files when listing a Folder. This applies regardless of the sorting parameters you provide. These will be used, after the initial sort application of Folders before Files.
Endpoint
GET/folders/{path}
Return Object
File[]
Authorization Requirement
Available to all authenticated keys or sessions.
Request Parameters
| Parameter | Description |
|---|---|
| path string Required | Path to operate on. |
| preview_size string | Request a preview size. Can be small (default), large, xlarge, or pdf. |
| search string | If specified, will search the folders/files list by name. Ignores text before last /. This is the same API used by the search bar in the web UI when running 'Search This Folder'. Search results are a best effort, not real time, and not guaranteed to perfectly match the latest folder listing. Results may be truncated if more than 1,000 possible matches exist. This field should only be used for ad-hoc (human) searching, and not as part of an automated process. |
| search_custom_metadata_key string | If provided, the search string in search will search for files where this custom metadata key matches the value sent in search. Set this to * to allow any metadata key to match the value sent in search. |
| search_all boolean | Search entire site? If true, we will search the entire site. Do not provide a path when using this parameter. The search term must contain at least 3 characters after replacing * with spaces and trimming leading and trailing whitespace. This is the same API used by the search bar in the web UI when running 'Search All Files'. Search results are a best effort, not real time, and not guaranteed to match every file. This field should only be used for ad-hoc (human) searching, and not as part of an automated process. |
| with_previews boolean | Include file previews? |
| with_priority_color boolean | Include file priority color information? |
| type string | Type of objects to return. Can be folder or file. |
| modified_at_datetime string | If provided, will only return files/folders modified after this time. Can be used only in combination with type filter. |
Additional Arguments
Create Folder
Endpoint
POST/folders/{path}
Return Object
File
Authorization Requirement
Available to all authenticated keys or sessions.
Request Parameters
| Parameter | Description |
|---|---|
| path string Required | Path to operate on. |
| mkdir_parents boolean | Create parent directories if they do not exist? |
| provided_mtime string | User provided modification time. |
Update File/Folder Metadata
Endpoint
PATCH/files/{path}
Return Object
File
Authorization Requirement
Available to all authenticated keys or sessions.
Request Parameters
| Parameter | Description |
|---|---|
| path string Required | Path to operate on. |
| custom_metadata object | Custom metadata map. Replaces existing metadata; an empty map clears it. Requires Full or Admin permission. Uploaders with Write permission can supply custom metadata when completing an upload instead. |
| provided_mtime string | Modified time of file. |
| priority_color string | Priority/Bookmark color of file. |
Delete File/Folder
Endpoint
DELETE/files/{path}
Return Object
No return value.
Authorization Requirement
Available to all authenticated keys or sessions.
Request Parameters
| Parameter | Description |
|---|---|
| path string Required | Path to operate on. |
| recursive boolean | If true, will recursively delete folders. Otherwise, will error on non-empty folders. |
Create a ZIP from one or more paths and save it to a destination path
Endpoint
POST/file_actions/zip
Return Object
FileAction
Authorization Requirement
Available to all authenticated keys or sessions.
Request Parameters
| Parameter | Description |
|---|---|
| paths array(string) Required | Paths to include in the ZIP. |
| destination string Required | Destination file path for the ZIP. |
| archive_format string | Archive format to create. Possible values: zip, tar, tar.gz, tgz |
| overwrite boolean | Overwrite existing file in the destination? |
Extract a ZIP file to a destination folder
Endpoint
POST/file_actions/unzip
Return Object
FileAction
Authorization Requirement
Available to all authenticated keys or sessions.
Request Parameters
| Parameter | Description |
|---|---|
| path string Required | ZIP file path to extract. |
| destination string Required | Destination folder path for extracted files. |
| filename string | Optional single entry filename to extract. |
| overwrite boolean | Overwrite existing files in the destination? |
Encrypt a file with GPG and save it to a destination path
Endpoint
POST/file_actions/gpg_encrypt/{path}
Return Object
FileAction
Authorization Requirement
Available to all authenticated keys or sessions.
Request Parameters
| Parameter | Description |
|---|---|
| path string Required | Path to operate on. |
| destination string Required | Destination file path for the encrypted file. |
| gpg_key_ids array(int64) | GPG Key IDs to encrypt with. |
| gpg_key_partner_id int64 | Partner ID whose GPG keys should be used for encryption. |
| signing_key_id int64 | Optional GPG Key ID to sign with. |
| armor boolean | Output ASCII-armored encrypted data. |
| overwrite boolean | Overwrite existing file in the destination? |
Decrypt a GPG-encrypted file and save it to a destination path
Endpoint
POST/file_actions/gpg_decrypt/{path}
Return Object
FileAction
Authorization Requirement
Available to all authenticated keys or sessions.
Request Parameters
| Parameter | Description |
|---|---|
| path string Required | Path to operate on. |
| destination string Required | Destination file path for the decrypted file. |
| gpg_key_ids array(int64) | GPG Key IDs to decrypt with. If omitted, every accessible private GPG key in the source workspace is used. |
| gpg_key_partner_id int64 | Partner ID whose GPG keys should be used for decryption. |
| use_all_private_keys boolean | Use every accessible private GPG key in the source workspace for decryption. |
| ignore_mdc_error boolean | Ignore errors from the MDC (modification detection code) check. |
| overwrite boolean | Overwrite existing file in the destination? |
Transform a file and save the output to a destination path
Endpoint
POST/file_actions/transform/{path}
Return Object
FileAction
Authorization Requirement
Available to all authenticated keys or sessions.
Request Parameters
| Parameter | Description |
|---|---|
| path string Required | Path to operate on. |
| destination string Required | Destination file path for the transformed output. |
| transform_type string Required | Transform type. Supported values are image_convert, document_convert, and files_transform_script_execute. |
| target_format string Required | Destination format to create. |
| script string | Files TransformScript source. Required when transform_type is files_transform_script_execute. |
| width int64 | Maximum output width for image_convert. |
| height int64 | Maximum output height for image_convert. |
| overwrite boolean | Overwrite existing file in the destination? |
Move File/Folder
Endpoint
POST/file_actions/move/{path}
Return Object
FileAction
Authorization Requirement
Available to all authenticated keys or sessions.
Request Parameters
| Parameter | Description |
|---|---|
| path string Required | Path to operate on. |
| destination string Required | Move destination path. |
| overwrite boolean | Overwrite existing file(s) in the destination? |
Copy File/Folder
Endpoint
POST/file_actions/copy/{path}
Return Object
FileAction
Authorization Requirement
Available to all authenticated keys or sessions.
Request Parameters
| Parameter | Description |
|---|---|
| path string Required | Path to operate on. |
| destination string Required | Copy destination path. |
| copy_behaviors boolean | If copying a folder, also copy supported behaviors, email notification subscriptions, and per-folder branding to the destination folder tree? |
| structure boolean | Copy structure only? |
| overwrite boolean | Overwrite existing file(s) in the destination? |
Delete File/Folder and return its File Action. A pending or processing deletion continues in the background after this returns; check its File Migration for completion. Waiting for the File Migration does not cancel the deletion
Endpoint
POST/file_actions/delete/{path}
Return Object
FileAction
Authorization Requirement
Available to all authenticated keys or sessions.
Request Parameters
| Parameter | Description |
|---|---|
| path string Required | Path to operate on. |
| recursive boolean | If true, will recursively delete folders. Otherwise, will error on non-empty folders. |
The File Object
Some of the endpoints above return a File object. The attributes of this object are listed below.
| Attribute | Description |
|---|---|
| path string | File/Folder path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. |
| created_by_id int64 | User ID of the User who created the file/folder |
| created_by_api_key_id int64 | ID of the API key that created the file/folder |
| created_by_as2_incoming_message_id int64 | ID of the AS2 Incoming Message that created the file/folder |
| created_by_automation_id int64 | ID of the Automation that created the file/folder |
| created_by_bundle_registration_id int64 | ID of the Bundle Registration that created the file/folder |
| created_by_inbox_id int64 | ID of the Inbox that created the file/folder |
| created_by_remote_server_id int64 | ID of the Remote Server that created the file/folder |
| created_by_sync_id int64 | ID of the Sync that created the file/folder |
| custom_metadata object | Custom metadata map of keys and values. Limited to 32 keys, 256 characters per key and 1024 characters per value. |
| display_name string | File/Folder display name |
| type string | Type: directory or file. |
| size int64 | File/Folder size |
| created_at date-time | File created date/time |
| last_modified_by_id int64 | User ID of the User who last modified the file/folder |
| last_modified_by_api_key_id int64 | ID of the API key that last modified the file/folder |
| last_modified_by_automation_id int64 | ID of the Automation that last modified the file/folder |
| last_modified_by_bundle_registration_id int64 | ID of the Bundle Registration that last modified the file/folder |
| last_modified_by_remote_server_id int64 | ID of the Remote Server that last modified the file/folder |
| last_modified_by_sync_id int64 | ID of the Sync that last modified the file/folder |
| mtime date-time | File last modified date/time, according to the server. This is the timestamp of the last Files.com operation of the file, regardless of what modified timestamp was sent. |
| provided_mtime date-time | File last modified date/time, according to the client who set it. Files.com allows desktop, FTP, SFTP, and WebDAV clients to set modified at times. This allows Desktop<->Cloud syncing to preserve modified at times. |
| crc32 string | File CRC32 checksum. This is sometimes delayed, so if you get a blank response, wait and try again. |
| md5 string | File MD5 checksum. This is sometimes delayed, so if you get a blank response, wait and try again. |
| sha1 string | File SHA1 checksum. This is sometimes delayed, so if you get a blank response, wait and try again. |
| sha256 string | File SHA256 checksum. This is sometimes delayed, so if you get a blank response, wait and try again. |
| mime_type string | MIME Type. This is determined by the filename extension and is not stored separately internally. |
| region string | Region location |
| permissions string | A short string representing the current user's permissions. Can be r (Read),w (Write),d (Delete), l (List) or any combination |
| subfolders_locked? boolean | Are subfolders locked and unable to be modified? |
| is_locked boolean | Is this folder locked and unable to be modified? |
| download_uri string | Link to download file. Provided only in response to a download request. |
| direct_connection_info DirectConnectionInfo | Optional direct connection information for direct Agent transfer attempts |
| priority_color string | Bookmark/priority color of file/folder |
| preview_id int64 | File preview ID |
| preview Preview | File preview |
custom_metadata
Custom metadata map of keys and values. Limited to 32 keys, 256 characters per key and 1024 characters per value.
| Value type | Description |
|---|---|
| object of string values | Custom metadata map of keys and values. Limited to 32 keys, 256 characters per key and 1024 characters per value. At most 32 keys. |