Skip to content

Get Secret(s)

url and api_key (or apiKey) default to the SHIELD360_URL and SHIELD360_API_KEY environment variables if you don’t pass them explicitly.

import shield360
response = shield360.get_secrets(
should_set_env=True
)
print(response)
Terminal window
{
err: null,
res: { ANTHROPIC_API_KEY: 'ANTHROPIC_API_VALUE', OPENAI_API_KEY: 'OPENAI_API_VALUE' }
}
ParameterDescription
urlSets the Shield360 URL. Defaults to the SHIELD360_URL environment variable.
api_keySets the Shield360 API Key. Can also be provided via the SHIELD360_API_KEY environment variable.
keySets the key to fetch a specific secret. Optional
should_set_envBoolean value that sets all the secrets as environment variables for the application. Optional
tagsSets the tags for fetching only the secrets that have the mentioned tags assigned. Optional

should_set_env is client-side only: it doesn’t change what’s sent to Shield360, or what comes back in the response. It only controls whether the SDK, after receiving the secrets, also sets them directly as environment variables in your running process.

POST /api/vault/get-secrets is an API-key authenticated endpoint for retrieving Vault secrets. Browser requests from a different origin are blocked unless the calling origin is explicitly allowed.

To allow a browser application hosted on another domain, configure the Shield360 deployment with a comma-separated origin allowlist:

Terminal window
SHIELD360_ALLOWED_CORS_ORIGINS="https://app.example.com,https://admin.example.com"

SHIELD360_ALLOWED_ORIGINS is also supported as a backward-compatible alias. NEXTAUTH_URL is automatically treated as an allowed same-site origin.

Use complete origins such as https://app.example.com. Do not configure wildcard origins for this endpoint.