Behaviors

A Behavior is an API resource for what are also known as Folder Settings. Every behavior is associated with a folder.

Depending on the behavior, it may also operate on child folders. It may be overridable at the child folder level or maybe can be added to at the child folder level. The exact options for each behavior type are explained in the table below.

Each behavior type also has a recursion mode in the behavior type documentation. always means the behavior is always recursive, never means it is never recursive, and sometimes means callers may choose the value of the recursive field.

Additionally, some behaviors are visible to non-admins, and others are even settable by non-admins. All the details are below.

Each behavior uses a different format for its settings value. The accepted fields and an example are shown with each behavior type. In the REST API, send these settings as JSON within the value field.

Note: Append Timestamp behavior removed. Check Override Upload Filename behavior which have even more functionality to modify name on upload.

Behavior Value Migration

During the compatibility window, existing unwrapped values and JSON-encoded strings continue to work but produce a Terraform warning. Wrap value under the selected Behavior name for new configuration:

Object Value

# Legacy
value = {
  urls = ["https://example.com/webhook"]
}

# New
value = {
  webhook = {
    urls = ["https://example.com/webhook"]
  }
}

Scalar Value

# Legacy
value = "us-east-1"

# New
value = { storage_region = "us-east-1" }

Array Value

# Legacy
value = ["/Document-.*/"]

# New
value = { limit_file_regex = ["/Document-.*/"] }

JSON-encoded legacy values are also accepted until March 1, 2027. The first provider release after that date switches value to its typed schema, starts nested Terraform validation, and stops accepting legacy formats. Provider versions released before then keep accepting legacy values, so pinning an older provider version keeps existing configuration working.

Webhook Behaviors

Behavior Details 
Behavior typewebhook
Recursion and override behaviorRecursively applied to child folders if recursive option is set. Additional behaviors may be set directly on child folders.
Only one may be set per folder?No
Visible to non-admins?No
Requires attachment?No
Value Hash ParameterDescription
urls
array of strings
Required
Array of URLs to send the webhook to. At least 1 item.
method
string
Default: GET. May also be set to POST.
triggers
array of strings
Leave blank or use * to send webhooks on any action on this folder. Otherwise, specify an array of action types.
triggering_filenames
array of strings
Leave blank to trigger webhooks on any file in this folder. Or you may specify an array of filenames (possibly with wildcards) to match for action path.
exclude_filenames
array of strings
Leave blank and no files will be excluded. Or specify an array of filenames (with optional wildcards) to exclude certain files from triggering the webhook based on their name. This setting takes precedence over the triggering_filenames setting if a path matches both settings.
encoding
string
May be JSON, XML, RAW, EV1, or EV2. If set to RAW or left blank, we will deliver the webhook using the HTTP GET params or POST body. If JSON or XML, we will encode the payload accordingly and send a matching Content-Type header. If set to EV1, we will encode the payload to emulate ExaVault's version 1 webhook format. If set to EV2, we will encode the payload to emulate ExaVault's version 2.0 webhook format.
headers
object of string values
Hash of HTTP Headers to send.
body
object
Hash of Body Params to send.
verification_token
string
If provided, this token will be used to sign webhook messages cryptographically to allow you to verify the webhook authenticity.
file_form_field
string
A string specifying the name of a form field containing the contents of the file that triggered this webhook send. If this value is present, the webhook will submit a multipart/form-data POST with no request body encoding.
file_as_body
boolean
When sending webhook requests, submit the contents of the file that triggered this webhook send as the request body.
use_dedicated_ips
boolean
If set to true, we will send webhooks from dedicated IPs. This is useful if you need to whitelist IPs for your webhook endpoint.

Example Resource

resource "files_behavior" "example_webhook_behavior" {
  path     = "path"
  behavior = "webhook"
  value    = {
    webhook = {
      urls     = ["https://example.com/webhook"]
      method   = "POST"
      encoding = "JSON"
    }
  }
}

File Expiration Behaviors

Behavior Details 
Behavior typefile_expiration
Recursion and override behaviorRecursively applied to child folders if recursive option is set. May be overridden in the child by adding a behavior on the child.
Only one may be set per folder?Yes
Visible to non-admins?Yes
Requires attachment?No
Value Hash ParameterDescription
days_to_retain
integer
Required
Number of days to keep files around. Minimum: 1.
delete_empty_folders
boolean
If true, delete empty folders inside this tree after expired files are removed. Folders with explicit configuration, such as permissions, notifications, or behaviors, are preserved. Default: false.

Example Resource

resource "files_behavior" "example_file_expiration_behavior" {
  path     = "path"
  behavior = "file_expiration"
  value    = {
    file_expiration = {
      days_to_retain       = 30
      delete_empty_folders = false
    }
  }
}

Auto Encrypt Behaviors

