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

# ngrok Agent Configuration File

> Learn about the ngrok agent configuration file for running multiple tunnels simultaneously and configuring advanced settings.

## Overview

The ngrok agent supports an optional, YAML configuration file which provides
you with the power to run multiple tunnels simultaneously as well as to tweak
some of its more advanced settings.

<Note>
  YAML is whitespace-sensitive.
  Use spaces only (tabs are not valid in YAML) and keep keys at the same level aligned to the same column.

  ✅ Valid:

  ```yaml theme={null}
  endpoints:
    - name: example
      upstream:
        url: 80
  ```

  ❌ Invalid—`upstream` is indented inconsistently and will fail to parse:

  ```yaml theme={null}
  endpoints:
    - name: example
       upstream:
        url: 80
  ```
</Note>

## Default locations

The default location of the ngrok agent's configuration file varies based on your operating system. The easiest way to find the configuration file location is to run:

```sh theme={null}
ngrok config check
```

which will validate and print the location of the configuration file.

For the main operating systems supported, their default file locations are:

* Linux: `~/.config/ngrok/ngrok.yml`
* MacOS (Darwin): `~/Library/Application Support/ngrok/ngrok.yml`
* Windows: `"%LocalAppData%\ngrok\ngrok.yml"`
  (`%LocalAppData` is usually `%UserProfile%\AppData\Local`.)

## Config file merging

The `--config` flag in the `ngrok` command allows you to specify one or more
ngrok configuration files to merge when starting the ngrok agent. The rules for
merging are as follows:

* Values from later configs override those from earlier configs. For example, if config1.yml and config2.yml both set `api_key`, then calling `ngrok http --config config1.yml,config2.yml 80` will use the `api_key` from config2.yml.
* Lists are overwritten using the last value.
* Maps, including the `tunnels` map, are merged by key and in the case of a duplicate key, the latter value is taken.

## Configuration file formats

* [Version 3](/agent/config/v3/)
* [Version 2](/agent/config/v2/) (*deprecated*)
