PGP Key API Code Samples

Selection of code samples that demonstrate the use of the PGP Key API. Copy and edit these code samples to suit your needs.

When using the code samples, remember to replace:

  • {vanity_name} with your tenant name
  • {api_key} with your API key
  • {security_token} with a valid security token

These code samples may not include all available parameters and request body fields for each endpoint. For the endpoint's full request schema, see "PGP Key" in API Reference.

Download a public encryption key

Use this sample request to generate a PGP key pair and retrieve the public encryption key. You can optionally use an empty request body of {} to generate a key with a default validity of 2 years from the time of creation.

Copy
cURL sample request: Download a public encryption key
curl -X POST --url 'https://{vanity_name}.api.visier.io/v1/api/pgpkey' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-d '{ 
      "expirationDate": "2026-12-12" 
    }'

The response returns the key pair ID, details about the key pair, and the public key that you can use to encrypt your files.

Retrieve a PGP public key using the key ID

Use this sample request to retrieve a specific public key using its associated key ID.

Copy
cURL sample request: Retrieve a public key
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1/api/pgpkey/9c84ec719fb0c0a9' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'

The response returns the key pair ID, details about the key pair, and the public key that you can use to encrypt your files.

Retrieve all PGP public keys

Use this sample request to retrieve all the PGP public keys in your tenant.

Copy
cURL sample request: Retrieve all public keys
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1/api/pgpkey' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'

The response returns the details about each key pair in your tenant.

Delete a PGP key pair

Use this sample request to delete a specific PGP key pair.

Copy
cURL sample request: Delete a key pair
curl -X DELETE --url 'https://{vanity_name}.api.visier.io/v1/api/pgpkey/9c84ec719fb0c0a9' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'

The response returns the ID of the key pair that was deleted.