# Your source. Your configuration.

> Configure the CalmBackup API key, archive encryption key, database driver, included directories and local retention. Keep credentials and recovery targets distinct.

Canonical page: https://www.calmbackup.com/docs/configuration

Configure database access, included directories, local retention and the encryption key.

[All guides](https://www.calmbackup.com/docs)

Configuration reference

Most users won't need to edit the config file directly — `calmbackup init` handles it. But if you need fine-grained control:

Config file location

Searched in order:

1.  `--config <path>` flag (explicit)
2.  `/etc/calmbackup/calmbackup.yaml` (system-wide)
3.  `~/.config/calmbackup/calmbackup.yaml` (user-level)
4.  `./calmbackup.yaml` (current directory)

Full config example

```
api_key: "ak_live_..."
encryption_key: "64-char-hex-key"

database:
  driver: mysql         # mysql | pgsql | sqlite
  host: "127.0.0.1"
  port: 3306
  database: "myapp"
  username: "root"
  password: "secret"
  # path: "/path/to.db" # sqlite only

directories:            # optional
  - /var/www/app/uploads

local_path: "/var/backups/calmbackup"
local_retention_days: 7
```

Configuration fields

| Field | Required | Description |
| --- | --- | --- |
| api_key | Yes | Your API key from the dashboard. |
| encryption_key | Yes | Generated locally by calmbackup init. Never sent to our servers. |
| database.driver | Yes | mysql, pgsql, or sqlite |
| directories | No | Additional directories to include in every backup. |
| local_retention_days | No | Days to keep local backups. Default: 7. |

## Keep API access and encryption separate

The API key authenticates the source. The encryption key opens the archive. Do not use one in place of the other, commit either to source control, or paste them into support messages.

## Changing encryption keys

A new key protects subsequent backups only. Old archives still require their original key. Keep the matching key for every retained backup period.

## Understand local retention

local\_retention\_days controls the local cache. It does not define cloud retention. The CLI uses cloud-confirmed filenames when deciding which older local backups are eligible for pruning.

[Understand the encryption format →](https://www.calmbackup.com/security)
