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.

Endpoint

GET/files/{path}

Return Object

File

Authorization Requirement

Available to all authenticated keys or sessions.

Request Parameters

ParameterDescription
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?

Example Request

curl "https://app.files.com/api/rest/v1/files/{path}" \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "path": "path/file.txt",
  "created_by_id": 1,
  "created_by_api_key_id": 1,
  "created_by_as2_incoming_message_id": 1,
  "created_by_automation_id": 1,
  "created_by_bundle_registration_id": 1,
  "created_by_inbox_id": 1,
  "created_by_remote_server_id": 1,
  "created_by_sync_id": 1,
  "custom_metadata": {
    "department": "finance"
  },
  "display_name": "file.txt",
  "type": "file",
  "size": 1024,
  "created_at": "2000-01-01T01:00:00Z",
  "last_modified_by_id": 1,
  "last_modified_by_api_key_id": 1,
  "last_modified_by_automation_id": 1,
  "last_modified_by_bundle_registration_id": 1,
  "last_modified_by_remote_server_id": 1,
  "last_modified_by_sync_id": 1,
  "mtime": "2000-01-01T01:00:00Z",
  "provided_mtime": "2000-01-01T01:00:00Z",
  "crc32": "70976923",
  "md5": "17c54824e9931a4688ca032d03f6663c",
  "sha1": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
  "sha256": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
  "mime_type": "application/octet-stream",
  "region": "us-east-1",
  "permissions": "rwd",
  "subfolders_locked?": true,
  "is_locked": true,
  "download_uri": "https://mysite.files.com/...",
  "direct_connection_info": {
    "version": 1,
    "server_name": "example",
    "addresses": [
      "example"
    ],
    "direct_uri": "example",
    "ca_pem": "example"
  },
  "priority_color": "red",
  "preview_id": 1,
  "preview": {
    "id": 1,
    "status": "complete",
    "download_uri": "https://mysite.files.com/...",
    "type": "image",
    "size": "large"
  }
}

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.

Single Stream Download Example Request

curl https://SUBDOMAIN.files.com/api/rest/v1/file_contents/{path} \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

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:

  1. Start a new upload by sending a request to REST API to indicate intent to upload a file.
  2. Upload the file contents to the URL(s) provided in the API response, via multiple uploads with parallelism and independent retries.
  3. 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.

The Upload Object

AttributeDescription
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:
  • file: where to put the file data for the entire file upload
  • partdata: where to put the file data for this part
  • partsize: where to put the size of the upload for this file part
  • Content-Type: where to put the Content-Type of the file (which can have no bearing on the file's actual type)

Possible values for these parameters:
  • body: this information is the body of the PUT or POST request
  • required-header <header name>: this information goes in the named header
  • required-parameter <parameter name>: this information goes in the named parameter, and implies this request is formatted appropriately to send form data 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.

  1. Start the upload, including size when the total byte count is known.
  2. Read up to the returned partsize bytes and upload that part. The final part contains the remaining bytes and may be smaller.
  3. If bytes remain, request the next part's instructions using the same destination path and ref, and the next part number. 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.
  4. 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:

  1. Start with POST /file_actions/begin_upload/{path}, supplying size and with_direct_connection_info=true. Identify remote server integration and Files Agent destinations from the returned direct_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.
  2. Check that send, headers, and parameters permit 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.
  3. 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)), where maximum_parts is 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.
  4. Number the ranges consecutively from 1. For a fixed part size, each range starts at (part_number - 1) * part_size and contains min(part_size, size - offset) bytes. For the remote server integration and Files Agent offset protocol, set part_number and zero-based part_offset in the upload URL query, replacing any existing partNumber/offset aliases. 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.
  5. Request upload URLs in batches and prefetch the next batch while data uploads are running. Match every returned instruction to its part_number and keep the same destination path and ref. Upload with bounded concurrency only when parallel_parts is true; otherwise, send the parts one at a time, in order.
  6. 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}

Example Request

curl https://SUBDOMAIN.files.com/api/rest/v1/files/NewFile.txt \
  -u YOUR_API_KEY:x \
  -X POST \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{
        "action": "put"
      }'

Example Response

