naïve
← Blog
GuideDevelopersNovember 26, 2026·12 min read

Let Your AI Agent Receive SMS Verification Codes

How an AI agent receives SMS verification codes (OTPs) for accounts it owns: its own US number, inbound texts from day one, $0.0114 per received SMS.

Guide/phone

TL;DR

  • Yes, an AI agent can receive SMS verification codes, if it has a phone number of its own. On Naive the number belongs to the agent's identity and every text sent to it is stored for the agent to read.
  • Receiving works the moment the number is bought. You do not wait for carrier approval, which only gates sending.
  • The agent reads codes with naive.emails.messages(identityId, { channel: 'sms' }), the CLI, or the Naive MCP connector in Claude. An owning agent can also be woken by each text.
  • A US number is $1.15 per 30 days and each received text is $0.0114 per segment. Buying a number asks a person first by default and needs the first $10 top-up.
  • Use it only for accounts the agent legitimately owns, in its own name. It is not a way around a service's verification rules or one-account-per-person limits.

Tools used in this post

An AI agent can receive SMS verification codes if it has a phone number of its own: the service texts the one-time code to that number, and the agent reads it from its inbound messages. On Naive the number belongs to the agent's identity, texts arrive from the moment the number is bought (no carrier wait), and each received text costs $0.0114 per segment on a $1.15-per-30-days US number. Use it only for accounts the agent legitimately owns, in its own name.

Naive is a developer platform that gives AI agents their own identities, inboxes, phone numbers and tools through one API key, with a person's approval on anything that spends money or speaks for you.

Definitions: an identity is who your agent is to the outside world; its inbox, numbers and approval rules hang off it. An OTP (one-time passcode) is the short code a service texts to prove you control a number. A segment is one billable SMS unit of up to 160 plain characters, so a normal code is one segment.

This guide covers when receiving codes is legitimate, the setup, reading codes from the SDK, the CLI and Claude, what it costs, and when not to do it.

Can an AI agent receive SMS verification codes?

Yes. What it needs is a number that is actually its own, plus a way to read what arrives there. Lending the agent your personal phone does not work well: you are the one who sees the code, at your desk or not, and the account ends up tied to you. A number on the agent's identity fixes both:

  • The code lands where the agent can read it. Every inbound text is stored on the identity, next to its email.
  • The account is the agent's. Signed up with the identity's own inbox and phone number, the account belongs to that agent, not to you personally.
  • Receiving is live at purchase. US carriers require a messaging registration before a business number may send, but inbound works straight away. A code-receiving agent never waits on that registration.

When is it OK for an agent to receive verification codes?

The line is simple: the agent may receive codes for accounts it legitimately owns, and nothing else.

FineNot fine
The agent signs up for a tool it uses, in its own name, with its own email and numberSigning up as a real person who is not you
Two-factor codes on an account the agent already ownsCreating accounts in bulk to farm trials or bonuses
A service your company authorised for automated useDodging a service's one-account-per-person rule
Your own test accounts on your own productReceiving someone else's codes or bank one-time passcodes

Read the target service's terms first. Many services forbid automated sign-ups outright, and a code-receiving number does not change that. The number is not a workaround for SMS checks.

How does the setup work, step by step?

StepWhat you doSDKCLI
1Create an identitynaive.identities.createnaive identity create
2Buy a US number (asks you first)naive.phones.provisionnaive identity phone provision
3Sign up with the identity's email and numberyour agentyour agent
4Read the codenaive.emails.messages({ channel: "sms" })naive identity email messages --channel sms
5Mark it usednaive.emails.markReadnaive identity email read

Before you start, create a key at developers.usenaive.ai and store it as NAIVE_API_KEY. Phone numbers need a live (sk_live_) workspace and the first $10 top-up; the free $1 credit covers identities, inboxes and data tools but not numbers.

npm install @usenaive-sdk/naive        # SDK
npm install -g @usenaive-sdk/cli       # CLI, then: naive login

How do I give the agent a number?

Create the identity, then buy the number. Buying is a purchase, so the workspace default is to hold it for a person to approve. With approvals: "wait" the SDK waits up to 10 minutes for that decision, then returns the number.

import { createNaive } from "@usenaive-sdk/naive";
 
const naive = createNaive({ approvals: "wait" }); // reads NAIVE_API_KEY
 
const signups = await naive.identities.create({ name: "signups" });
const inbox = await naive.emails.create(signups.id, {}); // its own email, for the same sign-up
 
const phone = await naive.phones.provision(signups.id, {
  tier: "standard",
  legal_name: "<registered legal name>", // the shared registration's legal name, not your company's
  tax_id: "12-3456789",
});
 
console.log(inbox.address, phone.e164, phone.capabilities); // sms_inbound: true from purchase

The same from the CLI:

naive identity create --name signups
naive email create --identity signups
naive identity phone provision --identity signups --tier standard \
  --legal-name "<registered legal name>" --tax-id 12-3456789

