> For the complete documentation index, see [llms.txt](https://docs.n8n.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/credentials.md). Agents can also search and read this documentation through its [MCP server](https://docs.n8n.io/~gitbook/mcp).

# Credentials

Manage default credentials and override them through environment variables your self-hosted n8n instance.

{% hint style="info" %}
**File-based configuration**

You can add `_FILE` to individual variables to provide their configuration in a separate file. Refer to [Keeping sensitive data in separate files](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration.md#keeping-sensitive-data-in-separate-files) for more details.
{% endhint %}

Enable credential overwrites using the following environment variables. Refer to [Credential overwrites](https://docs.n8n.io/administer/manage-credentials/credential-overwrites.md) for details.

| Variable                                                                 | Type    | Default          | Description                                                                                                                                                               |
| ------------------------------------------------------------------------ | ------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><code>CREDENTIALS\_OVERWRITE\_DATA</code><br>/<code>\_FILE</code></p> | \*      | -                | Overwrites for credentials.                                                                                                                                               |
| `CREDENTIALS_OVERWRITE_ENDPOINT`                                         | String  | -                | The API endpoint to fetch credentials.                                                                                                                                    |
| `CREDENTIALS_OVERWRITE_PERSISTENCE`                                      | Boolean | `false`          | Enable database persistence for credential overwrites. Required for multi-instance or queue mode to propagate overwrites to workers through a publish/subscribe approach. |
| `N8N_MANAGED_OAUTH_SHOW_SCOPES`                                          | String  | -                | Comma-separated list of managed OAuth credential types for which users can configure scope fields.                                                                        |
| `CREDENTIALS_DEFAULT_NAME`                                               | String  | `My credentials` | The default name for credentials.                                                                                                                                         |

## OAuth client registration

Configure how n8n identifies itself to OAuth2 servers when a credential registers its client automatically. Refer to [Automatic OAuth client registration](https://app.gitbook.com/s/wMJrGrimpx3PxCJpUswm/manage-credentials/automatic-oauth-client-registration) for details.

| Variable                        | Type    | Default | Description                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `N8N_OAUTH_CIMD_ENABLED`        | Boolean | `false` | Set to `true` to let n8n identify itself with a Client ID Metadata Document (CIMD) when a credential registers its client automatically. Only turn this on if OAuth2 servers can download the document over HTTPS, from this instance or from `N8N_OAUTH_CLIENT_METADATA_URL`. If a server doesn't support CIMD, n8n uses Dynamic Client Registration (DCR). If the server supports neither, n8n shows an error. Available from n8n 2.47.0 and n8n 3.1.0. |
| `N8N_OAUTH_CLIENT_METADATA_URL` | String  | -       | HTTPS URL of a client metadata document that n8n sends as its client ID instead of its own. The URL needs a path, such as `https://example.com/client-metadata.json`, or n8n falls back to DCR. The document must list this instance's OAuth callback URL. When unset, n8n uses the document it serves at `/rest/oauth2-credential/client-metadata.json`. Available from n8n 2.47.0 and n8n 3.1.0.                                                        |

## Related resources

* [Environment variables](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables.md)
