An OTP gateway is a service layer that sits between your software and the telephone network so that one-time passwords can be obtained, routed and handled programmatically instead of by hand. In the receiving model that OTP Route provides, the gateway allocates a temporary verification number for a specific service and country, waits for the inbound SMS, and hands the code to your system through a REST API or a signed webhook. You need one when verification is a recurring step in an automated workflow, such as QA, CI, onboarding tests or operational sign-ups, rather than an occasional manual task.
The phrase "OTP gateway" is used loosely, and that ambiguity causes real procurement mistakes. This guide separates the three jobs people usually mean, walks through a reference architecture, and gives you a practical test for whether your team needs one.
Sending, receiving and routing are different problems
Most confusion comes from treating every OTP product as the same thing. There are three distinct jobs, and a single vendor may do one, two or all three.
| Job | Direction of the SMS | Who typically needs it | What the gateway is responsible for |
|---|---|---|---|
| Sending | Outbound, from your app to your users | Product teams running two-factor authentication for their own customers | Accepting a message and delivering it to a handset through carrier connections |
| Receiving | Inbound, from a service to you | QA engineers, test automation, privacy-conscious sign-ups, app verification flows | Providing a number, capturing the inbound SMS, extracting the code and returning it |
| Routing | A decision layer on top of either | Anyone operating at volume or across countries | Choosing which country, number pool or path to use based on availability, price and policy |
Sending
A sending gateway is what most people picture. Your backend calls an API with a phone number and a message template, and the provider delivers the code to the end user. The concerns are sender registration, template approval, deliverability to handsets and per-message cost. If your only requirement is to verify your own users' phone numbers, this is the category you want, and OTP Route is not designed to replace it.
Receiving
A receiving gateway works in the opposite direction. Your system needs a phone number that can receive a verification SMS from some other service. Typical examples are a QA run that signs up a fresh test account in your own app, or an integration test that must complete a verification step end to end. The gateway provides the number, listens for the SMS, parses the code and gives it back to you. This is the primary model behind the OTP Route gateway.
Routing
Routing is the decision layer. Given a request such as "I need a number that can receive a code from service X", the router decides which country and which inventory can satisfy it right now, at what price, and what to do if the first choice is unavailable. Routing matters most when you run many verifications in parallel or across regions. We cover the logic in depth in country routing for OTP.
Reference architecture of a receiving OTP gateway
Whatever the vendor, a well-built receiving gateway has the same core components. Understanding them helps you ask better questions during evaluation and design your own integration correctly.
- API and authentication layer. A versioned REST API authenticated with scoped keys. Every request is attributable to a key, which makes auditing and key rotation practical.
- Catalog. The list of supported services, supported countries and current prices for each combination. This changes over time, so it should be queryable rather than hard-coded.
- Number inventory and allocation. A pool of numbers per country, with logic that assigns a number to one activation at a time.
- Inbound SMS ingestion and parsing. Messages arrive from upstream connections, are matched to the right activation, and the code is extracted from the message body.
- Activation state machine. Each request moves through explicit states so that billing, refunds and client logic are deterministic.
- Event delivery. Webhooks push state changes to your endpoint, signed so you can verify authenticity.
- Wallet and ledger. A prepaid balance that is debited per activation and credited back when an activation never receives a message.
- Observability. Usage logs per key and per request, so engineers can debug without opening a support ticket.
The activation lifecycle
The state machine is the component that most directly shapes your code. In OTP Route, an activation follows this lifecycle:
| State | Meaning | Wallet effect |
|---|---|---|
pending |
A number is allocated and the gateway is waiting for the SMS | Activation price is charged |
received |
An SMS has arrived and the code is available | Charge stands |
completed |
The activation is finished | Charge stands |
expired |
The activation window (typically 20 minutes) elapsed with no SMS | Refunded to the wallet automatically |
cancelled |
You cancelled before an SMS arrived | Refunded to the wallet |
Two properties are worth noticing. First, the terminal states are unambiguous, so your automation never has to guess whether it was charged. Second, the refund for activations that never receive an SMS is automatic, which means a failed attempt costs you time but not money.
How OTP Route implements the model
OTP Route exposes this architecture through a small REST surface at https://otproute.com/api/v1, authenticated with Bearer keys that begin with or_live_.
| Component | Endpoint or feature |
|---|---|
| Catalog | GET /v1/services, GET /v1/countries, GET /v1/prices?service=&country= |
| Allocation | POST /v1/activations with {service, country} |
| State | GET /v1/activations/{id} |
| Cancellation and refund | POST /v1/activations/{id}/cancel |
| Wallet | GET /v1/balance |
| Dedicated lines | GET /v1/numbers |
| Event delivery | activation.sms_received, activation.expired, activation.cancelled, number.sms_received |
A minimal request to start an activation looks like this:
curl -X POST https://otproute.com/api/v1/activations \
-H "Authorization: Bearer $OTPROUTE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"service": "example-service", "country": "us"}'
The service and country identifiers above are placeholders. Real values come from the catalog endpoints. The response identifies the activation and the number allocated to it. From there you either poll GET /v1/activations/{id} or, preferably, let the gateway push an activation.sms_received event to your webhook endpoint.
Each webhook carries an X-OTPRoute-Signature header containing a timestamp and an HMAC-SHA256 signature, which your receiver should verify before trusting the payload. The full schemas are in the API documentation, the integration guide walks through every call, and the webhook capture guide shows signature verification in Python and Node.js.
Temporary numbers versus dedicated virtual numbers
Temporary activations are ideal when you need one code, once. Some workflows need a stable line instead, for example a support team that receives operational SMS, or a test environment that must keep the same number across runs. For those, OTP Route offers dedicated virtual numbers in the United States and Canada, with inbound SMS to the dashboard and to your webhook (number.sms_received), outbound SMS and browser calling. Lines renew on a term and can be released at any time.
| Need | Better fit |
|---|---|
| One verification code per test run | Temporary activation |
| Many parallel verifications in CI | Temporary activations with bounded concurrency |
| A number that must persist for weeks | Dedicated virtual number |
| Two-way SMS or voice for an operational team | Dedicated virtual number |
When you need an OTP gateway
A receiving gateway earns its place when phone verification is a recurring, automated step rather than an exception. Common signals include the following.
- Your QA team signs up test accounts by hand. Manual verification blocks parallel test execution and leaks personal phone numbers into test data. See OTP for QA testing.
- End-to-end tests skip the verification step. Mocking the SMS step means the real flow stays untested until production. A gateway lets CI/CD pipelines exercise the full path.
- You validate app verification flows in several regions. Country coverage and per-country pricing become routing decisions instead of ad-hoc purchases. The country list shows current coverage.
- You want privacy-preserving sign-ups. A temporary number keeps personal numbers out of systems that only need a one-time check.
- Operational teams share a personal phone. A dedicated line with webhook delivery is easier to audit, share and hand over.
When you probably do not
- You only need to send verification codes to your own users. Use a sending provider.
- You verify a single account a few times a year. The overhead of an API integration may not be justified.
- Your use case would breach the terms of the service you are verifying against. No gateway makes that acceptable.
Evaluation checklist
Use these questions when assessing any receiving gateway, including ours.
| Question | Why it matters |
|---|---|
| Is the catalog queryable by API? | Hard-coded service lists go stale and break automation |
| Are prices visible per service and country before purchase? | Budgeting and routing depend on it |
| Are failed activations refunded automatically? | Determines the true cost of retries |
| Are webhooks signed and timestamped? | Prevents spoofed and replayed events |
| Can you issue multiple API keys? | Separate keys per environment or pipeline limit blast radius |
| Are usage logs available per key? | Faster debugging without support tickets |
| Which payment methods fund the wallet? | OTP Route accepts cards via Stripe and USDT or USDC stablecoins |
If the answers line up with your needs, the developer hub and pricing page are the next places to look.
Responsible use
A receiving gateway is infrastructure, and like any infrastructure it should be used within the rules of the platforms it touches. OTP Route is intended for QA and testing, privacy-preserving sign-ups, app verification flows and operational lines. Respect the terms of service of every platform you verify against, and do not use the service for fraud, spam, ban evasion or any other form of abuse.
Frequently asked questions
What is the difference between an OTP gateway and an SMS API?
An SMS API usually refers to sending messages outbound to handsets. An OTP gateway in the receiving sense provides a number, captures the inbound verification SMS, extracts the code and returns it to your system, with an activation lifecycle and automatic refunds built around that job.
How long does an activation stay open?
The typical activation window is 20 minutes. If no SMS arrives within that window, the activation moves to expired and its price is refunded to your wallet automatically.
Do I have to poll for the code?
No. You can poll GET /v1/activations/{id}, but webhooks are the recommended approach. OTP Route sends an activation.sms_received event to your endpoint, signed with the X-OTPRoute-Signature header so you can confirm it is genuine.
Can I keep the same number across many test runs?
Temporary activations are single-use by design. If you need a persistent number, a dedicated US or Canada virtual number keeps the same line until you release it, with inbound SMS delivered to the dashboard and your webhook.
How is usage billed?
OTP Route uses a USD wallet funded by card through Stripe or by USDT and USDC stablecoins. Temporary numbers are billed per activation, and activations that never receive an SMS are refunded to the wallet. Current rates are listed on the pricing page.
Route your first OTP in minutes
Pay as you go · no monthly fee · automatic refunds on unused activations.
Topics: otp gateway · what is an otp gateway · otp routing · receive otp api · verification number api · temporary verification numbers · sms otp architecture