> ## Documentation Index
> Fetch the complete documentation index at: https://docs.novita.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a Secret

`novita.secret.create()` creates a team-scoped Secret and its first immutable version. It returns `SecretBinding` metadata and does not include the real value. The `hosts` allow list controls which hosts the real value may be substituted for on outbound HTTPS requests.

## Example

```python Python icon="python" theme={"system"}
from novita_sandbox import Novita

secret_name = "<your-secret-name>"

novita = Novita()

novita.secret.create(
    name=secret_name,
    value="<your-value>",
    hosts=["api.openai.com"],
    description="Sandbox Secrets example",
)
```

```js JavaScript & TypeScript icon="js" theme={"system"}
import { Novita } from 'novita-sandbox'

const secretName = '<your-secret-name>'

const novita = new Novita()

await novita.secret.create({
  name: secretName,
  value: '<your-value>',
  hosts: ['api.openai.com'],
  description: 'Sandbox Secrets example',
})
```

```bash CLI icon="terminal" theme={"system"}
# Set the value directly
novita secret create <secret_name> --host <host> --from-value <secret_value>

# Read the value from an environment variable
novita secret create <secret_name> --host <host> --from-env <env_name>

# Set the value from standard input
novita secret create <secret_name> --host <host> --from-stdin

# Set the value via a pipe
echo "value" | novita secret create <secret_name> --host <host> --from-stdin
```

## Parameters

| Parameter | Description |
| - | - |
| `name` | Secret name, unique among active Secrets in the current team. |
| `value` | The real credential to store. It is encrypted and never returned by the API. |
| `hosts` | Allow list of hosts the value may be substituted for. At least one host; hostname only (no protocol, path, port, or query). Wildcards support the `*.` prefix only. |
| `description` | Optional human-readable description. |

> [!NOTE]
>
> If an active Secret with the same name already exists in the current team, the call returns `409 Conflict`. `novita.secret.create()` returns `SecretBinding` metadata only — it never returns the real value.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.