Configure credentials
Each provider extension declares the credentials it uses, and openbb-core prefixes every declared name with the provider name. The FRED provider declares api_key, so the credential is fred_api_key and the matching environment variable is FRED_API_KEY. Providers that declare nothing, such as cboe, deribit, finra, nasdaq, and sec, need no setup.
The credential names defined by V5 provider packages are:
| Credential | Package |
|---|---|
bls_api_key | openbb-bls |
cftc_app_token | openbb-cftc |
congress_gov_api_key | openbb-government-us |
eia_api_key | openbb-us-eia |
fred_api_key | openbb-fred |
A declared credential is not always required. Each command's fetcher decides: obb.fred.economy.fred_series stops with a missing-credential error when fred_api_key is empty, while obb.fred.economy.calendar runs without it. To see the names registered in your environment, print the credentials object; values are masked.
from openbb import obb
print(obb.user.credentials)
Store a key for every surface
The JSON file at ~/.openbb_platform/user_settings.json is created on the first import with empty credentials, preferences, and defaults sections. Add keys under credentials:
{
"credentials": {
"fred_api_key": "YOUR_FRED_KEY"
},
"preferences": {},
"defaults": {
"commands": {}
}
}
The Python Interface reads this file when openbb is imported, so a running session does not see edits until you start a new one. The REST API and the MCP server read it again on every request, so edits apply to the next call without a restart.
Use environment variables
Every credential also accepts its uppercased name as an environment variable. Export it in the shell, or put it in ~/.openbb_platform/.env, which openbb-core loads on import for every surface:
export FRED_API_KEY="YOUR_FRED_KEY"
FRED_API_KEY=YOUR_FRED_KEY
A variable already set in the shell takes priority over the same name in the .env file. Environment variables are read once, when the process imports openbb-core; restart the Python session or the server after changing them. Variables whose names end in API_KEY are also collected into the credentials object even when no installed provider declares them.
Environment variables fill a credential only when user_settings.json leaves it unset or empty. If both hold a value, the JSON value is used. Remove the key from the JSON file, or set it to "", when the environment should supply it.
The Environment variables page covers .env handling in more detail.
Set a key for the current Python session
Assigning to obb.user.credentials overrides the JSON file and the environment for the rest of the session. The value is stored as a SecretStr, and nothing is written to disk.
from openbb import obb
obb.user.credentials.fred_api_key = "YOUR_FRED_KEY"
Assign None to clear it again. This only affects the Python Interface; a REST or MCP server process has its own settings.
Avoid [user.credentials] in openbb.toml
The openbb.toml loader accepts a [user.credentials] table, but command execution in V5 reads credentials from user_settings.json and the environment, not from that table. Keep keys in one of the two places above. See Use openbb.toml for what the TOML file does control.
When a key is missing
Without a required key, the command raises an OpenBBError that names the credential and the provider website:
[Error] -> Missing credential 'fred_api_key'. Check https://fred.stlouisfed.org to get it. Refer to the documentation for setting provider credentials at https://docs.openbb.co/platform/settings/user_settings/api_keys.
Over the REST API the same message is returned with status 400. When provider is omitted on a command with several providers, the Python Interface skips providers whose credentials are empty; see Configure preferences and defaults.
Field types and the complete settings schema are listed in Settings & Configuration.
Verify
Start a new Python session and check that the key resolves. A configured key prints as asterisks; an unset key prints None.
from openbb import obb
print(obb.user.credentials.fred_api_key)
print(obb.fred.economy.fred_series(symbol="GDP", limit=5).provider)
The second line prints fred when the key is accepted.