Behavior Details 
Behavior typeauto_encrypt
Recursion and override behaviorRecursively applied to child folders if recursive option is set. May be overridden in the child by adding a behavior on the child. Auto Decrypt will be also overridden.
Only one may be set per folder?Yes
Visible to non-admins?Yes
Requires attachment?No
Value Hash ParameterDescription
gpg_key_id
integer
Your GPG Key ID object to use for this operation. Minimum: 1. References gpg key by ID.
gpg_key_ids
array of integers
Your GPG Key ID objects to use for this operation. At least 1 item. Values must be unique. Each item must be at least 1.
algorithm
string
Required
Must be set to PGP/GPG. If we support other options in the future (like OpenSSL), we will amend this option. Value: PGP/GPG.
signing_key_id
integer
Optional GPG Key ID object to use for signing the encrypted file. Minimum: 1. References gpg key by ID.
suffix
string
Suffix to apply to filenames once they've been uploaded.
armor
boolean
If true, encrypted files are written as ASCII text.
gpg_key_partner_id
integer
If set, use the Partner's key for encryption. Minimum: 1. References partner by ID.
key_md5
string
MD5 digest of the configured public key material. Read only.
private_key_md5
string
MD5 digest of the configured private key material. Read only.
private_key_password_md5
string
MD5 digest of the configured private key password. Read only.
signing_key_md5
string
MD5 digest of the configured signing key material. Read only.
signing_key_password_md5
string
MD5 digest of the configured signing key password. Read only.

Example Resource

resource "files_behavior" "example_auto_encrypt_behavior" {
  path     = "path"
  behavior = "auto_encrypt"
  value    = {
    auto_encrypt = {
      gpg_key_ids = [1]
      algorithm   = "PGP/GPG"
      suffix      = ".gpg"
      armor       = false
    }
  }
}

Lock Subfolders Behaviors

Behavior Details 
Behavior typelock_subfolders
Recursion and override behaviorAlways recursively applied to child folders. May be overridden in the child by adding a behavior on the child.
Only one may be set per folder?Yes
Visible to non-admins?Yes
Requires attachment?No
Value Hash ParameterDescription
level
string
Which folders the lock applies to. Can be children_recursive (default), children, self, or none. Possible values: children_recursive, children, self, none.

Example Resource

resource "files_behavior" "example_lock_subfolders_behavior" {
  path     = "path"
  behavior = "lock_subfolders"
  value    = {
    lock_subfolders = {
      level = "children_recursive"
    }
  }
}

Storage Region Behaviors

Behavior Details 
Behavior typestorage_region
Recursion and override behaviorAlways recursively applied to child folders. May be overridden in the child by adding a behavior on the child.
Only one may be set per folder?Yes
Visible to non-admins?Yes
Requires attachment?No
Value typeDescription
stringValid AWS region. Possible values: us-east-1, eu-west-1.

Example Resource

resource "files_behavior" "example_storage_region_behavior" {
  path     = "path"
  behavior = "storage_region"
  value    = {
    storage_region = "us-east-1"
  }
}

Serve Publicly Behaviors

Behavior Details 
Behavior typeserve_publicly
Recursion and override behaviorAlways recursively applied to child folders. Additional behaviors may be set directly on child folders.
Only one may be set per folder?No
Visible to non-admins?Yes
Requires attachment?No
Value Hash ParameterDescription
key
string
URL path for where the stuff is publicly hosted. It will look like https://SUBDOMAIN.hosted-by-files.com/{key}/.
show_index
boolean
If true, show an index page listing the folder contents. Default: false.
force_download
boolean
If true, send the Content-Disposition: attachment header, instructing browsers to always download files and not display them in the browser. Default: false.
username
string
Username required to access the publicly hosted folder.
password
string
Password required to access the publicly hosted folder. Write only.
password_required
boolean
Whether password authentication is configured. Read only.
cors_enabled
boolean
Enable CORS headers for cross-origin requests Default: false.
require_site_authentication
boolean
Require Files.com site authentication before visitors can access this publicly hosted folder. Default: false.

Example Resource

resource "files_behavior" "example_serve_publicly_behavior" {
  path     = "path"
  behavior = "serve_publicly"
  value    = {
    serve_publicly = {
      key            = "public-files"
      show_index     = true
      force_download = false
    }
  }
}

Create User Folders Behaviors

Behavior Details 
Behavior typecreate_user_folders
Recursion and override behaviorNever applied to child folders. Additional behaviors may be set directly on child folders.
Only one may be set per folder?No
Visible to non-admins?No
Requires attachment?No
Value Hash ParameterDescription
permission
string
What permission level to give the user on his or her new folder? Takes the same options as the Permissions endpoint. Possible values: full, readonly, writeonly, list, history, admin, bundle, site_admin, readonly_site_admin, previewonly.
additional_permission
string
Additional permission level to give the user on his or her new folder. Used to apply a second permission. Takes the same options as the Permissions endpoint. Possible values: full, readonly, writeonly, list, history, admin, bundle, site_admin, readonly_site_admin, previewonly.
existing_users
boolean
Apply this behavior to existing users or only newly added users? Default: false.
group_id
integer
Only apply this behavior to users who are members of this group ID. Minimum: 1. References group by ID.
new_folder_name
string
What to name the new folder. Currently we support name and username. name will fall back to username if not present. Default value is name. Possible values: name, username.
subfolders
array of strings
Subfolders to create within the new folder.

