public_keys
Public Keys

Create Public Key

Changed on

Create Public Key

post/public_keys

Request

  • Base URL
    https://app.files.com/api/rest/v1
  • URL
    https://app.files.com/api/rest/v1/public_keys
  • Auth
    none declared

Request body multipart/form-data

user_idinteger

User ID. Provide a value of 0 to operate the current session's user.

titlestring required

Internal reference for key.

public_keystring

Actual contents of SSH key.

generate_keypairboolean

If true, generate a new SSH key pair. Can not be used with public_key

generate_private_key_passwordstring

Password for the private key. Used for the generation of the key. Will be ignored if generate_keypair is false.

generate_algorithmstring

Type of key to generate. One of rsa, dsa, ecdsa, ed25519. Used for the generation of the key. Will be ignored if generate_keypair is false.

generate_lengthinteger

Length of key to generate. If algorithm is ecdsa, this is the signature size. Used for the generation of the key. Will be ignored if generate_keypair is false.

Example request

{
  "title": "My Main Key",
  "generate_private_key_password": "[your private key password]",
  "generate_algorithm": "rsa",
  "generate_length": 4096
}

Response

The PublicKeys object.

idinteger

Public key ID

workspace_idinteger

Workspace ID (0 for default workspace).

titlestring

Public key title

created_atstring date-time

Public key created at date/time

expires_atstring date-time

Public key expiration date/time

expiredboolean

Is this public key expired?

fingerprintstring

Public key fingerprint (MD5)

fingerprint_sha256string

Public key fingerprint (SHA256)

status'error' | 'not_set' | 'to_be_generated' | 'generating' | 'complete'

Only returned when generating keys. Can be invalid, not_generated, generating, complete

last_login_atstring date-time

Key's most recent login time via SFTP

generated_private_keystring

Only returned when generating keys. Private key generated for the user.

generated_public_keystring

Only returned when generating keys. Public key generated for the user.

usernamestring

Username of the user this public key is associated with

user_idinteger

User ID this public key is associated with

Example response

{
  "id": 1,
  "title": "My public key",
  "created_at": "2000-01-01T01:00:00Z",
  "expires_at": "2000-01-01T01:00:00Z",
  "expired": true,
  "fingerprint": "43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8",
  "fingerprint_sha256": "V5Q5t/ghT3R8Tol5GX9385bzmpygWVRnLuI9EXNrjCX",
  "status": "complete",
  "last_login_at": "2000-01-01T01:00:00Z",
  "generated_private_key": "example",
  "generated_public_key": "example",
  "username": "User",
  "user_id": 1
}

Changes