﻿# Required

> Require a value that is present and not blank

[Dotenv.toml](/docs/dotenv-toml/)

Variables are optional by default. Set `required = true` at the root to require nonblank values for all declarations by default.

```toml
strict = true

[env.API_KEY]
required = true
```

Use either `required` or [`optional`](/docs/dotenv-toml/optional/) in a declaration, never both. `optional = false` is equivalent to `required = true`.

## Related

- [Dotenv.toml Quickstart](/docs/dotenv-toml/quickstart/)
- [Full Dotenv.toml Spec](/docs/dotenv-toml/spec/)