Example Resource

resource "files_behavior" "example_create_user_folders_behavior" {
  path     = "path"
  behavior = "create_user_folders"
  value    = {
    create_user_folders = {
      permission      = "full"
      existing_users  = false
      new_folder_name = "name"
    }
  }
}

Inbox Behaviors

Behavior Details 
Behavior typeinbox
Recursion and override behaviorAlways recursively applied to child folders. Additional behaviors may be set directly on child folders.
Only one may be set per folder?No
Visible to non-admins?No
Requires attachment?No
Value Hash ParameterDescription
key
string
Required
URL key used for the inbox. May only contain lowercase alphabetic characters, numbers, and dashes.
dont_separate_submissions_by_folder
boolean
Do not create subfolders for files uploaded to this inbox. Note: there are subtle security pitfalls with allowing anonymous uploads from multiple users to live in the same folder. We strongly discourage use of this option unless absolutely required. Default: false.
dont_separate_submissions_by_folder_for_inbound_email
boolean
Do not create subfolders for inbound email uploads to this inbox. This exists for backwards compatibility for older inboxes that already used inbound email. Default: false.
dont_allow_folders_in_uploads
boolean
If set to true, will prevent folders from being created inside an inbox submission. Useful for certain automation use cases where nested folders don't work well. Default: false.
require_inbox_recipient
boolean
If set to true, requires that the inbox be shared with specific recipients rather than being accessed via a URL directly. Default: false.
show_on_login_page
boolean
Show this inbox on the login page of your website. Only settable by admins. Default: false.
clickwrap_id
integer
Clickwrap ID required before submitting to the Inbox. Minimum: 1. References clickwrap by ID.
form_field_set_id
integer
Form Field Set ID used by the Inbox. Minimum: 1. References form field set by ID.
title
string
Required
Title of the Inbox. Must be unique per site. Maximum length: 550.
description
string
Description of the inbox shown on the actual inbox page.
help_text
string
Help text shown on the inbox page.
require_registration
boolean
Show a registration page that captures the uploader's name and email address? Default: false.
password
string
Password to authenticate to inbox. Write only.
has_password_hash
boolean
Whether password authentication is configured. Read only.
path_template
string
Template for creating submission subfolders. Can use the uploader's name, email address, ip, company, strftime directives, and any custom form data.
path_template_time_zone
string
Timezone to use when rendering timestamps in path templates.
enable_inbound_email_address
boolean
This is only used when creating/updating a behavior. If set to true, will generate inbound_email_address to this folder. If set to false, will remove inbound_email_address to this folder. Please note that the uploads via email doesn't work if require_registration or password options are set to true. Write only.
inbound_email_address
string
Generated inbound email address. Read only.
notify_senders_on_successful_uploads_via_email
boolean
If true, notify the sender on successful uploads via email. Default: false.
notify_senders_on_successful_uploads_via_web
boolean
Notify senders on successful uploads via web. Please note that the notifications on web uploads only works if require_registration is set to true. Default: false.
allow_whitelisting
boolean
If true, only allow uploads from whitelisted email addresses and domains. Default: false.
whitelist
string
Comma-separated string of whitelisted email addresses and domains.
disable_web_upload
boolean
If true, disable the upload URL. Can only be done if uploads via email are enabled. Default: false.
capture_email_body_filename
string
If set, the plain-text body of email submissions will be saved with this name.
requested_upload_slots
array of objects
Upload slots requested on the public Inbox page. Each slot name is used as its label and destination subfolder name.

Requested upload slot

AttributeDescription
name
string
Required
Upload slot label and destination subfolder name.

Example Resource

resource "files_behavior" "example_inbox_behavior" {
  path     = "path"
  behavior = "inbox"
  value    = {
    inbox = {
      key                                 = "application-forms"
      dont_separate_submissions_by_folder = false
      show_on_login_page                  = false
      title                               = "Application Forms"
      require_registration                = false
      disable_web_upload                  = false
      requested_upload_slots              = [
        {
          name = "Photo ID"
        }
      ]
    }
  }
}

Limit File Extensions Behaviors

