ngrok API client library for Ruby

This library wraps the ngrok HTTP API to make it easier to consume in Ruby.


This library is published on Rubygems

gem install ngrok-api


The best place to get support using this library is through the ngrok Slack Community. If you find any bugs, please contribute by opening a new GitHub issue.


A quickstart guide and a full API reference are included in the ngrok Ruby API documentation


Please consult the documentation for additional examples.

require 'ngrokapi'
client = '<API KEY>')

# Get an instance of the api_keys client and list all API keys
keys_client = client.api_keys

# Or set up an edge and backend with the ability to change your configuration later
edge = client.edges.https.create!(
  description: "A Ruby Created Edge",
  metadata: '{"client": "ruby"}',
  hostports: [""]

backend = client.backends.tunnel_group.create!(
  description: "A Ruby Created Backend",
  labels: {"client_example": "ruby"}

route = client.edges.https_routes.create!(
  match_type: "path_prefix",
  match: "/",
  description: "Root",
  backend: {"enabled": true, "backend_id":}),
  compression: {"enabled": true})

  a_module: {"enabled": false})

Local Documentation

Documentation can be generated with the command:

bundle exec yard doc 'lib/**/*.rb'

This will generate documentation which can be viewed within the doc folder.


Specs can be run with the command:

bundle exec rake

This will generate a coverage report which can be viewed within the coverage folder.


Rubocop can be run with the command:

# Run rubocop on lib folder
bundle exec rubocop 'lib'

# Run rubcop on all files
bundle exec rubocop