GPG Keys

A GPGKey object on Files.com is used to securely store both the private and public keys associated with a GPG (GNU Privacy Guard) encryption key pair. This object enables the encryption and decryption of data using GPG, allowing you to protect sensitive information.

The private key is kept confidential and is used for decrypting data or signing messages to prove authenticity, while the public key is used to encrypt messages that only the owner of the private key can decrypt.

By storing both keys together in a GPGKey object, Files.com makes it easier to understand encryption operations, ensuring secure and efficient handling of encrypted data within the platform.

List GPG Keys

Endpoint

GET/gpg_keys

Return Object

GpgKey[]

Authorization Requirement

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

Request Parameters

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

Additional Arguments

Example Request

curl "https://app.files.com/api/rest/v1/gpg_keys.json?user_id=1" \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

[
  {
    "id": 1,
    "workspace_id": 1,
    "expires_at": "2000-01-01T01:00:00Z",
    "name": "key name",
    "partner_id": 1,
    "partner_name": "example",
    "user_id": 1,
    "public_key_md5": "7f8bc1210b09b9ddf469e6b6b8920e76",
    "private_key_md5": "ab236cfe4a195f0226bc2e674afdd6b0",
    "generated_public_key": "7f8bc1210b09b9ddf469e6b6b8920e76",
    "generated_private_key": "ab236cfe4a195f0226bc2e674afdd6b0",
    "private_key_password_md5": "[the GPG private key password]"
  }
]

Show GPG Key

Endpoint

GET/gpg_keys/{id}

Return Object

GpgKey

Authorization Requirement

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

Request Parameters

ParameterDescription
id
int64
Required
Gpg Key ID.

Example Request

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

Example Response

{
  "id": 1,
  "workspace_id": 1,
  "expires_at": "2000-01-01T01:00:00Z",
  "name": "key name",
  "partner_id": 1,
  "partner_name": "example",
  "user_id": 1,
  "public_key_md5": "7f8bc1210b09b9ddf469e6b6b8920e76",
  "private_key_md5": "ab236cfe4a195f0226bc2e674afdd6b0",
  "generated_public_key": "7f8bc1210b09b9ddf469e6b6b8920e76",
  "generated_private_key": "ab236cfe4a195f0226bc2e674afdd6b0",
  "private_key_password_md5": "[the GPG private key password]"
}

Create GPG Key

Endpoint

POST/gpg_keys

Return Object

GpgKey

Authorization Requirement

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

Request Parameters

ParameterDefaultDescription
user_id
int64
User ID. Provide a value of 0 to operate the current session's user.
partner_id
int64
Partner ID who owns this GPG Key, if applicable.
public_key
string
The GPG public key
private_key
string
The GPG private key
private_key_password
string
The GPG private key password
name
string
Required
GPG key name.
workspace_id
int64
0Workspace ID (0 for default workspace).
generate_expires_at
string
Expiration date of the key. Used for the generation of the key. Will be ignored if generate_keypair is false.
generate_keypair
boolean
If true, generate a new GPG key pair. Can not be used with public_key/private_key
generate_full_name
string
Full name of the key owner. Used for the generation of the key. Will be ignored if generate_keypair is false.
generate_email
string
Email address of the key owner. Used for the generation of the key. Will be ignored if generate_keypair is false.

Example Request

curl https://app.files.com/api/rest/v1/gpg_keys.json \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"user_id":1,"partner_id":1,"name":"key name","workspace_id":0,"generate_expires_at":"2025-06-19 12:00:00","generate_keypair":false,"generate_full_name":"John Doe","generate_email":"jdoe@example.com"}' \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "id": 1,
  "workspace_id": 1,
  "expires_at": "2000-01-01T01:00:00Z",
  "name": "key name",
  "partner_id": 1,
  "partner_name": "example",
  "user_id": 1,
  "public_key_md5": "7f8bc1210b09b9ddf469e6b6b8920e76",
  "private_key_md5": "ab236cfe4a195f0226bc2e674afdd6b0",
  "generated_public_key": "7f8bc1210b09b9ddf469e6b6b8920e76",
  "generated_private_key": "ab236cfe4a195f0226bc2e674afdd6b0",
  "private_key_password_md5": "[the GPG private key password]"
}

Update GPG Key

Endpoint

PATCH/gpg_keys/{id}

Return Object

GpgKey

Authorization Requirement

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

Request Parameters

ParameterDescription
id
int64
Required
Gpg Key ID.
partner_id
int64
Partner ID who owns this GPG Key, if applicable.
public_key
string
The GPG public key
private_key
string
The GPG private key
private_key_password
string
The GPG private key password
name
string
GPG key name.

Example Request

curl https://app.files.com/api/rest/v1/gpg_keys/{id}.json \
  -X PATCH \
  -H 'Content-Type: application/json' \
  -d '{"partner_id":1,"name":"key name"}' \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "id": 1,
  "workspace_id": 1,
  "expires_at": "2000-01-01T01:00:00Z",
  "name": "key name",
  "partner_id": 1,
  "partner_name": "example",
  "user_id": 1,
  "public_key_md5": "7f8bc1210b09b9ddf469e6b6b8920e76",
  "private_key_md5": "ab236cfe4a195f0226bc2e674afdd6b0",
  "generated_public_key": "7f8bc1210b09b9ddf469e6b6b8920e76",
  "generated_private_key": "ab236cfe4a195f0226bc2e674afdd6b0",
  "private_key_password_md5": "[the GPG private key password]"
}

Delete GPG Key

Endpoint

DELETE/gpg_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 Folder Admin permissions.

Request Parameters

ParameterDescription
id
int64
Required
Gpg Key ID.

Example Request

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

The GpgKey Object

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

AttributeDescription
id
int64
GPG key ID.
workspace_id
int64
Workspace ID (0 for default workspace).
expires_at
date-time
GPG key expiration date.
name
string
GPG key name.
partner_id
int64
Partner ID who owns this GPG Key, if applicable.
partner_name
string
Name of the Partner who owns this GPG Key, if applicable.
user_id
int64
User ID who owns this GPG Key, if applicable.
public_key_md5
string
MD5 hash of the GPG public key
private_key_md5
string
MD5 hash of the GPG private key.
generated_public_key
string
GPG public key
generated_private_key
string
GPG private key.
private_key_password_md5
string
GPG private key password. Only required for password protected keys.

Example GpgKey Object

{
  "id": 1,
  "workspace_id": 1,
  "expires_at": "2000-01-01T01:00:00Z",
  "name": "key name",
  "partner_id": 1,
  "partner_name": "example",
  "user_id": 1,
  "public_key_md5": "7f8bc1210b09b9ddf469e6b6b8920e76",
  "private_key_md5": "ab236cfe4a195f0226bc2e674afdd6b0",
  "generated_public_key": "7f8bc1210b09b9ddf469e6b6b8920e76",
  "generated_private_key": "ab236cfe4a195f0226bc2e674afdd6b0",
  "private_key_password_md5": "[the GPG private key password]"
}