Skip to content

Get secret by name api

  • Secret contains much sensitive information. When it requires you can get it and use it using the get-secret-by-name system API.
  • Provide secret_id as x-am-secret in the header to get secret details.
  • e.g. 'x-am-secret': '5e15e53abd7bd91e480c9519'
  • Provide the full path of the key like, 'common.encryptionAlgorithm'.

Request Method: POST

URL

/api/system-api/user-path/get-secret-by-name

Request payload, single key

1
2
3
{
    "keys": "secret_key_name"
}

Request payload, multiple keys

1
2
3
4
5
6
{
    "keys": [
        "secret_key_name",
        "secret_key_name"
    ]
}

Get secret System API

Get secret using global object 'g'.

  • Get only one secret key value.
await g.sys.system.getSecret("common.secret");
  • Get multiple secret keys values.
await g.sys.system.getSecret(["common.secret","common.secret"]);

API Response, single key

1
2
3
4
5
{
    "success": true,
    "statusCode": 200,
    "data": "secret_key_value"
}

API Response, multiple keys

1
2
3
4
5
6
7
8
{
    "success": true,
    "statusCode": 200,
    "data": [
        "secret_key_value",
        "secret_key_value"
    ]
}