Behavior Details 
Behavior typelimit_file_extensions
Recursion and override behaviorRecursively applied to child folders if recursive option is set. May be overridden in the child by adding a behavior on the child.
Only one may be set per folder?Yes
Visible to non-admins?Yes
Requires attachment?No
Value Hash ParameterDescription
extensions
array of strings
Required
Array of whitelisted/blacklisted file extensions, depending on mode. At least 1 item. Values must be unique.
mode
string
Controls whether the behavior acts as a whitelist or as a blacklist. Default is whitelist. Possible values: whitelist, blacklist. Default: whitelist.

Example Resource

resource "files_behavior" "example_limit_file_extensions_behavior" {
  path     = "path"
  behavior = "limit_file_extensions"
  value    = {
    limit_file_extensions = {
      extensions = ["pdf", "csv"]
      mode       = "whitelist"
    }
  }
}

Limit File Regex Behaviors

Behavior Details 
Behavior typelimit_file_regex
Recursion and override behaviorRecursively applied to child folders if recursive option is set. May be overridden in the child by adding a behavior on the child.
Only one may be set per folder?Yes
Visible to non-admins?Yes
Requires attachment?No
Value typeDescription
array of stringsSingle-element Array (not a hash) containing the regular expression, which must start and end with slashes. From 1 to 1 items.

Example Resource

resource "files_behavior" "example_limit_file_regex_behavior" {
  path     = "path"
  behavior = "limit_file_regex"
  value    = {
    limit_file_regex = ["/Document-.*/"]
  }
}

Amazon Sns Behaviors

Behavior Details 
Behavior typeamazon_sns
Recursion and override behaviorRecursively applied to child folders if recursive option is set. Additional behaviors may be set directly on child folders.
Only one may be set per folder?No
Visible to non-admins?No
Requires attachment?No
Value Hash ParameterDescription
arns
array of strings
Required
Array of ARNs to send the notifications to. At least 1 item.
triggers
array of strings
Leave blank or use * to send an SNS notification on any action on this folder. Otherwise, specify an array of action types.
aws_credentials
object
AWS IAM Credentials to use for sending SNS requests. Must include access_key_id, and secret_access_key.
body
object
Additional body parameters to include in the notification.

AWS credentials

AttributeDescription
access_key_id
string
Required
region
string
secret_access_key
string
Required
Write only.

Example Resource

resource "files_behavior" "example_amazon_sns_behavior" {
  path     = "path"
  behavior = "amazon_sns"
  value    = {
    amazon_sns = {
      arns            = ["arn:aws:sns:us-east-1:123456789012:files-events"]
      aws_credentials = {
        access_key_id     = "ACCESS_KEY_ID"
        region            = "us-east-1"
        secret_access_key = "SECRET_ACCESS_KEY"
      }
    }
  }
}

Watermark Behaviors

Behavior Details 
Behavior typewatermark
Recursion and override behaviorRecursively applied to child folders if recursive option is set. May be overridden in the child by adding a behavior on the child.
Only one may be set per folder?Yes
Visible to non-admins?No
Requires attachment?Yes
Value Hash ParameterDescription
gravity
string
Where to locate the watermark? Valid values: Center, East, NorthEast, North, NorthWest, SouthEast, South, SouthWest, West. Possible values: Center, East, NorthEast, North, NorthWest, SouthEast, South, SouthWest, West.
max_height_or_width
integer
Max width/height as percent of image preview.
transparency
integer
Percentage applied to the watermark.
dynamic_text
string
Watermark text. Use {{user}} to embed a username into the string.

Example Resource

resource "files_behavior" "example_watermark_behavior" {
  path     = "path"
  behavior = "watermark"
  value    = {
    watermark = {
      gravity             = "SouthWest"
      max_height_or_width = 20
      transparency        = 25
    }
  }
}

Remote Server Mount Behaviors

Behavior Details 
Behavior typeremote_server_mount
Recursion and override behaviorAlways recursively applied to child folders. Cannot be overridden by behaviors on child folders.
Only one may be set per folder?Yes
Visible to non-admins?Yes
Requires attachment?No
Value Hash ParameterDescription
remote_server_id
integer
Required
ID of the remote server to mount. See the Remote Servers API resource for managing these. Minimum: 1. References remote server by ID.
remote_path
string
Path on remote server to treat as the root of this mount. This should be an absolute path on the remote server. This must be slash-delimited, but it must neither start nor end with a slash, and it must not contain relative path components.

Example Resource

resource "files_behavior" "example_remote_server_mount_behavior" {
  path     = "path"
  behavior = "remote_server_mount"
  value    = {
    remote_server_mount = {
      remote_server_id = 1
      remote_path      = "shared/files"
    }
  }
}

Slack Webhook Behaviors

Behavior Details 
Behavior typeslack_webhook
Recursion and override behaviorRecursively applied to child folders if recursive option is set. Additional behaviors may be set directly on child folders.
Only one may be set per folder?No
Visible to non-admins?No
Requires attachment?No
Value Hash ParameterDescription
url
string
Required
Slack issued URL to send the webhook to.
username
string
Username to display in Slack.
channel
string
Channel is send the webhook to.
icon_emoji
string
Slack emoji to display in Slack, e.g. :robot_face:.
triggers
array of strings
Leave blank or use * to send webhooks on any action on this folder. Otherwise, specify an array of action types.

