Skip to main content

Latest Post

Introducing fine-grained access tokens for ngrok

We’ve noticed many of you were frustrated with ngrok credentials, and our support and feature request queues reflected it: “An API key is full access and too powerful” and “I have to use a different credential (an authtoken) for the ngrok CLI.” And as coding agents become everyday development tools, being able to give an agent a scoped credential is invaluable if you want to keep it hands-off and read-only.

Good news! Fine-grained access tokens are here, and one token replaces both your authtoken and your API key. The same token works with the ngrok CLI, the API, the ngrok api helper, and the ngrok MCP server. A leaked credential is only as powerful as the scopes you grant it.

Access tokens are available today on every plan, including free. Signup and the dashboard still hand you an authtoken by default for now; we’re working on making access tokens the default there next.

Swap it in where you use API keys and authtokens today

An access token goes where your authtoken or API key already goes.

For the agent:

ngrok config add-authtoken ngrok_pat_<your-token>ngrok http 80

For the ngrok API:

curl \  -H "Authorization: Bearer $NGROK_ACCESS_TOKEN" \  -H "Ngrok-Version: 2" \  https://api.ngrok.com/endpoints

Your existing authtokens and API keys keep working.

Give each token only what it needs

Every access token has a list of scopes, such as endpoints:read, domains:write, or tunnel:start. When you create one in the dashboard, choose:

  • Full access for every scope you have.
  • Read-only for every read scope you have.
  • Custom to pick scopes one by one, or use Quick select to add a bundle of scopes in one click.

A CI job that only checks endpoint health gets endpoints:read. A coding agent you want to keep hands-off gets a read-only token. A token can only do what its scopes allow, which limits the damage from a leak or an honest mistake.

A token also can’t do more than the person who owns it. If the owner’s role loses a permission, every token they own loses it too, without an edit. For automation that should outlive any one person, create the token for a Service User.

When a token is missing a scope, the API says which one, with 403 and ERR_NGROK_29001.

Turn it off in one place

Revoke or delete a token on the Access Tokens page when you stop using it. Within about two minutes, agents using it disconnect and API and MCP calls with it fail. Tokens can also expire on their own: 30, 60, or 90 days, 1 year (the default), or never.

Every value starts with ngrok_pat_, so secret scanners can find a token you committed by mistake.

Try it

  1. Go to Access Tokens and create a token with the scopes for one job.
  2. Put it where that job’s authtoken or API key lives today.
  3. Read the access tokens docs for every scope and the API reference to manage tokens from code.

Questions or feedback? Reach out on X, email support@ngrok.com, or go to Help > Give Feedback in the dashboard.

Frequently asked questions

Answers come from ngrok.com and the ngrok docs, and can be wrong. Check the linked pages before you rely on one.