{
  "ref": "put-378670",
  "path": "NewFile.txt",
  "action": "put/write",
  "ask_about_overwrites": false,
  "http_method": "PUT",
  "upload_uri": "https://example-upload-proxy-url.com/path/6eee7ad0-bf75-0131-71fc-0eeabbd7a8b4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIEWLY3MN4YGZQOWA%2F20140516%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20140516T221456Z&X-Amz-Expires=180&X-Amz-SignedHeaders=host&partNumber=1&uploadId=xQDI8q.aDdWdWIvSpRGLOFqnPQqJoMGZ88r9g_q7z2gW6U4rNZx8Zb_Wh9m07TDJM1x4rCTM18UCzdXaYjJu.SBH89LAiA4ye698TfMPyam4BO7ifs7HLuiBPrEW.zIz&X-Amz-Signature=69bc7be37c8c42096e78aa4ff752f073ea890481c5f76eac5ad40a5ab9466997",
  "partsize":5242880,
  "part_number":1,
  "available_parts":10000,
  "send": {
    "partsize": "required-header Content-Length",
    "partdata": "body"
  },
  "headers": {},
  "parameters": {}
}

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.

Example Request

curl "https://example-upload-proxy-url.com/path/6eee7ad0-bf75-0131-71fc-0eeabbd7a8b4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIEWLY3MN4YGZQOWA%2F20140516%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20140516T221456Z&X-Amz-Expires=180&X-Amz-SignedHeaders=host&partNumber=1&uploadId=xQDI8q.aDdWdWIvSpRGLOFqnPQqJoMGZ88r9g_q7z2gW6U4rNZx8Zb_Wh9m07TDJM1x4rCTM18UCzdXaYjJu.SBH89LAiA4ye698TfMPyam4BO7ifs7HLuiBPrEW.zIz&X-Amz-Signature=69bc7be37c8c42096e78aa4ff752f073ea890481c5f76eac5ad40a5ab9466997" \
  --upload-file filename.ext

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}

Example Request

curl https://SUBDOMAIN.files.com/api/rest/v1/files/NewFile.txt \
  -u YOUR_API_KEY:x \
  -X POST \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{
        "action": "put",
        "ref": "put-378670",
        "part": 2
      }'

Example Response

{
  "ref": "put-378670",
  "path": "NewFile.txt",
  "action": "put/write",
  "ask_about_overwrites": false,
  "http_method": "PUT",
  "upload_uri": "https://example-upload-proxy-url.com/path/6eee7ad0-bf75-0131-71fc-0eeabbd7a8b4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIEWLY3MN4YGZQOWA%2F20140516%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20140516T221456Z&X-Amz-Expires=180&X-Amz-SignedHeaders=host&partNumber=2&uploadId=xQDI8q.aDdWdWIvSpRGLOFqnPQqJoMGZ88r9g_q7z2gW6U4rNZx8Zb_Wh9m07TDJM1x4rCTM18UCzdXaYjJu.SBH89LAiA4ye698TfMPyam4BO7ifs7HLuiBPrEW.zIz&X-Amz-Signature=57c440731898fb55c6866af734757185dbbccba7741259ade453c30120e32c6h",
  "partsize":5242880,
  "part_number":2,
  "available_parts":10000,
  "send": {
    "partsize": "required-header Content-Length",
    "partdata": "body"
  },
  "headers": {},
  "parameters": {}
}

Request a Batch of Upload URLs

curl https://SUBDOMAIN.files.com/api/rest/v1/file_actions/begin_upload/NewFile.txt \
  -u YOUR_API_KEY:x \
  -X POST \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{
        "ref": "put-378670",
        "part": 2,
        "parts": 8,
        "with_direct_connection_info": true
      }'

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}

Example Request

curl https://SUBDOMAIN.files.com/api/rest/v1/files/NewFile.txt \
  -u YOUR_API_KEY:x \
  -X POST \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{
        "action": "end",
        "ref": "put-378670",
        "size": 412,
        "custom_metadata": {
          "project": "quarterly-report"
        }
      }'

Example Response

{
  "id": 1020304050,
  "path": "NewFile.txt",
  "display_name": "NewFile.txt",
  "type": "file",
  "size": 412,
  "mtime": "2014-05-17T05:14:35+00:00",
  "provided_mtime": null,
  "crc32": null,
  "md5": null,
  "region":"us-east-1",
  "permissions": "rwd",
  "custom_metadata": {
    "project": "quarterly-report"
  }
}

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.

Single Stream Upload Example Request

curl https://SUBDOMAIN.files.com/api/rest/v1/file_contents/{path} \
  -X POST \
  -H 'X-FilesAPI-Key: YOUR_API_KEY' \
  -d "@path/to/local/file"

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

