Installation

ngrok - download

Commands

Run an instance

# start in background and forward to <https://localhost:3000>
nohup ./ngrok http <https://localhost:3000> &

Get Tunnels

curl \\
-X GET \\
-H "Authorization: Bearer {API_KEY}" \\
-H "Ngrok-Version: 2" \\
<https://api.ngrok.com/tunnels>

Response

{
  "tunnels": [
    {
      "id": "tn_2NTVGqGpa5w2LExRzILEksu7FOa",
      "public_url": "<https://b8ad9cf4eff6.ngrok.paid>",
      "started_at": "2023-03-24T19:59:25Z",
      "proto": "https",
      "region": "us",
      "tunnel_session": {
        "id": "ts_2NTVGmVw5yMzr02ZZzlX4VC6b6L",
        "uri": "<https://api.ngrok.com/tunnel_sessions/ts_2NTVGmVw5yMzr02ZZzlX4VC6b6L>"
      },
      "endpoint": {
        "id": "ep_2NTVGqGpa5w2LExRzILEksu7FOa",
        "uri": "<https://api.ngrok.com/endpoints/ep_2NTVGqGpa5w2LExRzILEksu7FOa>"
      },
      "forwards_to": "<http://localhost:80>"
    },
    {
      "id": "tn_2NTVGiqsZQ8EGqJ7HgcysTvGPAN",
      "public_url": "://:0",
      "started_at": "2023-03-24T19:59:24Z",
      "region": "us",
      "tunnel_session": {
        "id": "ts_2NTVGfpxBknN9h3rpLqPiV7NiAw",
        "uri": "<https://api.ngrok.com/tunnel_sessions/ts_2NTVGfpxBknN9h3rpLqPiV7NiAw>"
      },
      "labels": {
        "baz": "qux",
        "foo": "bar"
      },
      "forwards_to": "<http://localhost:80>"
    }
  ],
  "uri": "<https://api.ngrok.com/tunnels>",
  "next_page_uri": null
}

Get Tunnel

curl \\
-X GET \\
-H "Authorization: Bearer {API_KEY}" \\
-H "Ngrok-Version: 2" \\
<https://api.ngrok.com/tunnels/tn_2NTVGqGpa5w2LExRzILEksu7FOa>

Response

{
  "id": "tn_2NTVGqGpa5w2LExRzILEksu7FOa",
  "public_url": "<https://b8ad9cf4eff6.ngrok.paid>",
  "started_at": "2023-03-24T19:59:25Z",
  "proto": "https",
  "region": "us",
  "tunnel_session": {
    "id": "ts_2NTVGmVw5yMzr02ZZzlX4VC6b6L",
    "uri": "<https://api.ngrok.com/tunnel_sessions/ts_2NTVGmVw5yMzr02ZZzlX4VC6b6L>"
  },
  "endpoint": {
    "id": "ep_2NTVGqGpa5w2LExRzILEksu7FOa",
    "uri": "<https://api.ngrok.com/endpoints/ep_2NTVGqGpa5w2LExRzILEksu7FOa>"
  },
  "forwards_to": "<http://localhost:80>"
}