# 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dataspace.ch/platform/secrets-store.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