ParameterDescription
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?

Example Request

curl "https://app.files.com/api/rest/v1/file_actions/metadata/{path}" \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "path": "path/file.txt",
  "created_by_id": 1,
  "created_by_api_key_id": 1,
  "created_by_as2_incoming_message_id": 1,
  "created_by_automation_id": 1,
  "created_by_bundle_registration_id": 1,
  "created_by_inbox_id": 1,
  "created_by_remote_server_id": 1,
  "created_by_sync_id": 1,
  "custom_metadata": {
    "department": "finance"
  },
  "display_name": "file.txt",
  "type": "file",
  "size": 1024,
  "created_at": "2000-01-01T01:00:00Z",
  "last_modified_by_id": 1,
  "last_modified_by_api_key_id": 1,
  "last_modified_by_automation_id": 1,
  "last_modified_by_bundle_registration_id": 1,
  "last_modified_by_remote_server_id": 1,
  "last_modified_by_sync_id": 1,
  "mtime": "2000-01-01T01:00:00Z",
  "provided_mtime": "2000-01-01T01:00:00Z",
  "crc32": "70976923",
  "md5": "17c54824e9931a4688ca032d03f6663c",
  "sha1": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
  "sha256": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
  "mime_type": "application/octet-stream",
  "region": "us-east-1",
  "permissions": "rwd",
  "subfolders_locked?": true,
  "is_locked": true,
  "download_uri": "https://mysite.files.com/...",
  "direct_connection_info": {
    "version": 1,
    "server_name": "example",
    "addresses": [
      "example"
    ],
    "direct_uri": "example",
    "ca_pem": "example"
  },
  "priority_color": "red",
  "preview_id": 1,
  "preview": {
    "id": 1,
    "status": "complete",
    "download_uri": "https://mysite.files.com/...",
    "type": "image",
    "size": "large"
  }
}

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

ParameterDescription
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

Example Request

curl "https://app.files.com/api/rest/v1/folders/{path}" \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

[
  {
    "path": "path/file.txt",
    "created_by_id": 1,
    "created_by_api_key_id": 1,
    "created_by_as2_incoming_message_id": 1,
    "created_by_automation_id": 1,
    "created_by_bundle_registration_id": 1,
    "created_by_inbox_id": 1,
    "created_by_remote_server_id": 1,
    "created_by_sync_id": 1,
    "custom_metadata": {
      "department": "finance"
    },
    "display_name": "file.txt",
    "type": "file",
    "size": 1024,
    "created_at": "2000-01-01T01:00:00Z",
    "last_modified_by_id": 1,
    "last_modified_by_api_key_id": 1,
    "last_modified_by_automation_id": 1,
    "last_modified_by_bundle_registration_id": 1,
    "last_modified_by_remote_server_id": 1,
    "last_modified_by_sync_id": 1,
    "mtime": "2000-01-01T01:00:00Z",
    "provided_mtime": "2000-01-01T01:00:00Z",
    "crc32": "70976923",
    "md5": "17c54824e9931a4688ca032d03f6663c",
    "sha1": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
    "sha256": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
    "mime_type": "application/octet-stream",
    "region": "us-east-1",
    "permissions": "rwd",
    "subfolders_locked?": true,
    "is_locked": true,
    "download_uri": "https://mysite.files.com/...",
    "direct_connection_info": {
      "version": 1,
      "server_name": "example",
      "addresses": [
        "example"
      ],
      "direct_uri": "example",
      "ca_pem": "example"
    },
    "priority_color": "red",
    "preview_id": 1,
    "preview": {
      "id": 1,
      "status": "complete",
      "download_uri": "https://mysite.files.com/...",
      "type": "image",
      "size": "large"
    }
  }
]

Create Folder

Endpoint

POST/folders/{path}

Return Object

File

Authorization Requirement

Available to all authenticated keys or sessions.

Request Parameters

ParameterDescription
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.

Example Request

