The Secrets API contains functionality for managing secrets on a site. Secrets managed by this API are available in the Secrets Manager section of a site's dashboard. You can securely store API keys and other secrets on a site. Each secret's value is encrypted and assigned a name of your choice and an ID. You can then use the name or ID to refer to the secret in your backend code rather than hardcoding its value.
Learn more about the Secrets Manager.
With the Secrets API, you can safely:
It's important to note the following:
This article presents possible use cases and corresponding sample flows that your app can support. It provides a useful starting point as you plan your app's implementation.
This use case demonstrates how you can store an API key from a weather service (for example, https://openweathermap.org/), and then use it to fetch the weather information to display on a site.
To get the weather data:
Call Create Secret to store your API key you received after signing up on the OpenWeather site.
Call Get Secret Value, assign the returned value to a variable, and make an OpenWeather API call. For example:
Extract the required values from the returned JSON object and display them on a site.
Secret ID.
A unique, human-friendly name for the secret. Use it to retrieve the secret value easily with the Get Secret Value endpoint.
Note: You can use alphanumeric characters and the following special characters: _+=-@#$
. Spaces are not supported.
An optional text describing the secret's purpose or any other notes about it.
The encrypted confidential value.
Date and time when the secret was created.
Date and time when the secret was updated.