Three things to know about these arguments:

  • legal_name is the shared registration's name, not yours. Numbers run under one shared carrier registration today, and registering your own brand is not available yet. Any other name is refused with validation_failed before anything is bought, and the error does not tell you the right one. The name is not published in the docs or the console, so email support@usenaive.ai for it before your first purchase and use it wherever <registered legal name> appears above.
  • tax_id is not filed anywhere. With the standard tier, tax_id is checked for shape and then discarded, so a placeholder in the right shape is enough. You are not handing over your company's tax number.
  • The other tier needs no tax ID. --tier sole_prop --contact-phone +1... (SDK: tier: "sole_prop", contact_phone) works the same way: the contact phone is checked for shape and discarded, and no passcode is sent to it.

The phone docs give the details. None of this affects inbound texts, which work from the moment of purchase.

How does the agent read the verification code?

Texts share one inbound feed per identity with email. Filter it to sms, take the newest message that arrived after the sign-up started, and pull the digits out:

async function waitForCode(identityId: string, since: Date, timeoutMs = 120_000) {
  const deadline = Date.now() + timeoutMs;
  while (Date.now() < deadline) {
    const page = await naive.emails.messages(identityId, { channel: "sms", limit: 5 });
    const msg = page.data.find((m) => !m.read_at && new Date(m.received_at) > since);
    const code = msg?.text.match(/\b\d{4,8}\b/)?.[0];
    if (msg && code) {
      await naive.emails.markRead(identityId, msg.id, true); // never reuse a code
      return code;
    }
    await new Promise((r) => setTimeout(r, 5_000));
  }
  throw new Error("no code arrived");
}
 
const started = new Date();
// ... the agent submits the sign-up form with phone.e164 ...
const code = await waitForCode(signups.id, started);

Each message carries from, to, text, received_at and read_at, so you can also check the sender before trusting a code. From the CLI:

naive identity email messages --identity signups --channel sms --limit 5
naive identity email read --identity signups --message inb_...

Two things worth knowing. There is no public webhook for texts today: email.received covers mail only, so code either polls, as above, or lets a text wake an agent. And texts are untrusted input. Anyone can text a number, so a message body is data for the agent to read, never an instruction it follows.

Why didn't my verification code arrive?

Start by listing what is actually stored (naive identity email messages --identity signups --channel sms --limit 20). Every inbound text is stored on the identity, so this tells you whether the problem is delivery or your code.

SymptomLikely causeWhat to do
Nothing stored, the service says "invalid number"The service refuses business or VoIP numbersCheck the number with phone-type-detect ($0.022). If it reads as non-mobile, use the service's email verification instead
Nothing stored, no error from the serviceThe service sends codes by voice call, or only to non-US numbersNot supported: numbers are US local numbers and receive texts only
Nothing stored, the number used to workThe balance could not pay the next 30 days, so the number was releasedReleased numbers cannot be reclaimed. Buy a new one and update the account, and keep the balance funded
The text is stored but waitForCode timed outIt arrived before since, was already marked read, or fell outside limitSet since just before you submit the form, raise limit, and only mark a message read after you use it
The text is stored but the digits were not foundThe code is shorter than 4 or longer than 8 digits, or contains lettersLog msg.text and widen the regular expression
The text is stored but the owning agent did not wakePer-sender or per-number rate limits, or auto-reply detection, held it backThe text is still readable; poll as a fallback. See the inbound events docs

Before you ask the service for a new code, wait at least a minute: several codes in a row make it unclear which one is current. The newest unread text after since is the one to use.

How is this different from a temporary OTP number?

Most results for this query describe one of two other jobs. Verification APIs send codes to your users and check them; that is the opposite direction. Rent-a-number services lease a number for one code and then take it back. A Naive number is different on three points:

  • It stays the agent's. The number belongs to the identity for as long as the balance pays its 30 days, so two-factor codes on the same account keep arriving months later. A one-time rental breaks the next login.
  • It sits next to the agent's email. The identity has its own inbox too, so the agent signs up and recovers the account with one consistent identity.
  • It is reachable from SDK, CLI and MCP. The same messages are readable from code, from a terminal and from Claude, and a text can wake an owning agent.

If you need one code once and will never log in again, a rental may be enough. If the account matters, the number should stay with the agent.

Can a text wake the agent on its own?

Yes, if the number has an owning agent. Attach your agent (an agt_ id) to the identity, then point the number at it. From then on each text that passes the inbound guards starts one session for that agent, with the text as its first input. Texts are stored either way.

await naive.identities.attach("agt_...", signups.id);
await naive.phones.update(signups.id, phone.id, { owning_agent_id: "agt_..." });
naive identity attach --identity signups --agent agt_...
naive identity phone update --identity signups --phone pho_... --agent agt_...

Inside that session the agent has phone.numbers and phone.read; phone.read takes a since time and a phone_id, which is exactly the "newest code since I asked" query. Per-sender and per-number rate limits, auto-reply detection and a turn cap stop loops and floods before the agent sees anything. The inbound events docs cover the wake path.

Can Claude read the code for me?

Yes. Add the Naive MCP server as a custom connector and Claude finds the phone and message operations with tools_search, then runs them with tools_execute.