curl https://app.files.com/api/rest/v1/folders/{path} \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"mkdir_parents":false,"provided_mtime":"2000-01-01T01:00:00Z"}' \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "path": "path/file.txt",
  "created_by_id": 1,
  "created_by_api_key_id": 1,
  "created_by_as2_incoming_message_id": 1,
  "created_by_automation_id": 1,
  "created_by_bundle_registration_id": 1,
  "created_by_inbox_id": 1,
  "created_by_remote_server_id": 1,
  "created_by_sync_id": 1,
  "custom_metadata": {
    "department": "finance"
  },
  "display_name": "file.txt",
  "type": "file",
  "size": 1024,
  "created_at": "2000-01-01T01:00:00Z",
  "last_modified_by_id": 1,
  "last_modified_by_api_key_id": 1,
  "last_modified_by_automation_id": 1,
  "last_modified_by_bundle_registration_id": 1,
  "last_modified_by_remote_server_id": 1,
  "last_modified_by_sync_id": 1,
  "mtime": "2000-01-01T01:00:00Z",
  "provided_mtime": "2000-01-01T01:00:00Z",
  "crc32": "70976923",
  "md5": "17c54824e9931a4688ca032d03f6663c",
  "sha1": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
  "sha256": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
  "mime_type": "application/octet-stream",
  "region": "us-east-1",
  "permissions": "rwd",
  "subfolders_locked?": true,
  "is_locked": true,
  "download_uri": "https://mysite.files.com/...",
  "direct_connection_info": {
    "version": 1,
    "server_name": "example",
    "addresses": [
      "example"
    ],
    "direct_uri": "example",
    "ca_pem": "example"
  },
  "priority_color": "red",
  "preview_id": 1,
  "preview": {
    "id": 1,
    "status": "complete",
    "download_uri": "https://mysite.files.com/...",
    "type": "image",
    "size": "large"
  }
}

Update File/Folder Metadata

Endpoint

PATCH/files/{path}

Return Object

File

Authorization Requirement

Available to all authenticated keys or sessions.

Request Parameters

ParameterDescription
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.

Example Request

curl https://app.files.com/api/rest/v1/files/{path} \
  -X PATCH \
  -H 'Content-Type: application/json' \
  -d '{"custom_metadata":{"department":"finance"},"provided_mtime":"2000-01-01T01:00:00Z","priority_color":"red"}' \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "path": "path/file.txt",
  "created_by_id": 1,
  "created_by_api_key_id": 1,
  "created_by_as2_incoming_message_id": 1,
  "created_by_automation_id": 1,
  "created_by_bundle_registration_id": 1,
  "created_by_inbox_id": 1,
  "created_by_remote_server_id": 1,
  "created_by_sync_id": 1,
  "custom_metadata": {
    "department": "finance"
  },
  "display_name": "file.txt",
  "type": "file",
  "size": 1024,
  "created_at": "2000-01-01T01:00:00Z",
  "last_modified_by_id": 1,
  "last_modified_by_api_key_id": 1,
  "last_modified_by_automation_id": 1,
  "last_modified_by_bundle_registration_id": 1,
  "last_modified_by_remote_server_id": 1,
  "last_modified_by_sync_id": 1,
  "mtime": "2000-01-01T01:00:00Z",
  "provided_mtime": "2000-01-01T01:00:00Z",
  "crc32": "70976923",
  "md5": "17c54824e9931a4688ca032d03f6663c",
  "sha1": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
  "sha256": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
  "mime_type": "application/octet-stream",
  "region": "us-east-1",
  "permissions": "rwd",
  "subfolders_locked?": true,
  "is_locked": true,
  "download_uri": "https://mysite.files.com/...",
  "direct_connection_info": {
    "version": 1,
    "server_name": "example",
    "addresses": [
      "example"
    ],
    "direct_uri": "example",
    "ca_pem": "example"
  },
  "priority_color": "red",
  "preview_id": 1,
  "preview": {
    "id": 1,
    "status": "complete",
    "download_uri": "https://mysite.files.com/...",
    "type": "image",
    "size": "large"
  }
}

Delete File/Folder

Endpoint

DELETE/files/{path}

Return Object

No return value.

Authorization Requirement

Available to all authenticated keys or sessions.

Request Parameters

ParameterDescription
path
string
Required
Path to operate on.
recursive
boolean
If true, will recursively delete folders. Otherwise, will error on non-empty folders.

Example Request

curl "https://app.files.com/api/rest/v1/files/{path}" \
  -X DELETE \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

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

ParameterDescription
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?

Example Request

curl https://app.files.com/api/rest/v1/file_actions/zip.json \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"paths":"paths","destination":"destination","overwrite":false}' \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "status": "pending",
  "file_migration_id": 1
}

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

ParameterDescription
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?

Example Request

curl https://app.files.com/api/rest/v1/file_actions/unzip.json \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"destination":"destination","overwrite":false}' \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "status": "pending",
  "file_migration_id": 1
}

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

