# Customer PGP Public Keys

Note

This feature is experimental and is disabled by default. To enable it, add ENABLE_PGP_ENCRYPTION=true to the .env file.

Customer's PGP public keys are used to automatically encrypt outgoing emails. Your customer will then use his private key to decrypt the message.

# The key object

  • id integer

    The system-generated ID of the key.

  • name string

    The name of the public key.

  • fingerprint string

    The key fingerprint.

  • expires_at timestamp

    The timestamp of expiration.

  • customer_email object

    The customer email attached to the key.

  • created_at string

    The timestamp when the customer was created.

  • updated_at string

    The timestamp when the customer was last updated.

# The key object

{
  "id": 1,
  "name": "j@example.org",
  "fingerprint": "348j23432f457231g5weuyvk213y4as1v4sgb1e2sd",
  "expires_at": "2019-04-25T17:51:31+00:00",
  "customer_email": {
    "id": 1,
    "email": "j@example.org",
    "updated_at": "2019-04-25T17:51:31+00:00",
    "created_at": "2019-04-25T17:51:31+00:00"
  },
  "updated_at": "2019-04-25T17:51:31+00:00",
  "created_at": "2019-04-25T17:51:31+00:00"
}

# Create a PGP public key

  • customer_email_id integer required

    The ID of the customer's email.

  • name string optional

    The key's name. If none is provided, the key's UID is used.

  • content string required

    The key content.

# Sample request

curl https://www.yourdomain.com/api/v1/accounts/1/customers/1/pgp-public-keys \
  --request POST \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <access-token>" \
  -d customer_email_id=1
  -d content="[base64-encoded key content]"

# Sample successful response

{
  "id": 1,
  "name": "j@example.org",
  "fingerprint": "348j23432f457231g5weuyvk213y4as1v4sgb1e2sd",
  "expires_at": "2019-04-25T17:51:31+00:00",
  "customer_email": {
    "id": 1,
    "email": "j@example.org",
    "updated_at": "2019-04-25T17:51:31+00:00",
    "created_at": "2019-04-25T17:51:31+00:00"
  },
  "updated_at": "2019-04-25T17:51:31+00:00",
  "created_at": "2019-04-25T17:51:31+00:00"
}

# Retrieve a PGP public key

# Sample request

curl https://www.yourdomain.com/api/v1/accounts/1/customers/1/pgp-public-keys/1 \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <access-token>" \
  -G

# Sample successful response

{
  "id": 1,
  "name": "j@example.org",
  "fingerprint": "348j23432f457231g5weuyvk213y4as1v4sgb1e2sd",
  "expires_at": "2019-04-25T17:51:31+00:00",
  "customer_email": {
    "id": 1,
    "email": "j@example.org",
    "updated_at": "2019-04-25T17:51:31+00:00",
    "created_at": "2019-04-25T17:51:31+00:00"
  },
  "updated_at": "2019-04-25T17:51:31+00:00",
  "created_at": "2019-04-25T17:51:31+00:00"
}

# Update a PGP public key

  • name string required

    The key's name.

# Sample request

curl https://www.yourdomain.com/api/v1/accounts/1/customers/1/pgp-public-keys/1 \
  --request PUT \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <access-token>" \
  -d name="Jane Doe PGP Key"

# Sample successful response

{
  "id": 1,
  "name": "Jane Doe PGP Key",
  "fingerprint": "348j23432f457231g5weuyvk213y4as1v4sgb1e2sd",
  "expires_at": "2019-04-25T17:51:31+00:00",
  "customer_email": {
    "id": 1,
    "email": "j@example.org",
    "updated_at": "2019-04-25T17:51:31+00:00",
    "created_at": "2019-04-25T17:51:31+00:00"
  },
  "updated_at": "2019-04-25T17:51:31+00:00",
  "created_at": "2019-04-25T17:51:31+00:00"
}

# Delete a PGP public key

# Sample request

curl https://www.yourdomain.com/api/v1/accounts/1/customers/1/pgp-public-keys/1 \
  --request DELETE \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <access-token>"

If successful, the above request will return an empty response with 204 HTTP status code.

# List all PGP public keys

# Sample request

curl https://www.yourdomain.com/api/v1/accounts/1/customers/1/pgp-public-keys \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <access-token>" \
  -G

# Sample successful response

{
  "data": [
    {
      "id": 1,
      "name": "Jane Doe PGP Key",
      "fingerprint": "348j23432f457231g5weuyvk213y4as1v4sgb1e2sd",
      "expires_at": "2019-04-25T17:51:31+00:00",
      "customer_email": {
        "id": 1,
        "email": "j@example.org",
        "updated_at": "2019-04-25T17:51:31+00:00",
        "created_at": "2019-04-25T17:51:31+00:00"
      },
      "updated_at": "2019-04-25T17:51:31+00:00",
      "created_at": "2019-04-25T17:51:31+00:00"
    },
    {...}
  ]
}