claude.ai, Claude Desktop and mobile.

  1. Open Customize → Connectors → Add custom connector (on some plans Settings → Connectors).
  2. Name it Naive and paste https://mcp.usenaive.ai/v1/mcp.
  3. Select Connect, sign in to Naive and pick your developer workspace. No key is pasted.

Claude Code.

claude mcp add --transport http naive https://mcp.usenaive.ai/v1/mcp

Then run /mcp, choose naive and select Authenticate. Now ask:

Did a verification code arrive on the signups number in the last 10 minutes? Give me just the code.

Claude only acts when you write to it, so it reads what is already stored; it does not open a chat when a text lands. ChatGPT: custom MCP connectors need a Business, Enterprise or Edu workspace with developer mode turned on; there, ChatGPT can read arrived messages. On other ChatGPT plans, use Claude, Claude Code, the CLI or the SDK. The full client list is in the Connect docs, and How to give Claude a phone number walks through the Claude side in more depth.

What it costs

Prices as of November 2026, billed from your Naive balance:

ItemPrice
US number$1.15 per 30 days, charged at purchase and every 30 days
Received SMS$0.0114 per segment
Received picture message (MMS)$0.03 per message
Sent SMS (after carrier approval)$0.0129 per segment
Check a number first (Developer utilities phone-validate / phone-type-detect)$0.022 per call
Identity and inboxFree / included

A worked example: one number receiving 100 one-segment codes in a month costs $1.15 + (100 × $0.0114) = $2.29. If the balance cannot pay a number's next 30 days, the number is released and cannot be reclaimed, so any account tied to it loses that number for future codes. Keep the balance funded for numbers that guard accounts you care about.

Safety: Ask me first

Two parts of this flow spend money or speak for you, and both sit behind the identity's approval rules:

  • Buy a phone number is set to always ask by default. The purchase waits until a person approves it in the app.
  • Send SMS goes out on its own by default. If the agent will ever reply to a service by text, set that rule to always ask on the identity, so every outgoing text waits for you.

Reading codes spends a cent per text and speaks for no one, so it runs without a prompt. A daily budget on the API key caps what a runaway loop could spend. How to add human approval to an AI agent explains how held calls reach you.

When not to use Naive

  • Accounts that are not the agent's. Your personal bank, someone else's social account, or any sign-up as a real person who is not you. Do it yourself.
  • Bulk sign-ups or verification bypass. One identity per real purpose. Using numbers to get around one-account-per-person rules breaks the service's terms.
  • Services that reject business or VoIP numbers. Some sign-ups only accept mobile carrier numbers. Check with phone-type-detect before relying on it, and expect some services to refuse.
  • Codes from outside the US, or by voice call. Numbers are US local numbers and texts only; a service that reads the code aloud will not reach the agent.
  • Email is enough. If the service offers email verification, the identity's inbox is cheaper and needs no top-up.

Give your agent a number of its own. Get a key with $1 free credit, no card, or hand your agent this line: set up https://usenaive.ai/developers/skill.md.

FAQ

Can an AI agent receive SMS verification codes?
Yes, for accounts it owns. Give the agent an identity with its own US number on Naive. Every text sent to that number is stored from the moment the number is bought, and the agent reads the code with naive.emails.messages(identityId, { channel: 'sms' }) or by asking Claude through the Naive connector.
Do I have to wait for carrier approval before codes arrive?
No. Carrier registration only gates sending texts. Inbound SMS works as soon as the number is bought, so verification codes arrive straight away.
How much does it cost to receive OTP codes with an AI agent?
A US number is $1.15 per 30 days. Each received SMS is $0.0114 per segment and a picture message is $0.03. A typical one-segment code costs about one cent. Buying a number needs the first $10 top-up.
Is there a webhook for incoming texts?
Not as a public webhook today; email.received covers mail only. For texts, either poll the identity's messages with channel sms, or give the number an owning agent so each text wakes that agent as a session.
Is it allowed to use an AI agent for SMS verification?
It is fine for an account the agent legitimately owns: signed up in the agent's own name, with its own inbox and number, within the service's terms. Signing up as someone else, creating accounts in bulk or dodging one-account-per-person rules breaks those terms, and the number is not a workaround for them.
Why didn't my verification code arrive?
Check four things in order. Is the text already stored (list the identity's messages with channel sms)? Did your code filter skip it because it was marked read or arrived before your start time? Does the service refuse business or VoIP numbers (check with phone-type-detect)? Does it send by voice call or only to non-US numbers? Texts are stored even when an owning agent is not woken.
What legal name do I use when buying the number?
Numbers run under one shared carrier registration, so legal_name must be the name that registration was filed under. It is not published and the error does not reveal it, so email support@usenaive.ai for it before your first purchase. The tax ID or contact phone you pass is checked for shape and then discarded; nothing is filed with it.
Can ChatGPT read SMS codes for me?
Custom MCP connectors in ChatGPT need a Business, Enterprise or Edu workspace with developer mode. There, ChatGPT can read arrived messages. On other plans, use Claude, Claude Code, the CLI or the SDK.