ParameterDescription
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?

Example Request

curl https://app.files.com/api/rest/v1/file_actions/gpg_encrypt/{path} \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"destination":"destination","gpg_key_partner_id":1,"signing_key_id":1,"armor":false,"overwrite":false}' \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "status": "pending",
  "file_migration_id": 1
}

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

ParameterDescription
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?

Example Request

curl https://app.files.com/api/rest/v1/file_actions/gpg_decrypt/{path} \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"destination":"destination","gpg_key_partner_id":1,"use_all_private_keys":false,"ignore_mdc_error":false,"overwrite":false}' \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "status": "pending",
  "file_migration_id": 1
}

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

ParameterDescription
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?

Example Request

curl https://app.files.com/api/rest/v1/file_actions/transform/{path} \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"destination":"destination","transform_type":"transform_type","target_format":"target_format","width":1,"height":1,"overwrite":false}' \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "status": "pending",
  "file_migration_id": 1
}

Move File/Folder

Endpoint

POST/file_actions/move/{path}

Return Object

FileAction

Authorization Requirement

Available to all authenticated keys or sessions.

Request Parameters

ParameterDescription
path
string
Required
Path to operate on.
destination
string
Required
Move destination path.
overwrite
boolean
Overwrite existing file(s) in the destination?

Example Request

curl https://app.files.com/api/rest/v1/file_actions/move/{path} \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"destination":"destination","overwrite":false}' \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "status": "pending",
  "file_migration_id": 1
}

Copy File/Folder

Endpoint

POST/file_actions/copy/{path}

Return Object

FileAction

Authorization Requirement

Available to all authenticated keys or sessions.

Request Parameters

ParameterDescription
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?

Example Request

curl https://app.files.com/api/rest/v1/file_actions/copy/{path} \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"destination":"destination","copy_behaviors":false,"structure":false,"overwrite":false}' \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "status": "pending",
  "file_migration_id": 1
}

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

ParameterDescription
path
string
Required
Path to operate on.
recursive
boolean
If true, will recursively delete folders. Otherwise, will error on non-empty folders.

Example Request

curl https://app.files.com/api/rest/v1/file_actions/delete/{path} \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"recursive":false}' \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "status": "pending",
  "file_migration_id": 1
}

The File Object

Some of the endpoints above return a File object. The attributes of this object are listed below.

AttributeDescription
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

Example File Object

{
  "path": "path/file.txt",
  "created_by_id": 1,
  "created_by_api_key_id": 1,
  "created_by_as2_incoming_message_id": 1,
  "created_by_automation_id": 1,
  "created_by_bundle_registration_id": 1,
  "created_by_inbox_id": 1,
  "created_by_remote_server_id": 1,
  "created_by_sync_id": 1,
  "custom_metadata": {
    "department": "finance"
  },
  "display_name": "file.txt",
  "type": "file",
  "size": 1024,
  "created_at": "2000-01-01T01:00:00Z",
  "last_modified_by_id": 1,
  "last_modified_by_api_key_id": 1,
  "last_modified_by_automation_id": 1,
  "last_modified_by_bundle_registration_id": 1,
  "last_modified_by_remote_server_id": 1,
  "last_modified_by_sync_id": 1,
  "mtime": "2000-01-01T01:00:00Z",
  "provided_mtime": "2000-01-01T01:00:00Z",
  "crc32": "70976923",
  "md5": "17c54824e9931a4688ca032d03f6663c",
  "sha1": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
  "sha256": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
  "mime_type": "application/octet-stream",
  "region": "us-east-1",
  "permissions": "rwd",
  "subfolders_locked?": true,
  "is_locked": true,
  "download_uri": "https://mysite.files.com/...",
  "direct_connection_info": {
    "version": 1,
    "server_name": "example",
    "addresses": [
      "example"
    ],
    "direct_uri": "example",
    "ca_pem": "example"
  },
  "priority_color": "red",
  "preview_id": 1,
  "preview": {
    "id": 1,
    "status": "complete",
    "download_uri": "https://mysite.files.com/...",
    "type": "image",
    "size": "large"
  }
}

custom_metadata

Custom metadata map of keys and values. Limited to 32 keys, 256 characters per key and 1024 characters per value.

Value typeDescription
object of string valuesCustom metadata map of keys and values. Limited to 32 keys, 256 characters per key and 1024 characters per value. At most 32 keys.

Example custom_metadata

{
  "department": "finance"
}