Secret Manager API
  • 2 Minutes to read
  • Dark
    Light
  • PDF

Secret Manager API

  • Dark
    Light
  • PDF

Article summary

The document outlines the usage of API keys for secret management in the Secure Workspace, detailing how to retrieve and update secrets with API calls, including examples for both plain text and encrypted data handling.

Prerequisites

  • An API key is required, consisting of apikey_id and apikey_secret_key.
  • Please search documentation with regarding how to create and retrieve Secret API key

Retrieving Secrets

Fetching the List of Secrets

To get a list of all secrets accessible by the API key:


curl --location --request POST 'https://${mytenant}.us.ssw.splashtop.com/server/api-key-access/inspect/' \
--header 'Content-Type: application/json' \
--data-raw '{
 "api_key_id": "${apikey_id}",
 "api_key_secret_key": "${apikey_secret_key}"
}'

# response example
{
    "read": true,
    "write": false,
    "restrict_to_secrets": true,
    "allow_insecure_access": true,
    "api_key_secrets": [
        {
            "secret_id": "467ccfd5-b04f-4c5a-95de-927046a6c5fa",
            "secret_title": "my windows",
            "write_date": "2023-11-30 09:31:35.427375 +0000 UTC"
        },
        {
            "secret_id": "006fa005-112e-41e4-8877-6ba08c47b837",
            "secret_title": "myssh",
            "write_date": "2024-01-24 02:21:38.709925 +0000 UTC"
        }
    ]
}

To fetch list of secrets by using secret_filter:

curl --location --request POST 'https://${mytenant}.us.ssw.splashtop.com/server/api-key-access/secret_list/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "api_key_id": ${apikey_id},
    "api_key_secret_key": ${apikey_secret_key},
    "secret_filter": "{\"zero_trust_application_password_title\":\"s.+\"}"
}'

# secret_filter support regex

# e.g. to list filtered field zero_trust_application_password_title: sshhjhkj
# secret_filter": "{\"zero_trust_application_password_title\":\"sshhjhkj\"}"

# e.g. to list filtered field zero_trust_application_password_title with prefix 's'
# "secret_filter": "{\"zero_trust_application_password_title\":\"s.+\"}"
    
# Response example:
[
    {
        "secret_id": "006fa005-112e-41e4-8877-6ba08c47b837",
        "zero_trust_application": "demo/test/applications/ssh@njc3ztrhmmet.app.e1-singapore-c1-usw2.dev.ztw.splashtop.com/all/ssh",
        "zero_trust_application_desktop_app": [
            "Terminal",
            "WindowsTerminal.exe"
        ],
        "zero_trust_application_id": "677e4a2a-c165-4351-8962-6836df69ffa8",
        "zero_trust_application_password_fqdn": "njc3ztrhmmet.app.e1-singapore-c1-usw2.dev.ztw.splashtop.com",
        "zero_trust_application_password_header": "",
        "zero_trust_application_password_header_value": "",
        "zero_trust_application_password_http_basic_auth_credentials": "",
        "zero_trust_application_password_http_basic_auth_type": "",
        "zero_trust_application_password_http_proxy_auth_credentials": "",
        "zero_trust_application_password_http_proxy_auth_type": "",
        "zero_trust_application_password_k8s_private_key": "",
        "zero_trust_application_password_k8s_public_key": "",
        "zero_trust_application_password_notes": "123",
        "zero_trust_application_password_password": "ssh",
        "zero_trust_application_password_ssh_passphrase": "",
        "zero_trust_application_password_ssh_private_key": "",
        "zero_trust_application_password_ssh_public_key": "",
        "zero_trust_application_password_ssh_username": "",
        "zero_trust_application_password_title": "sshhjhkj",
        "zero_trust_application_password_type": "ztna",
        "zero_trust_application_password_username": "ssh"
    }
]

Fetching Secrets Individually

To retrieve individual secrets:


curl --location --request POST 'https://${mytenant}.us.ssw.splashtop.com/server/api-key-access/secret/' \
--header 'Content-Type: application/json' \
--data-raw '{
 "api_key_id": "${apikey_id}",
 "secret_id": "${secret_id}",
 "api_key_secret_key": "${apikey_secret_key}"
}'

