> For the complete documentation index, see [llms.txt](https://docs.dataspace.ch/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dataspace.ch/platform/secrets-store.md).

# Secrets Store

DataSpace offers the option to store secret tokens in a secure store.

Using secrets from a secret store instead of hardcoding them in your source code offers several advantages:

* **Security**: Secrets stored in the source code can be exposed to users with viewer access. The secret store keeps them encrypted and secure.
* **Maintenance**: Secrets change over time, such as API tokens or credentials. Updating them in a central secret store is easier than searching through the codebase to update them everywhere they're used.

For example, instead of hardcoding an API token in your script like this:

```python
auth_token = 'Bearer xxxx-yyyy-zzzz'
```

You can create a new Secret in the Workspace settings panel

<figure><picture><source srcset="/files/ymMDShxpIVNHKCCafegx" media="(prefers-color-scheme: dark)"><img src="/files/SmkD1iSmnXd2LQLZQXXK" alt="Secrets Panel"></picture><figcaption></figcaption></figure>

And access it securely from the environment

```python
import os
auth_token = f"Bearer {os.environ['AUTH_TOKEN']}"
```

During the build, all secrets are injected as environment variables and can be accessed in Python by importing the `os` module.

{% hint style="success" %}
Environmental secrets are stored securely and encrypted in the database to ensure sensitive information remains confidential and protected from unauthorized access.
{% endhint %}
