ngrok Agent Command Line Interface (CLI)
The ngrok agent CLI offers built-in commands for interfacing with the ngrok API. These API commands have been separated into the ngrok agent CLI API page for convenience. For more information about the ngrok API and interfacing with it directly, see the ngrok api page.
ngrok
ngrok puts network services, apps and APIs online.
ngrok exposes local networked services behinds NATs and firewalls to the public internet over a secure tunnel. Share local websites, build/test webhook consumers and self-host personal services. Detailed help for each command is available by adding '--help' to any command or with the 'ngrok help' command.
Open https://dashboard.ngrok.com/obs/traffic-inspector to inspect traffic through your endpoints.
Usage
Loading…
Example
Loading…
SubCommands
Command | Description |
---|---|
api | use ngrok agent as an api client |
completion | generates shell completion code for bash or zsh |
config | update or migrate ngrok's configuration file |
credits | prints author and licensing information |
diagnose | diagnose connection issues |
http | start an HTTP tunnel |
service | run and control an ngrok service on a target operating system |
start | start endpoints or tunnels by name from the configuration file |
tcp | start a TCP tunnel |
tls | start a TLS tunnel |
tunnel | start a tunnel for use with a tunnel-group backend |
update | update ngrok to the latest version |
version | print the version string |
Flags
Flag | Description |
---|---|
--metadata | opaque user-defined metadata for the tunnel session |
ngrok completion
The ngrok completion
command generates shell tab completion code for Bash or Zsh. This requires bash-completion or zsh-completions packages to be enabled in your shell.
You can add it to your current session with the command
Loading…
To enable them each time you start a new session, add the following to your .bashrc
or .zshrc
files:
Loading…
Once you add this to your profile, you'll need to source ~/.bashrc
or source ~/.zshrc
to enable it for your current session.
Usage
Loading…
Example
Loading…
Flags
Flag | Description |
---|---|
--config | path to config files; they are merged if multiple |
ngrok config
The config command gives a quick way to create or update ngrok's configuration file. Use 'add-authtoken' or 'add-api-key' to set the corresponding properties.
Use 'check' to test a configuration file for validity. If you have an old configuration file, you can also use 'upgrade' to automatically migrate to the latest version.
SubCommands
Command | Description |
---|---|
add-api-key | save api key to configuration file |
add-authtoken | save authtoken to configuration file |
add-connect-url | adds the connect URL (connect_url) to configuration file for custom agent |
add-server-addr | alias of add-connect-url |
check | check configuration file |
edit | edit configuration file |
upgrade | auto-upgrade configuration file |
Flags
Flag | Description |
---|---|
--config | path to config files; they are merged if multiple |
ngrok config add-api-key
The add-api-key command modifies your configuration file to include the specified api key.
The API key can be generated in the API section of the ngrok dashboard.
Usage
Loading…
Example
Loading…
Flags
Flag | Description |
---|---|
--config | save in this config file |
ngrok config add-authtoken
The add-authtoken command modifies your configuration file to include the specified authtoken.
ngrok requires that you sign up for an account to use many advanced service features. In order to associate your client with an account, it must pass a secret token to ngrok when it starts up. Instead of passing this authtoken on every invocation, you may use this command to save it into your configuration file so that your client always authenticates you properly.
Additionally, this command saves the default config version, providing a working config file out of the box.
You can find your authtoken in the getting started section of the ngrok dashboard. The ngrok service requires that you sign up for an account to connect with an agent. Some advanced service features require a paid account. In order to associate your agent with an account, it must pass a secret token to the ngrok service when it starts up. Instead of passing this authtoken on every invocation, you may use this command to save it into your configuration file so that your agent always authenticates you properly.
Usage
Loading…
Example
Loading…
Flags
Flag | Description |
---|---|
--config | save in this config file |
ngrok config add-connect-url
The add-connect-url command modifies your configuration file to include the specified connect URL (connect_url) used for custom agent ingress.