AI Agent Authentication with OTP Verification API

Building the integration? Install the skill or paste one prompt into Claude Code, Cursor, Codex or Copilot. Running an agent that verifies users? Connect the MCP server.

Get Your API Key Free MCP server docs
  • 4 MCP tools: send, verify, resend, status
  • Sandbox key: fixed code 123456
  • $3 free credits

One-Prompt Integration for Coding Agents

The integration prompt carries what an agent needs: base URL, auth, the send and verify calls with their request and response shapes, and the sandbox code. Paste the shortest prompt into any coding agent and it reads the full prompt and writes the integration into your project.

my-app · agent · 80×24
> Read https://otp.com/ai/prompt.md and integrate otp.com OTP verification into this project.
● Fetching otp.com/ai/prompt.md
● Step 1: POST /otp/send
✓ Step 2: POST /otp/verify wired in
SHORTEST PROMPT

Read https://otp.com/ai/prompt.md and integrate otp.com OTP verification into this project.

my-app · agent · 80×24
> Add phone verification to sign-up with otp.com: send a code when the user submits their number, then verify it.
● Reading the otp.com rules file
● Editing src/auth/signup.ts
✓ Send and verify calls added
WITH A RULES FILE IN PLACE

Add phone verification to sign-up with otp.com: send a code when the user submits their number, then verify it.

INTEGRATION PROMPT
Integrate otp.com OTP verification into this project.

API docs: https://otp.com/docs
Base URL: https://api.otp.com/api/v1
Auth: Bearer token in the Authorization header

## Step 1: Send a code
POST /otp/send
Body: { "recipient": "+14155552671", "locale": "en", "client_ip": "<end user's IP>" }
→ Returns { "otp_id": "9f3c1b2a-…", "status": "pending", "channel": "sms" }

## Step 2: Verify the code the user entered
POST /otp/verify
Body: { "otp_id": "9f3c1b2a-…", "code": "123456" }
→ Returns { "otp_id": "9f3c1b2a-…", "status": "approved", "matched": true }

Notes:
- recipient is a phone number (E.164) or an email; your account routing picks the channel.
- client_ip is the END USER's IP from the request context (e.g. req.ip), never the server's own; requests without it share a much tighter rate limit.
- The code is never returned by the API.
Sandbox test keys (otp_test_…) accept the fixed code 123456 on the default 6-digit length.
Full integration prompt as Markdown →

MCP Setup: Authentication Tools for AI Agents

This is for an agent that talks to your users and needs to verify them while it runs: Claude Desktop, an agent you build, or any MCP client. To add verification to your own app’s code, use the skill or prompt above instead.

  1. 1

    Create an API key in the panel (API Keys). An otp_test_ key runs in the sandbox: nothing is delivered and nothing is charged.

  2. 2

    Add the JSON below to your MCP client config and replace the key. The client launches the server with npx (Node 18+).

  3. 3

    The agent calls send_otp, then verify_otp with what the user typed.

Full MCP reference →
MCP CONFIG claude_desktop_config.json
{
  "mcpServers": {
    "otp": {
      "command": "npx",
      "args": ["-y", "@otp.com/mcp"],
      "env": {
        "OTP_API_KEY": "otp_live_your_key_here"
      }
    }
  }
}

The config file stores the key in plain text. Use a test key while you build.

VS Code and Copilot use a servers map with "type": "stdio" instead; the exact JSON is in the MCP server docs.

send_otp
Send a code (channel chosen by your account routing)
verify_otp
Verify the code the user entered
resend_otp
Resend on the next channel, or one you name
get_otp_status
Check an OTP’s status

Frequently Asked Questions

What is AI agent authentication?

It means giving an AI agent a way to verify a real user: the agent sends a one-time code to the user's phone or inbox and verifies what the user types back. otp.com exposes that as two API calls, and as MCP tools so an agent can call them directly while it runs.

Which AI tools work with otp.com?

Coding agents (Claude Code, Cursor, Codex, GitHub Copilot) use the skill or rules file, or the integration prompt. Automation tools (n8n, Make) call the REST API. App builders (Replit Agent, Lovable) take the prompt. Any other tool can paste the integration prompt.

Do I need the MCP server?

Only if your agent itself has to verify users while it runs, for example a support or onboarding agent. To add verification to your app, install the skill or paste the prompt; the agent writes two REST calls.

Is this AI identity verification or KYC?

No. otp.com verifies that a user controls a phone number or email address by sending a one-time code. It does not check documents, faces or identities.

Can I test without sending real messages?

Yes. A test key (otp_test_) runs in the sandbox: send returns a real otp_id and a pending status, nothing is delivered or charged, and verify accepts the fixed code 123456.