# response example
[
    {
        "secret_id": "006fa005-112e-41e4-8877-6ba08c47b837",
        "zero_trust_application": "demo/test/applications/ssh@njc3ztrhmmet.app.e1-singapore-c1-usw2.dev.ztw.splashtop.com/all/ssh",
        "zero_trust_application_desktop_app": [
            "Terminal",
            "WindowsTerminal.exe"
        ],
        "zero_trust_application_id": "677e4a2a-c165-4351-8962-6836df69ffa8",
        "zero_trust_application_password_fqdn": "njc3ztrhmmet.app.e1-singapore-c1-usw2.dev.ztw.splashtop.com",
        "zero_trust_application_password_header": "",
        "zero_trust_application_password_header_value": "",
        "zero_trust_application_password_http_basic_auth_credentials": "",
        "zero_trust_application_password_http_basic_auth_type": "",
        "zero_trust_application_password_http_proxy_auth_credentials": "",
        "zero_trust_application_password_http_proxy_auth_type": "",
        "zero_trust_application_password_k8s_private_key": "",
        "zero_trust_application_password_k8s_public_key": "",
        "zero_trust_application_password_notes": "123",
        "zero_trust_application_password_password": "ssh",
        "zero_trust_application_password_ssh_passphrase": "",
        "zero_trust_application_password_ssh_private_key": "",
        "zero_trust_application_password_ssh_public_key": "",
        "zero_trust_application_password_ssh_username": "",
        "zero_trust_application_password_title": "sshhjhkj",
        "zero_trust_application_password_type": "ztna",
        "zero_trust_application_password_username": "ssh"
    },
    {
        "secret_id": "467ccfd5-b04f-4c5a-95de-927046a6c5fa",
        "zero_trust_application": "demo/applications/OpenSSH@zguwndnlmzet.app.e1-singapore-c1-usw2.dev.ztw.splashtop.com/all/ssh",
        "zero_trust_application_desktop_app": [
            "Terminal",
            "WindowsTerminal.exe"
        ],
        "zero_trust_application_password_fqdn": "zguwndnlmzet.app.e1-singapore-c1-usw2.dev.ztw.splashtop.com",
        "zero_trust_application_password_header": "",
        "zero_trust_application_password_header_value": "",
        "zero_trust_application_password_http_basic_auth_credentials": "",
        "zero_trust_application_password_http_basic_auth_type": "",
        "zero_trust_application_password_http_proxy_auth_credentials": "",
        "zero_trust_application_password_http_proxy_auth_type": "",
        "zero_trust_application_password_k8s_private_key": "",
        "zero_trust_application_password_k8s_public_key": "",
        "zero_trust_application_password_notes": "",
        "zero_trust_application_password_password": "xxx",
        "zero_trust_application_password_ssh_passphrase": "",
        "zero_trust_application_password_ssh_private_key": "",
        "zero_trust_application_password_ssh_public_key": "",
        "zero_trust_application_password_ssh_username": "",
        "zero_trust_application_password_title": "litang",
        "zero_trust_application_password_type": "ztna",
        "zero_trust_application_password_username": "demo"
    }
]

Updating Secrets

For updating secrets (The detailed payload for the secret is labeled as 'insecure_data'. Please ensure to execute the code within a trusted environment for security reasons.):

# The detailed payload for the secret is labeled as 'insecure_data'. Please ensure to execute the code within a trusted environment for security reasons.

  
curl --location --request PUT 'https://${mytenant}.us.ssw.splashtop.com/server/api-key-access/secret/' \
--header 'Content-Type: application/json' \
--data-raw '{
 "api_key_id": "${apikey_id}",
 "secret_id": "${secret_id}",
 "api_key_secret_key": "${apikey_secret_key}",
 "insecure_data": "{\"secret_id\": \"006fa005-112e-41e4-8877-6ba08c47b837\", \"zero_trust_application\": \"demo/test/applications/ssh@njc3ztrhmmet.app.e1-singapore-c1-usw2.dev.ztw.splashtop.com/all/ssh\", \"zero_trust_application_desktop_app\": [\"Terminal\", \"WindowsTerminal.exe\"], \"zero_trust_application_id\": \"677e4a2a-c165-4351-8962-6836df69ffa8\", \"zero_trust_application_password_fqdn\": \"njc3ztrhmmet.app.e1-singapore-c1-usw2.dev.ztw.splashtop.com\", \"zero_trust_application_password_header\": \"\", \"zero_trust_application_password_header_value\": \"\", \"zero_trust_application_password_http_basic_auth_credentials\": \"\", \"zero_trust_application_password_http_basic_auth_type\": \"\", \"zero_trust_application_password_http_proxy_auth_credentials\": \"\", \"zero_trust_application_password_http_proxy_auth_type\": \"\", \"zero_trust_application_password_k8s_private_key\": \"\", \"zero_trust_application_password_k8s_public_key\": \"\", \"zero_trust_application_password_notes\": \"123\", \"zero_trust_application_password_password\": \"ssh\", \"zero_trust_application_password_ssh_passphrase\": \"\", \"zero_trust_application_password_ssh_private_key\": \"\", \"zero_trust_application_password_ssh_public_key\": \"\", \"zero_trust_application_password_ssh_username\": \"\", \"zero_trust_application_password_title\": \"sshhjhkj\", \"zero_trust_application_password_type\": \"ztna\", \"zero_trust_application_password_username\": \"ssh\"}"
}'

This documentation provides a comprehensive guide to using API keys for secret management within the secure workspace platform, including detailed examples for both retrieving and updating secrets using API calls.


Was this article helpful?