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

# Functions CLI

> Full reference of the CLI available to implement, test & deploy Nango Functions.

### Install the Nango CLI

Install the Nango CLI globally:

```bash theme={null}
npm install nango -g
```

In the folder where you want your integration folder (e.g. root of your project), run:

```bash theme={null}
nango init nango-integrations
```

This creates the `./nango-integrations` folder with some initial configuration and an example
sync script. The `nango-integrations` directory looks like this:

```
nango-integrations/
├── .env
├── index.ts
└── demo-github-integration # this is the integration unique ID and must match an integration ID in the UI
    └── syncs/
        └── github-issue-example.ts
```

### CLI Authentication

Add the following env vars. We recommend that you have a `.env` file in `./nango-integrations`:

```bash theme={null}
NANGO_SECRET_KEY_PROD='<PROD-API-KEY>'
NANGO_SECRET_KEY_DEV='<DEV-API-KEY>'
```

Get your `prod` and `dev` Environment API keys from [Environment Settings > API Keys](https://app.nango.dev/environment-settings#api-keys) (toggle between the `prod` and `dev` environment in the left nav bar).

> [!NOTE]
>
> For self-hosting, set the `NANGO_HOSTPORT` env variable to `http://localhost:3003` (for local development) or your instance's URL.
>
> If the public API is behind mutual TLS, set `NANGO_CLI_TLS_CERT` to a PEM file path. A file that contains both the certificate and private key is enough. Use `NANGO_CLI_TLS_KEY` and `NANGO_CLI_TLS_CA` when the key or CA is in a separate file.

## All CLI commands & command details

Check out all CLI commands by running:

```bash theme={null}
nango
```

Get details about a specific command by running:

```bash theme={null}
nango [command] --help
```

## Deploy

`nango deploy <environment>` without selectors reconciles all repo-managed functions in the target environment: it deploys functions present locally and removes remote ones that aren't, even when the project no longer contains any. Projects can contain sync functions, tools, event functions, and deprecated actions together. The CLI previews the selected functions, shows one combined plan, and asks for confirmation at most once before deploying.

* `nango deploy <environment> <file>` deploys a single function file, for example `github/tools/get-issue.ts`. It never deletes other functions. Event functions can only be deployed with their integration or the whole project.
* `--integration <id>` selects all functions for that integration.
* `--sync <name>` and `--action <name>` are deprecated. Pass the function file instead.
* `--version <version>` overrides versions of legacy syncs and actions. Tools use automatically generated versions.

Deleting a sync function with existing connections, removing a sync or tool record model, or deleting any other function requires confirmation. In CI or with `--no-interactive`, approve these changes with both `--auto-confirm` and `--allow-destructive`. `NANGO_DEPLOY_AUTO_CONFIRM=true` can replace `--auto-confirm`.

## Tools

Create tools with [`createTool`](https://nango.dev/docs/reference/functions/functions-sdk#createtool) and import them from `index.ts`.

```bash theme={null}
nango dryrun <tool-name> <connection-id> -e dev --input '{"id":"example"}' --validate
nango deploy dev <integration-id>/tools/<tool-file>.ts
```

## Interactive Mode

The Nango CLI includes an interactive mode that prompts you for missing arguments. For example, if you run `nango create --sync` without specifying the integration or name, the CLI will prompt you for them.

This mode is enabled by default when you're in an interactive terminal session.

### Usage Examples

**Interactive Usage:**

If you run a command without all the required arguments, the CLI will prompt you for them.

```bash theme={null}
# Creating a sync in a project with no integrations yet
$ nango create --sync

? What is the name of the integration? (e.g., "hubspot") my-api
? What is the name of the new sync? (e.g., "contacts" or "create-ticket") get-contacts
```

**Non-Interactive (Explicit) Usage:**

You can provide all arguments upfront to bypass the interactive prompts. This is ideal for scripting.

```bash theme={null}
nango create --sync --integration my-api --name get-contacts
```

### Disabling Interactive Mode

You can disable interactive mode in two ways:

1. **Using a flag:** Pass the `--no-interactive` flag to any command.
   ```bash theme={null}
   nango create --no-interactive
   ```
2. **In a CI environment:** Interactive mode is automatically disabled when the `CI` environment variable is set. This is the standard way to detect CI/CD environments.

### Backwards Compatibility

Interactive mode is fully backward compatible. If you provide all the required arguments for a command, the CLI will not prompt you for anything and will behave exactly as it did before.

## Flags & environment variables

Global command flags:

```bash theme={null}
# Command flag to auto-confirm all prompts (useful for CI).
# Note: Destructive changes (like removing a sync or renaming a model) requires confirmation, even when --auto-confirm is set. To bypass this restriction, the --allow-destructive flag can be passed to nango deploy.
--auto-confirm

# Command flag to disable interactive mode.
--no-interactive

# Command flag to skip automatic package.json updates and package installs.
# Recommended in CI and monorepos where dependency updates are managed elsewhere.
--no-dependency-update
```

Environment variables:

```bash theme={null}
# Recommendation: in a ".env" file in ./nango-integrations.

# Authenticates the CLI (get the keys in the dashboard's Environment Settings > API Keys).
NANGO_SECRET_KEY_DEV=xxxx-xxx-xxxx
NANGO_SECRET_KEY_PROD=xxxx-xxx-xxxx

# Nango's instance URL (OSS: change to http://localhost:3003 or your instance URL).
NANGO_HOSTPORT=https://api.nango.dev # Default value

# Client certificate for a self-hosted API behind mTLS.
# A single PEM that contains both the certificate and private key is enough.
# NANGO_CLI_TLS_CERT=/path/to/client.pem
# NANGO_CLI_TLS_KEY=/path/to/client.key
# NANGO_CLI_TLS_CA=/path/to/ca.pem
# NANGO_CLI_TLS_KEY_PASSPHRASE=

# How to handle CLI upgrades ("prompt", "auto" or "ignore").
NANGO_CLI_UPGRADE_MODE=prompt # Default value

# Whether to prompt before deployments.
# Note: Destructive changes (like removing a sync or renaming a model) requires confirmation, even when NANGO_DEPLOY_AUTO_CONFIRM is set to true. To bypass this restriction, the --allow-destructive flag can be passed to nango deploy.
NANGO_DEPLOY_AUTO_CONFIRM=false # Default value

# Control automatic dependency updates. Set to "false" to skip installs (equivalent to --no-dependency-update).
NANGO_CLI_DEPENDENCY_UPDATE=true # Default value
```

## Dependency management

For Zero YAML projects, the CLI can keep required dev dependencies (for example `nango` and related tooling) in sync and run package installation when needed.

### `--no-dependency-update`

Use `--no-dependency-update` to disable automatic `package.json` updates and dependency installs:

```bash theme={null}
nango deploy dev --no-dependency-update
```

This is especially useful when:

* your CI pipeline should not modify files
* your monorepo manages dependencies at the workspace root
* you want full control over when `install` runs

In CI, dependency updates are automatically disabled to avoid hanging. Passing `--no-dependency-update` explicitly is still recommended to make intent clear and silence the warning.

> [!WARNING]
>
> When dependency updates are disabled, Nango will not install dependencies for you. Ensure dependencies are already installed before running commands.

## Package manager support

Nango supports all major JavaScript package managers. The CLI automatically detects and uses your package manager for installs. Detection works from the current directory upward (monorepo-aware), in this order:

1. `package.json` `packageManager` field (Corepack standard)
2. lock files (`pnpm-lock.yaml`, `yarn.lock`, `bun.lockb` / `bun.lock`)
3. fallback to `npm`

Supported managers are `npm`, `pnpm`, `yarn`, and `bun`.

> [!TIP]
>
> **Questions, problems, feedback?** Please reach out in the [Slack community](https://nango.dev/slack).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.