Example Resource

resource "files_behavior" "example_slack_webhook_behavior" {
  path     = "path"
  behavior = "slack_webhook"
  value    = {
    slack_webhook = {
      url      = "https://hooks.slack.com/services/example"
      triggers = ["create"]
    }
  }
}

Auto Decrypt Behaviors

Behavior Details 
Behavior typeauto_decrypt
Recursion and override behaviorRecursively applied to child folders if recursive option is set. May be overridden in the child by adding a behavior on the child. Auto Encrypt will be also overridden.
Only one may be set per folder?Yes
Visible to non-admins?Yes
Requires attachment?No
Value Hash ParameterDescription
gpg_key_id
integer
Your GPG Key ID object to use for this operation. Minimum: 1. References gpg key by ID.
gpg_key_ids
array of integers
Your GPG Key ID objects to use for this operation. At least 1 item. Values must be unique. Each item must be at least 1.
algorithm
string
Required
Must be set to PGP/GPG. If we support other options in the future (like OpenSSL), we will amend this option. Value: PGP/GPG.
suffix
string
Filename suffix that if present will be removed after decryption.
ignore_mdc_error
boolean
Set to true if you want to ignore any errors from the MDC (modification detection code) check.
gpg_key_partner_id
integer
If set, use the Partner's key for decryption. Minimum: 1. References partner by ID.
use_all_private_keys
boolean
If set, use every accessible private GPG key in this behavior's workspace for decryption instead of specific GPG key IDs.
key_md5
string
MD5 digest of the configured public key material. Read only.
private_key_md5
string
MD5 digest of the configured private key material. Read only.
private_key_password_md5
string
MD5 digest of the configured private key password. Read only.

Example Resource

resource "files_behavior" "example_auto_decrypt_behavior" {
  path     = "path"
  behavior = "auto_decrypt"
  value    = {
    auto_decrypt = {
      gpg_key_ids      = [1]
      algorithm        = "PGP/GPG"
      suffix           = ".gpg"
      ignore_mdc_error = false
    }
  }
}

Override Upload Filename Behaviors

Behavior Details 
Behavior typeoverride_upload_filename
Recursion and override behaviorRecursively applied to child folders if recursive option is set. May be overridden in the child by adding a behavior on the child.
Only one may be set per folder?Yes
Visible to non-admins?Yes
Requires attachment?No
Value Hash ParameterDescription
filename_override_pattern
string
Format for filename override. You may use anything from the list %Fl, %Ff, %Fe, %Fb, %Fp, %Fb, %Fn, %pX, %PX. You can mix flags with regular chars and use anything accepted by the standard UNIX date command or strftime.
filename_replace_from
string
If provided, we will replace this string in the filename with the value in filename_replace_to. This replacement is performed after the other patterns are applied.
filename_replace_to
string
If filename_replace_from is provided, this value will be used to replace it in the filename. This replacement is performed after the other patterns are applied.
filename_regex_replace_from
string
If provided, we will replace text matched by this regular expression in the filename with the value in filename_regex_replace_to. Capture groups may be referenced in filename_regex_replace_to using Ruby-style backreferences such as \1 or named backreferences such as \k<name>. JavaScript-style backreferences such as $1 and $&#123;name&#125; are also accepted. This replacement is performed after simple filename replacement.
filename_regex_replace_to
string
If filename_regex_replace_from is provided, this value will replace regular expression matches in the filename. Capture groups may be referenced using \1, \k<name>, $1, or $&#123;name&#125;. This replacement is performed after simple filename replacement.
time_zone
string
Accepts any valid timezone value from the web interface (e.g. "Eastern Time (US & Canada)") or a UTC offset ("-05:00"). Omit parameter for UTC time.

Example Resource

resource "files_behavior" "example_override_upload_filename_behavior" {
  path     = "path"
  behavior = "override_upload_filename"
  value    = {
    override_upload_filename = {
      filename_override_pattern = "%Fb_uploaded%Fe"
    }
  }
}

Permission Fence Behaviors

Behavior Details 
Behavior typepermission_fence
Recursion and override behaviorAlways recursively applied to child folders. May be overridden in the child by adding a behavior on the child.
Only one may be set per folder?Yes
Visible to non-admins?No
Requires attachment?No
Value Hash ParameterDescription
fenced_permissions
string
Which permissions to fence. Currently only 'all' is supported. Value: all.

Example Resource

resource "files_behavior" "example_permission_fence_behavior" {
  path     = "path"
  behavior = "permission_fence"
  value    = {
    permission_fence = {
      fenced_permissions = "all"
    }
  }
}

