API Keys

An APIKey is a key that allows programmatic access to your Site.

API keys confer all the permissions of the user who owns them unless the key uses a restricted permission set. If an API key is created without a user owner, it is considered a site-wide API key. Site-wide API keys with the files_only permission set are restricted to file-user permissions and workspace scoping.

We recommend registering API keys to service users wherever possible and then using User or Group Permissions to restrict that API Key appropriately.

Resource Schema

Required

PropertyDescription
name
String
Internal name for the API Key. For your use.

Optional

PropertyDescription
description
String
User-supplied description of API key.
expires_at
String
API Key expiration date
aws_style_credentials
Bool
If true, this API key will be usable with AWS-compatible endpoints, such as our Inbound S3-compatible endpoint.
permission_set
String
Permissions for this API Key. Keys with the desktop_app permission set only have the ability to do the functions provided in our Desktop App (File and Share Link operations). Keys with the office_integration permission set are auto generated, and automatically expire, to allow users to interact with office integration platforms. Keys with the files_only permission set can perform file operations as a full-access file user in the key's workspace scope, but cannot use site admin, workspace admin, folder admin, group admin, partner admin, or billing privileges from the owning user.
Possible values: none, full, desktop_app, sync_app, office_integration, mobile_app, files_only
user_id
Int64
User ID for the owner of this API Key. May be blank for Site-wide API Keys.
workspace_id
Int64
Workspace ID for this API Key. 0 means the default workspace.
path
String
Folder path restriction for office_integration permission set API keys.

Read Only

PropertyDescription
id
Int64
API Key ID
descriptive_label
String
Unique label that describes this API key. Useful for external systems where you may have API keys from multiple accounts and want a human-readable label for each key.
created_at
String
Time which API Key was created
key
String
API Key actual key string
aws_access_key_id
String
AWS Access Key ID to use with AWS-compatible endpoints, such as our Inbound S3-compatible endpoint.
aws_secret_key
String
AWS Secret Key to use with AWS-compatible endpoints, such as our Inbound S3-compatible endpoint.
last_use_at
String
API Key last used - note this value is only updated once per 3 hour period, so the 'actual' time of last use may be up to 3 hours later than this timestamp.
platform
String
If this API key represents a Desktop app, what platform was it created on?
site_id
Int64
Site ID
site_name
String
Site Name
url
String
URL for API host.

Example Resource

resource "files_api_key" "example_api_key" {
  user_id               = 1
  description           = "example"
  expires_at            = "2000-01-01T01:00:00Z"
  name                  = "My Main API Key"
  aws_style_credentials = true
  path                  = "shared/docs"
  permission_set        = "full"
  workspace_id          = 1
}

Resource Import

This Resource supports importing using the following syntax:

Example Import Command

# Api Keys can be imported by specifying the id.
terraform import files_api_key.example_api_key 1

Data Source Schema

Required

PropertyDescription
id
Int64
API Key ID

Read Only

PropertyDescription
descriptive_label
String
Unique label that describes this API key. Useful for external systems where you may have API keys from multiple accounts and want a human-readable label for each key.
description
String
User-supplied description of API key.
created_at
String
Time which API Key was created
expires_at
String
API Key expiration date
key
String
API Key actual key string
aws_style_credentials
Bool
If true, this API key will be usable with AWS-compatible endpoints, such as our Inbound S3-compatible endpoint.
aws_access_key_id
String
AWS Access Key ID to use with AWS-compatible endpoints, such as our Inbound S3-compatible endpoint.
aws_secret_key
String
AWS Secret Key to use with AWS-compatible endpoints, such as our Inbound S3-compatible endpoint.
last_use_at
String
API Key last used - note this value is only updated once per 3 hour period, so the 'actual' time of last use may be up to 3 hours later than this timestamp.
name
String
Internal name for the API Key. For your use.
permission_set
String
Permissions for this API Key. Keys with the desktop_app permission set only have the ability to do the functions provided in our Desktop App (File and Share Link operations). Keys with the office_integration permission set are auto generated, and automatically expire, to allow users to interact with office integration platforms. Keys with the files_only permission set can perform file operations as a full-access file user in the key's workspace scope, but cannot use site admin, workspace admin, folder admin, group admin, partner admin, or billing privileges from the owning user.
Possible values: none, full, desktop_app, sync_app, office_integration, mobile_app, files_only
platform
String
If this API key represents a Desktop app, what platform was it created on?
site_id
Int64
Site ID
site_name
String
Site Name
url
String
URL for API host.
user_id
Int64
User ID for the owner of this API Key. May be blank for Site-wide API Keys.
workspace_id
Int64
Workspace ID for this API Key. 0 means the default workspace.

Example Data Source

data "files_api_key" "example_api_key" {
  id = 1
}