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

# Secrets

A secret is a named set of key-value pairs holding **credentials** your agents and services need: API tokens, database passwords, anything that should not sit in a configuration file. Secrets belong to the project and nothing outside it can read them.

Grouping matters here. One secret can carry a host, a user, and a password together rather than forcing three separate entries, so a secret usually maps to a system rather than to a single credential. Add the pairs one at a time, or paste a whole set in with Import from JSON.

Values are **write-only**. Once saved, a secret's keys stay visible but its values cannot be read back, so editing means supplying new ones. Individual keys can be replaced or removed without touching the rest.

<div data-with-frame="true"><figure><img src="/files/03cUj7jazSYVSqilNZhH" alt=""><figcaption></figcaption></figure></div>

### Using a secret

Agents and services attach secrets rather than copying values out of them. Select the ones a deployment needs, on an agent's Runtime step or a service's Environment and Secrets section, and every key inside each attached secret arrives as an environment variable when the container starts.

Those environment variables are what the `${...}` reference fields elsewhere in the platform read. A password field on an agent's database connection takes `${MY_SECRET_KEY}` rather than the password itself, so the credential never appears in a configuration or in its version history.

### Database secrets

Creating a database generates its credentials for you. Two secrets appear, typed `database` rather than `project`, one for application access and one for the superuser, each holding the connection details: database name, host, the connection URIs, and credentials. Attach the application one to whatever needs to connect and leave the superuser for administrative work.

{% hint style="info" %}
Secrets can also be managed from the command line. See the [CLI documentation](https://docs.interactive.ai/cli/) for `iai secrets`.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.interactive.ai/infrastructure/secrets.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
