npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@myotp/cli

v0.1.2

Published

MyOTP.App command line interface. Save an API key, send OTPs, verify codes, and check account status from your terminal or AI agent.

Readme

@myotp/cli

npm version npm downloads License: MIT

The official command line for MyOTP.App. Send and verify OTPs over SMS, WhatsApp, and Telegram from your terminal, CI pipeline, or AI agent.

npx myotp init
npx myotp test +14155551234
npx myotp verify +14155551234 123456

Why this exists

MyOTP is a multi-channel OTP API. Two API calls (/generate_otp, /verify_otp) and you have phone verification working in any language. The CLI is the fastest way to:

  • Provision a new MyOTP account from a script or AI agent.
  • Smoke-test an integration during development.
  • Run a quick OTP from a tutorial, demo, or blog post.
  • Drop into agent toolchains via the --json output mode.

Install

The CLI is published to npm as @myotp/cli with the bin name myotp.

# One-off use, no install required
npx myotp <command>

# Or install globally
npm install -g @myotp/cli
myotp <command>

Requires Node 20 or newer.

Quick start

# 1. Sign up at https://myotp.app/sign-up/ (~60 seconds, 15 free trial credits)
#    Then save your API key locally:
npx myotp init

# 2. Send a test OTP
npx myotp test +14155551234

# 3. Verify the code that arrived
npx myotp verify +14155551234 482917

# 4. Inspect your account
npx myotp status

Commands

myotp init

Saves an API key locally and validates it against /me.

Signup is human-driven and takes ~60 seconds at myotp.app/sign-up. After signup, run myotp init and paste the API key from your dashboard. The CLI will:

  1. Confirm the key is valid (calls /me)
  2. Save it to ~/.myotp/config.json (chmod 600)
  3. Show your account email so you know it stuck

Non-interactive (CI / scripted setup):

npx myotp init --key sk_live_xxxxxxxxxxxxxxxx --json

Already have a key in your environment? Skip init entirely — every subcommand reads MYOTP_API_KEY directly. init exists for convenience, not as a requirement.

myotp test <phone> [--channel <sms|whatsapp|telegram>]

Sends an OTP to the given number using your configured API key. Phone numbers can be entered in any of these formats and the CLI will normalize them:

npx myotp test +14155551234
npx myotp test 14155551234
npx myotp test "+1 (415) 555-1234"

Channel options:

npx myotp test +14155551234                       # SMS (default)
npx myotp test +14155551234 --channel whatsapp    # WhatsApp
npx myotp test +14155551234 --channel telegram    # Telegram

Useful flags:

| Flag | Description | |------|-------------| | --channel <name> | sms, whatsapp, or telegram | | --brand <name> | Override the sender brand for this message | | --otp-length <n> | 3-8 digits (requires the CUSTOM_OTP_LENGTH entitlement) | | --return-otp | Include the OTP code in the response. Testing only. |

myotp verify <phone> <code>

Verifies the OTP that was sent. Exit codes:

  • 0 if the code is correct.
  • 2 if the code is wrong, expired, or not found (the API call succeeded, the code did not match).
  • 1 for any other error (network, auth, etc.).
npx myotp verify +14155551234 482917

myotp status

Shows the account associated with your API key. Detailed metrics like balance, plan, and trial credits are not yet exposed by the public API; this command surfaces what is available today (email, key source, base URL) and notes the rest as unknown.

myotp config

Shows or modifies the saved config.

npx myotp config                              # show current config
npx myotp config --set-key <KEY>              # save an API key
npx myotp config --set-base-url <URL>         # override API base URL
npx myotp config --reset                      # delete the config file

The config file lives at ~/.myotp/config.json with mode 0600 on POSIX systems.

myotp help

Prints the usage information.

API key precedence

The CLI looks for an API key in this order:

  1. --api-key <key> flag passed on the command line.
  2. MYOTP_API_KEY environment variable.
  3. ~/.myotp/config.json.

The first one that is set wins. This makes it easy to override the saved key for a single call:

MYOTP_API_KEY=sk_test_xxx npx myotp test +14155551234

JSON mode for agents

Every command supports a --json flag for machine-readable output. Combined with the documented exit codes, this makes the CLI safe to call from AI agents, scripts, and CI jobs.

Successful response:

{
  "ok": true,
  "command": "test",
  "data": {
    "phone": "14155551234",
    "channel": "sms",
    "message_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "status": "accepted",
    "date_sent": "2026-04-28T10:30:00.000000",
    "expires_at": "2026-04-28T10:35:00.000000",
    "cost": 0.035
  }
}

Failure response:

{
  "ok": false,
  "command": "test",
  "error": {
    "code": "http_403",
    "message": "Insufficient balance",
    "details": { "...": "..." }
  }
}

Agent example:

RESULT=$(npx myotp test +14155551234 --json)
MESSAGE_ID=$(echo "$RESULT" | jq -r '.data.message_id')
# ...prompt user for the code, then:
npx myotp verify +14155551234 "$CODE" --json --message-id "$MESSAGE_ID"

In --json mode, init requires --email, --phone, and --company as flags so it can run non-interactively.

Environment variables

| Variable | Purpose | |----------|---------| | MYOTP_API_KEY | API key (overrides config file) | | MYOTP_BASE_URL | API base URL (defaults to https://api.myotp.app) | | MYOTP_DEBUG | When set, prints stack traces for unexpected errors |

Exit codes

| Code | Meaning | |------|---------| | 0 | Success | | 1 | Error (invalid input, network failure, API error, etc.) | | 2 | verify ran successfully but the OTP did not match | | 130 | User aborted an interactive prompt |

Security notes

  • The config file is created with mode 0600 on POSIX systems so other users on the same machine cannot read your API key.
  • The CLI never logs the full API key. The config and status commands show a masked version (first 4 and last 4 characters).
  • The CLI only talks to https://api.myotp.app by default. Override with --base-url or MYOTP_BASE_URL for self-hosted or staging environments.

Source and license

MIT licensed. Source: brntech/myotp-agentkit/cli.

Built and maintained by BroadNet Technologies, the team behind MyOTP.App.