Limit Filename Length Behaviors

Behavior Details 
Behavior typelimit_filename_length
Recursion and override behaviorRecursively applied to child folders if recursive option is set. May be overridden in the child by adding a behavior on the child.
Only one may be set per folder?Yes
Visible to non-admins?Yes
Requires attachment?No
Value Hash ParameterDescription
max_length
integer
Required
Number of characters to limit filenames to. Minimum: 10.
shorten
boolean
Shorten the filename if it exceeds the maximum length. Default: false.

Example Resource

resource "files_behavior" "example_limit_filename_length_behavior" {
  path     = "path"
  behavior = "limit_filename_length"
  value    = {
    limit_filename_length = {
      max_length = 30
      shorten    = true
    }
  }
}

Organize Files Into Subfolders Behaviors

Behavior Details 
Behavior typeorganize_files_into_subfolders
Recursion and override behaviorNever applied to child folders. Additional behaviors may be set directly on child folders.
Only one may be set per folder?Yes
Visible to non-admins?Yes
Requires attachment?No
Value Hash ParameterDescription
subfolder_name_type
string
Required
Subfolder creation type for this folder. Possible values: regex, extension, created_at, provided_modified_at.
regex
string
Valid regular expression used to determine the subfolder name. This is used when subfolder_name_type is regex.
strftime_format
string
DateTime string format used to determine the subfolder name. This is used when subfolder_name_type is created_at or provided_modified_at.
time_zone
string
Time zone (in Rails TimeZone name format) to be used when interpreting strftime_format. If not set, UTC will be used.
apply_behavior
boolean
If true, apply the current behavior (new or existing) to the files in the folder. Write only.

Example Resource

resource "files_behavior" "example_organize_files_into_subfolders_behavior" {
  path     = "path"
  behavior = "organize_files_into_subfolders"
  value    = {
    organize_files_into_subfolders = {
      subfolder_name_type = "extension"
    }
  }
}

Teams Webhook Behaviors

Behavior Details 
Behavior typeteams_webhook
Recursion and override behaviorRecursively applied to child folders if recursive option is set. Additional behaviors may be set directly on child folders.
Only one may be set per folder?No
Visible to non-admins?No
Requires attachment?No
Value Hash ParameterDescription
url
string
Required
Teams issued URL to send the webhook to.
triggers
array of strings
Leave blank or use * to send webhooks on any action on this folder. Otherwise, specify an array of action types.

Example Resource

resource "files_behavior" "example_teams_webhook_behavior" {
  path     = "path"
  behavior = "teams_webhook"
  value    = {
    teams_webhook = {
      url      = "https://example.webhook.office.com/webhook"
      triggers = ["create"]
    }
  }
}

Google Pub Sub Behaviors

Behavior Details 
Behavior typegoogle_pub_sub
Recursion and override behaviorRecursively applied to child folders if recursive option is set. Additional behaviors may be set directly on child folders.
Only one may be set per folder?No
Visible to non-admins?No
Requires attachment?No
Value Hash ParameterDescription
projects_topics
array of objects
Required
Array of pairs of project_id => topic_id to send the notification to. topic_id must be the Pub/Sub topic ID, not a full resource path or publish endpoint. At least 1 item.
triggers
array of strings
Leave blank or use * to publish a notification on any action on this folder. Otherwise, specify an array of action types.
google_credentials
object
Required
Google Service Account credentials used to send Google Pub/Sub requests.
body
object
Additional body parameters to include in the notification.

Google Pub/Sub project and topic

AttributeDescription
project_id
string
Required
topic_id
string
Required

Google service account credentials

AttributeDescription
type
string
project_id
string
private_key_id
string
private_key
string
Write only.
client_email
string
client_id
string
auth_uri
string
token_uri
string
auth_provider_x509_cert_url
string
client_x509_cert_url
string
universe_domain
string

Example Resource

resource "files_behavior" "example_google_pub_sub_behavior" {
  path     = "path"
  behavior = "google_pub_sub"
  value    = {
    google_pub_sub = {
      projects_topics    = [
        {
          project_id = "my-project"
          topic_id   = "files-events"
        }
      ]
      google_credentials = {
        type                        = "service_account"
        project_id                  = "your-project-id"
        private_key_id              = "your-private-key-id"
        private_key                 = "-----BEGIN PRIVATE KEY-----\\nMIIC..."
        client_email                = "your-service-account@your-project-id.iam.gserviceaccount.com"
        client_id                   = "your-client-id"
        auth_uri                    = "https://accounts.google.com/o/oauth2/auth"
        token_uri                   = "https://oauth2.googleapis.com/token"
        auth_provider_x509_cert_url = "https://www.googleapis.com/oauth2/v1/certs"
        client_x509_cert_url        = "https://www.googleapis.com/robot/v1/metadata/x509/your-service-account%40your-project-id.iam.gserviceaccount.com"
      }
    }
  }
}

