> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# findConfigFile

> Find a config file path without loading it (static helper).

[ref-search]: /docs/server-sdks/reference/typescript/agents/configuration/config-loader/search

Static helper that searches for a config file and returns the first match's
absolute path without loading it. Useful for detecting whether a configuration
exists before deciding whether to instantiate a `ConfigLoader`. For searching
from an instance that also loads on match, use
[`search()`][ref-search] instead.

The search order is:

1. `{serviceName}_config.json` (cwd) and `.swml/{serviceName}_config.json` (if `serviceName`)
2. Each path in `additionalPaths` (if provided)
3. `config.json`
4. `agent_config.json`
5. `.swml/config.json`
6. `~/.swml/config.json`
7. `/etc/swml/config.json`

## **Parameters**

<ParamField path="serviceName" type="string | undefined" toc={true}>
  Service name. When provided, service-specific config filenames are checked
  before defaults.
</ParamField>

<ParamField path="additionalPaths" type="string[] | undefined" toc={true}>
  Extra file paths to check between service-specific and default locations.
</ParamField>

## **Returns**

`string | null` -- absolute path of the first existing config file, or `null`
if none match.

## **Example**

```typescript {4}
import { ConfigLoader } from '@signalwire/sdk';

const path = ConfigLoader.findConfigFile('my-service');
if (path) {
  const loader = new ConfigLoader(path);
  console.log(`Loaded from ${loader.getFilePath()}`);
} else {
  console.log('No config file found');
}
```