SFTP Host Keys

An SFTP Host Key is a cryptographic key used to verify the identity of the server during an SFTP connection. This allows the client to be sure that it is connecting to the intended server, preventing man-in-the-middle attacks and ensuring secure communication between the client and Files.com.

Files.com allows you to provide custom SFTP Host Keys, which is particularly useful when migrating to Files.com from an existing SFTP server, allowing the Files.com platform to match your previously-installed host key for a seamless transition.

List SFTP Host Keys

Endpoint

GET/sftp_host_keys

Return Object

SftpHostKey[]

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Additional Arguments

Example Request

curl https://app.files.com/api/rest/v1/sftp_host_keys.json \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

[
  {
    "active": true,
    "id": 1,
    "name": "My Key",
    "key_type": "ssh-rsa",
    "fingerprint_md5": "12:7e:f8:61:78:a4:b2:c2:ee:12:51:92:25:a7:42:cc",
    "fingerprint_sha256": "SHA256:5ANRkDpXWA+PgOquzZAG9RtQ1Bt8KXYAH2hecr7LQk8"
  }
]

Show SFTP Host Key

Endpoint

GET/sftp_host_keys/{id}

Return Object

SftpHostKey

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Request Parameters

ParameterDescription
id
int64
Required
Sftp Host Key ID.

Example Request

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

Example Response

{
  "active": true,
  "id": 1,
  "name": "My Key",
  "key_type": "ssh-rsa",
  "fingerprint_md5": "12:7e:f8:61:78:a4:b2:c2:ee:12:51:92:25:a7:42:cc",
  "fingerprint_sha256": "SHA256:5ANRkDpXWA+PgOquzZAG9RtQ1Bt8KXYAH2hecr7LQk8"
}

Create SFTP Host Key

Endpoint

POST/sftp_host_keys

Return Object

SftpHostKey

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Request Parameters

ParameterDefaultDescription
active
boolean
falseIf true, use this SFTP Host Key.
name
string
The friendly name of this SFTP Host Key.
private_key
string
The private key data.

Example Request

curl https://app.files.com/api/rest/v1/sftp_host_keys.json \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"active":true,"name":"My Key"}' \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "active": true,
  "id": 1,
  "name": "My Key",
  "key_type": "ssh-rsa",
  "fingerprint_md5": "12:7e:f8:61:78:a4:b2:c2:ee:12:51:92:25:a7:42:cc",
  "fingerprint_sha256": "SHA256:5ANRkDpXWA+PgOquzZAG9RtQ1Bt8KXYAH2hecr7LQk8"
}

Update SFTP Host Key

Endpoint

PATCH/sftp_host_keys/{id}

Return Object

SftpHostKey

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Request Parameters

ParameterDescription
id
int64
Required
Sftp Host Key ID.
active
boolean
If true, use this SFTP Host Key.
name
string
The friendly name of this SFTP Host Key.
private_key
string
The private key data.

Example Request

curl https://app.files.com/api/rest/v1/sftp_host_keys/{id}.json \
  -X PATCH \
  -H 'Content-Type: application/json' \
  -d '{"active":true,"name":"My Key"}' \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "active": true,
  "id": 1,
  "name": "My Key",
  "key_type": "ssh-rsa",
  "fingerprint_md5": "12:7e:f8:61:78:a4:b2:c2:ee:12:51:92:25:a7:42:cc",
  "fingerprint_sha256": "SHA256:5ANRkDpXWA+PgOquzZAG9RtQ1Bt8KXYAH2hecr7LQk8"
}

Delete SFTP Host Key

Endpoint

DELETE/sftp_host_keys/{id}

Return Object

No return value.

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Request Parameters

ParameterDescription
id
int64
Required
Sftp Host Key ID.

Example Request

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

The SftpHostKey Object

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

AttributeDescription
active
boolean
If true, use this SFTP Host Key.
id
int64
SFTP Host Key ID
name
string
The friendly name of this SFTP Host Key.
key_type
string
SSH key type
fingerprint_md5
string
MD5 Fingerprint of the public key
fingerprint_sha256
string
SHA256 Fingerprint of the public key

Example SftpHostKey Object

{
  "active": true,
  "id": 1,
  "name": "My Key",
  "key_type": "ssh-rsa",
  "fingerprint_md5": "12:7e:f8:61:78:a4:b2:c2:ee:12:51:92:25:a7:42:cc",
  "fingerprint_sha256": "SHA256:5ANRkDpXWA+PgOquzZAG9RtQ1Bt8KXYAH2hecr7LQk8"
}