Archive Overwritten Or Deleted Files Behaviors

Behavior Details 
Behavior typearchive_overwritten_or_deleted_files
Recursion and override behaviorRecursively applied to child folders if recursive option is set. May be overridden in the child by adding a behavior on the child.
Only one may be set per folder?Yes
Visible to non-admins?No
Requires attachment?No
Value Hash ParameterDescription
archive_path
string
Required
Absolute path where deleted or overwritten items will be relocated.

Example Resource

resource "files_behavior" "example_archive_overwritten_or_deleted_files_behavior" {
  path     = "path"
  behavior = "archive_overwritten_or_deleted_files"
  value    = {
    archive_overwritten_or_deleted_files = {
      archive_path = "/Archive"
    }
  }
}

Auto Recrypt Behaviors

Behavior Details 
Behavior typeauto_recrypt
Recursion and override behaviorRecursively applied to child folders if recursive option is set. May be overridden in the child by adding a behavior on the child. Auto Recrypt will be also overridden.
Only one may be set per folder?Yes
Visible to non-admins?Yes
Requires attachment?No
Value Hash ParameterDescription
decrypt_gpg_key_ids
array of integers
Your GPG Key ID object(s) to use for decryption. At least 1 item. Values must be unique. Each item must be at least 1.
encrypt_gpg_key_ids
array of integers
Your GPG Key ID object(s) to use for encryption. At least 1 item. Values must be unique. Each item must be at least 1.
decrypt_gpg_key_partner_id
integer
If set, use the Partner's key for decryption. Minimum: 1. References partner by ID.
encrypt_gpg_key_partner_id
integer
If set, use the Partner's key for encryption. Minimum: 1. References partner by ID.
ignore_mdc_error
boolean
Set to true if you want to ignore any errors from the MDC (modification detection code) check.
signing_key_id
integer
Optional GPG Key ID object to use for signing the encrypted file. Minimum: 1. References gpg key by ID.
armor
boolean
If true, encrypted files are written as ASCII text.

Example Resource

resource "files_behavior" "example_auto_recrypt_behavior" {
  path     = "path"
  behavior = "auto_recrypt"
  value    = {
    auto_recrypt = {
      decrypt_gpg_key_ids = [1]
      encrypt_gpg_key_ids = [2]
      ignore_mdc_error    = false
      armor               = false
    }
  }
}

Metadata Category Behaviors

Behavior Details 
Behavior typemetadata_category
Recursion and override behaviorAlways recursively applied to child folders. Additional behaviors may be set directly on child folders.
Only one may be set per folder?No
Visible to non-admins?Yes
Requires attachment?No
Value Hash ParameterDescription
metadata_category_id
integer
Required
ID of the MetadataCategory to assign to this folder. Minimum: 1. References metadata category by ID.

Example Resource

resource "files_behavior" "example_metadata_category_behavior" {
  path     = "path"
  behavior = "metadata_category"
  value    = {
    metadata_category = {
      metadata_category_id = 1
    }
  }
}

Auto Unzip Behaviors

Behavior Details 
Behavior typeauto_unzip
Recursion and override behaviorRecursively applied to child folders if recursive option is set. May be overridden in the child by adding a behavior on the child.
Only one may be set per folder?Yes
Visible to non-admins?Yes
Requires attachment?No
Value Hash ParameterDescription
destination_path
string
Required
Absolute folder path where ZIP contents will be extracted. Supports automation-style path tokens such as strftime directives, %p1, %P1, %Ff, and %tf.
path_time_zone
string
Timezone to use when rendering timestamp tokens in destination_path.

Example Resource

resource "files_behavior" "example_auto_unzip_behavior" {
  path     = "path"
  behavior = "auto_unzip"
  value    = {
    auto_unzip = {
      destination_path = "/Uploads/Unzipped/%Y/%m/%d"
    }
  }
}

Remote Server Metadata Index Behaviors

Behavior Details 
Behavior typeremote_server_metadata_index
Recursion and override behaviorAlways recursively applied to child folders. Cannot be overridden by behaviors on child folders.
Only one may be set per folder?Yes
Visible to non-admins?Yes
Requires attachment?No
Value Hash ParameterDescription
interval_minutes
integer
Frequency, in minutes, for polling the remote folder and indexing remote metadata locally. Default: 1440. Minimum: 5.
initial_scan_completed
boolean
System-managed flag that indicates whether the initial metadata index scan has completed. Read only.

Example Resource

resource "files_behavior" "example_remote_server_metadata_index_behavior" {
  path     = "path"
  behavior = "remote_server_metadata_index"
  value    = {
    remote_server_metadata_index = {
      interval_minutes = 1440
    }
  }
}

Malware Scanning Behaviors

