Node.js - secret.version.access()
This is reference documentation for the Nitric Node.js SDK. To learn about Secrets in Nitric start with the Secrets docs.
Retrieves the value from a version of a secret.
import { secret } from '@nitric/sdk'const keyRef = secret('apiKey').allow('access')const keyValue = await keyRef.latest().access()keyValue.asString()
Examples
Access the latest version of a secret
import { secret } from '@nitric/sdk'const keyRef = secret('apiKey').allow('access')const keyValue = await keyRef.latest().access()keyValue.asString()
Access a specific version of a secret
import { secret } from '@nitric/sdk'const keyRef = secret('apiKey').allow('access')const keyValue = await keyRef.version('the-version-id').access()keyValue.asString()
Last updated on Apr 3, 2025