Behavior Details 
Behavior typemalware_scanning
Recursion and override behaviorAlways recursively applied to child folders. Cannot be overridden by behaviors on child folders.
Only one may be set per folder?Yes
Visible to non-admins?Yes
Requires attachment?No
Value Hash ParameterDescription

Example Resource

resource "files_behavior" "example_malware_scanning_behavior" {
  path     = "path"
  behavior = "malware_scanning"
  value    = {
    malware_scanning = {
    }
  }
}

Resource Schema

Required

PropertyDescription
path
String
Folder path. Note that Behavior paths cannot be updated once initially set. You will need to remove and re-create the behavior on the new path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
behavior
String
Behavior type.
Possible values: webhook, file_expiration, auto_encrypt, lock_subfolders, storage_region, serve_publicly, create_user_folders, inbox, limit_file_extensions, limit_file_regex, amazon_sns, watermark, remote_server_mount, slack_webhook, auto_decrypt, override_upload_filename, permission_fence, limit_filename_length, organize_files_into_subfolders, teams_webhook, google_pub_sub, archive_overwritten_or_deleted_files, auto_recrypt, metadata_category, auto_unzip, remote_server_metadata_index, malware_scanning

Optional

PropertyDescription
name
String
Name for this behavior.
description
String
Description for this behavior.
value
Dynamic
Settings for this behavior. Wrap the value under the selected behavior name. See the Behavior sections above for fields and examples.
disable_parent_folder_behavior
Bool
If true, the parent folder's behavior will be disabled for this folder and its children.
recursive
Bool
Whether this behavior is recursive for this record. always behaviors are always true, never behaviors are always false, and sometimes behaviors may be either value.

Read Only

PropertyDescription
id
Int64
Folder behavior ID
attachment_url
String
URL for attached file
public_hosting_url
String
Public URL for this publicly hosted folder when the Serve Publicly behavior has a key configured. When a Custom Domain with public_hosting destination is attached to this behavior, the URL uses that domain. Otherwise it uses the site's subdomain.hosted-by-files.com host.
inherited
Bool
If true, this behavior is inherited from a higher scope rather than owned by the requested workspace.
managed
Bool
If true, this behavior is controlled by a parent-site policy and cannot be modified locally.
root_behavior_site_admin_only
Bool
If true, this behavior may only be modified by a site admin because it is at the site root or disables a root behavior.

Example Resource

resource "files_behavior" "example_behavior" {
  value                          = {
    webhook = {
      urls     = ["https://example.com/webhook"]
      method   = "POST"
      encoding = "JSON"
    }
  }
  disable_parent_folder_behavior = false
  recursive                      = false
  name                           = "example"
  description                    = "example"
  path                           = "path"
  behavior                       = "webhook"
}

Resource Import

This Resource supports importing using the following syntax:

Example Import Command

# Behaviors can be imported by specifying the id.
terraform import files_behavior.example_behavior 1

Data Source Schema

Required

PropertyDescription
id
Int64
Folder behavior ID

Read Only

PropertyDescription
path
String
Folder path. Note that Behavior paths cannot be updated once initially set. You will need to remove and re-create the behavior on the new path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
attachment_url
String
URL for attached file
behavior
String
Behavior type.
Possible values: webhook, file_expiration, auto_encrypt, lock_subfolders, storage_region, serve_publicly, create_user_folders, inbox, limit_file_extensions, limit_file_regex, amazon_sns, watermark, remote_server_mount, slack_webhook, auto_decrypt, override_upload_filename, permission_fence, limit_filename_length, organize_files_into_subfolders, teams_webhook, google_pub_sub, archive_overwritten_or_deleted_files, auto_recrypt, metadata_category, auto_unzip, remote_server_metadata_index, malware_scanning
name
String
Name for this behavior.
description
String
Description for this behavior.
value
Dynamic
Settings for this behavior. Wrap the value under the selected behavior name. See the Behavior sections above for fields and examples.
public_hosting_url
String
Public URL for this publicly hosted folder when the Serve Publicly behavior has a key configured. When a Custom Domain with public_hosting destination is attached to this behavior, the URL uses that domain. Otherwise it uses the site's subdomain.hosted-by-files.com host.
disable_parent_folder_behavior
Bool
If true, the parent folder's behavior will be disabled for this folder and its children.
recursive
Bool
Whether this behavior is recursive for this record. always behaviors are always true, never behaviors are always false, and sometimes behaviors may be either value.
inherited
Bool
If true, this behavior is inherited from a higher scope rather than owned by the requested workspace.
managed
Bool
If true, this behavior is controlled by a parent-site policy and cannot be modified locally.
root_behavior_site_admin_only
Bool
If true, this behavior may only be modified by a site admin because it is at the site root or disables a root behavior.

Example Data Source

data "files_behavior" "example_behavior" {
  id           = 1
  value_format = "typed"
}