Twilio Verify-compatible sign-in codes
Keep your Verify code: your own phone texts the codes
The same Verify calls, your own number
Code written for Twilio Verify starts a verification, lets Twilio text the code, then asks Twilio whether the code the person typed is right. SMSTunnel answers the same calls at https://api.smstunnel.io: your own Android phone texts the code from your own number, and SMSTunnel checks it. Change the address and use your SMSTunnel API key as the Auth Token; your Service SID can stay. The basic Lookup v2, which formats and validates numbers, works at the same address.
1. Get your key
- 1. Install the SMSTunnel app from Google Play on your Android phone and sign in.
- 2. In your dashboard, open Apps → Add an app, pick Already use Twilio?, name it (for example "My Verify code") and click Create the key.
- 3. Copy the key right away: it's shown only once. You can stop or delete the app there anytime, and My Verify code can't send texts anymore.
Get the steps with your key in them
It opens Add an app with Already use Twilio? picked. Once the key is made, the dashboard shows every step and command with the key already filled in, ready to copy.
2. Point Verify at SMSTunnel
- The address.
https://verify.twilio.combecomeshttps://api.smstunnel.io, withapi.in front: Verify and Lookup answer only there. The paths stay Twilio's. - The password. Your Twilio Auth Token becomes your SMSTunnel API key. The user name can stay your Account SID.
- Your Service SID can stay. A Service SID your account hasn't used yet (
VAand 32 hex characters) is made the first time you use it, with no name. To have the Service's name in the text, make one:
curl -X POST "https://api.smstunnel.io/v2/Services" \
--data-urlencode "FriendlyName=Acme" \
-u "$TWILIO_ACCOUNT_SID:$SMSTUNNEL_API_KEY" curl -X POST "https://api.smstunnel.io/v2/Services/$TWILIO_VERIFY_SERVICE_SID/Verifications" \
--data-urlencode "To=+15558675310" \
--data-urlencode "Channel=sms" \
-u "$TWILIO_ACCOUNT_SID:$SMSTUNNEL_API_KEY" curl -X POST "https://api.smstunnel.io/v2/Services/$TWILIO_VERIFY_SERVICE_SID/VerificationCheck" \
--data-urlencode "To=+15558675310" \
--data-urlencode "Code=123456" \
-u "$TWILIO_ACCOUNT_SID:$SMSTUNNEL_API_KEY"
Starting answers 201 with status pending, and your phone texts
"Your Acme verification code is: 123456". The check answers approved with
valid true when the code is right, and
pending when it isn't. The answers in full.
3. With Twilio's libraries
Each program below texts a code when you give it a number, and checks the code when you give it the number and the
code. It reads TWILIO_ACCOUNT_SID, SMSTUNNEL_API_KEY and
TWILIO_VERIFY_SERVICE_SID from the environment.
Each ran on 20 November 2026 with the version shown, against a copy of SMSTunnel's server on a test machine: the
code arrived, a wrong code stayed pending, the right one was
approved, and checking it again answered 404, since an approved verification is gone.
Node.js
Twilio's twilio package (tested with version 6.3.1, Node.js 22), in verify.mjs:
import twilio from 'twilio';
const client = twilio(process.env.TWILIO_ACCOUNT_SID, process.env.SMSTUNNEL_API_KEY);
client.verify.baseUrl = 'https://api.smstunnel.io';
// Your Verify Service SID (VA…) works as it is.
const service = client.verify.v2.services(process.env.TWILIO_VERIFY_SERVICE_SID);
const [to, code] = process.argv.slice(2);
if (!code) {
// node verify.mjs +15558675310: texts a code to the number
const verification = await service.verifications.create({ to, channel: 'sms' });
console.log(verification.status); // pending
} else {
// node verify.mjs +15558675310 123456: checks the code the person typed
const check = await service.verificationChecks.create({ to, code });
console.log(check.status); // approved when the code is right, else pending
}
Text a code: node verify.mjs +15558675310. Check it: the same, with the code after the number.
Verify has an address of its own in this library, so client.verify.baseUrl points it at SMSTunnel. The Account SID must start with AC.
Python
Twilio's twilio package (tested with version 9.13.0, Python 3.13), in verify.py:
import os
import sys
from twilio.rest import Client
client = Client(os.environ["TWILIO_ACCOUNT_SID"], os.environ["SMSTUNNEL_API_KEY"])
client.verify.base_url = "https://api.smstunnel.io"
# Your Verify Service SID (VA…) works as it is.
service = client.verify.v2.services(os.environ["TWILIO_VERIFY_SERVICE_SID"])
to = sys.argv[1]
if len(sys.argv) < 3:
# python verify.py +15558675310: texts a code to the number
verification = service.verifications.create(to=to, channel="sms")
print(verification.status) # pending
else:
# python verify.py +15558675310 123456: checks the code the person typed
check = service.verification_checks.create(to=to, code=sys.argv[2])
print(check.status) # approved when the code is right, else pending
Text a code: python verify.py +15558675310. Check it: the same, with the code after the number.
One line, as in Node.js: client.verify.base_url.
PHP
Twilio's twilio/sdk package (tested with version 8.14.1, PHP 8.5), in verify.php:
<?php
require __DIR__ . '/vendor/autoload.php';
use Twilio\AuthStrategy\AuthStrategy;
use Twilio\Http\CurlClient;
use Twilio\Http\Response;
use Twilio\Rest\Client;
// Sends each request to api.smstunnel.io instead of Twilio's address; the rest stays Twilio's.
class SmsTunnelHttpClient extends CurlClient
{
public function request(string $method, string $url, array $params = [], array $data = [],
array $headers = [], ?string $user = null, ?string $password = null,
?int $timeout = null, ?AuthStrategy $authStrategy = null): Response
{
$url = preg_replace('#^https://[^/]+#', 'https://api.smstunnel.io', $url);
return parent::request($method, $url, $params, $data, $headers, $user, $password,
$timeout, $authStrategy);
}
}
$client = new Client(getenv('TWILIO_ACCOUNT_SID'), getenv('SMSTUNNEL_API_KEY'),
null, null, new SmsTunnelHttpClient());
// Your Verify Service SID (VA…) works as it is.
$service = $client->verify->v2->services(getenv('TWILIO_VERIFY_SERVICE_SID'));
$to = $argv[1];
if (!isset($argv[2])) {
// php verify.php +15558675310: texts a code to the number
$verification = $service->verifications->create($to, 'sms');
echo $verification->status, PHP_EOL; // pending
} else {
// php verify.php +15558675310 123456: checks the code the person typed
$check = $service->verificationChecks->create(['to' => $to, 'code' => $argv[2]]);
echo $check->status, PHP_EOL; // approved when the code is right, else pending
}
Text a code: php verify.php +15558675310. Check it: the same, with the code after the number.
The same HTTP client as for Messages changes the address of every request, Verify's included.
Ruby
Twilio's twilio-ruby package (tested with version 7.13.1, Ruby 3.4), in verify.rb:
require 'twilio-ruby'
# Sends each request to api.smstunnel.io instead of Twilio's address; the rest stays Twilio's.
class SmsTunnelHttpClient < Twilio::HTTP::Client
HOST = 'https://api.smstunnel.io'
def request(_host, _port, method, url, *rest)
super(HOST, 443, method, url.sub(%r{\Ahttps://[^/]+}, HOST), *rest)
end
end
client = Twilio::REST::Client.new(ENV['TWILIO_ACCOUNT_SID'], ENV['SMSTUNNEL_API_KEY'],
nil, nil, SmsTunnelHttpClient.new)
# Your Verify Service SID (VA…) works as it is.
service = client.verify.v2.services(ENV['TWILIO_VERIFY_SERVICE_SID'])
to, code = ARGV
if code.nil?
# ruby verify.rb +15558675310: texts a code to the number
verification = service.verifications.create(to: to, channel: 'sms')
puts verification.status # pending
else
# ruby verify.rb +15558675310 123456: checks the code the person typed
check = service.verification_checks.create(to: to, code: code)
puts check.status # approved when the code is right, else pending
end
Text a code: ruby verify.rb +15558675310. Check it: the same, with the code after the number.
The same HTTP client as for Messages changes the address of every request.
C# / .NET
Twilio's Twilio package (tested with version 8.2.0, .NET 9), in Program.cs:
using Twilio;
using Twilio.Clients;
using Twilio.Rest.Verify.V2.Service;
var http = new HttpClient(new ToSmsTunnel { InnerHandler = new HttpClientHandler() });
TwilioClient.SetRestClient(new TwilioRestClient(
Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID"),
Environment.GetEnvironmentVariable("SMSTUNNEL_API_KEY"),
httpClient: new Twilio.Http.SystemNetHttpClient(http)));
// Your Verify Service SID (VA…) works as it is.
var service = Environment.GetEnvironmentVariable("TWILIO_VERIFY_SERVICE_SID")!;
var to = args[0];
if (args.Length < 2)
{
// dotnet run -- +15558675310: texts a code to the number
var verification = await VerificationResource.CreateAsync(to: to, channel: "sms", pathServiceSid: service);
Console.WriteLine(verification.Status); // pending
}
else
{
// dotnet run -- +15558675310 123456: checks the code the person typed
var check = await VerificationCheckResource.CreateAsync(to: to, code: args[1], pathServiceSid: service);
Console.WriteLine(check.Status); // approved when the code is right, else pending
}
// Sends each request to api.smstunnel.io instead of Twilio's address; the rest stays Twilio's.
class ToSmsTunnel : DelegatingHandler
{
protected override Task<HttpResponseMessage> SendAsync(
HttpRequestMessage request, CancellationToken cancellationToken)
{
var uri = new UriBuilder(request.RequestUri!) { Host = "api.smstunnel.io" };
request.RequestUri = uri.Uri;
return base.SendAsync(request, cancellationToken);
}
}
Text a code: dotnet run -- +15558675310. Check it: the same, with the code after the number.
For a project made with dotnet new console. The DelegatingHandler changes the address of every request.
Java
Twilio's com.twilio.sdk:twilio package (tested with version 13.2.1, Java 21), in Verify.java:
import com.twilio.Twilio;
import com.twilio.http.NetworkHttpClient;
import com.twilio.http.Request;
import com.twilio.http.Response;
import com.twilio.http.TwilioRestClient;
import com.twilio.rest.verify.v2.service.Verification;
import com.twilio.rest.verify.v2.service.VerificationCheck;
public class Verify {
public static void main(String[] args) {
String accountSid = System.getenv("TWILIO_ACCOUNT_SID");
String apiKey = System.getenv("SMSTUNNEL_API_KEY");
Twilio.setRestClient(new TwilioRestClient.Builder(accountSid, apiKey)
.httpClient(new ToSmsTunnel())
.build());
// Your Verify Service SID (VA…) works as it is.
String service = System.getenv("TWILIO_VERIFY_SERVICE_SID");
String to = args[0];
if (args.length < 2) {
// java Verify.java +15558675310: texts a code to the number
Verification verification = Verification.creator(service, to, "sms").create();
System.out.println(verification.getStatus()); // pending
} else {
// java Verify.java +15558675310 123456: checks the code the person typed
VerificationCheck check = VerificationCheck.creator(service).setTo(to).setCode(args[1]).create();
System.out.println(check.getStatus()); // approved when the code is right, else pending
}
}
}
// Sends each request to api.smstunnel.io instead of Twilio's address; the rest stays Twilio's.
class ToSmsTunnel extends NetworkHttpClient {
@Override
public Response makeRequest(Request request) {
String url = request.getUrl().replaceFirst("^https://[^/]+", "https://api.smstunnel.io");
Request copy = new Request(request.getMethod(), url);
request.getQueryParams().forEach((k, vs) -> vs.forEach(v -> copy.addQueryParam(k, v)));
request.getPostParams().forEach((k, vs) -> vs.forEach(v -> copy.addPostParam(k, v)));
request.getHeaderParams().forEach((k, vs) -> vs.forEach(v -> copy.addHeaderParam(k, v)));
copy.setContentType(request.getContentType());
copy.setBody(request.getBody());
copy.setAuth(request.getUsername(), request.getPassword());
return super.makeRequest(copy);
}
}
Text a code: java -cp "lib/*" Verify.java +15558675310. Check it: the same, with the code after the number.
Run with the library and its dependencies on the class path (Maven or Gradle put them there). The HTTP client copies each request with the new address.
Go
Twilio's github.com/twilio/twilio-go package (tested with version 1.33.1, Go 1.27), in main.go:
package main
import (
"fmt"
"log"
"net/http"
"os"
"time"
"github.com/twilio/twilio-go"
"github.com/twilio/twilio-go/client"
verify "github.com/twilio/twilio-go/rest/verify/v2"
)
// toSMSTunnel sends each request to api.smstunnel.io instead of Twilio's address, with your
// key as the Basic password: twilio-go itself refuses a password with "_" in it, and
// SMSTunnel keys have one.
type toSMSTunnel struct{ sid, key string }
func (t toSMSTunnel) RoundTrip(r *http.Request) (*http.Response, error) {
r = r.Clone(r.Context())
r.URL.Host, r.Host = "api.smstunnel.io", ""
r.SetBasicAuth(t.sid, t.key)
return http.DefaultTransport.RoundTrip(r)
}
func main() {
sid := os.Getenv("TWILIO_ACCOUNT_SID")
httpClient := &client.Client{
Credentials: client.NewCredentials("", ""),
HTTPClient: &http.Client{
Transport: toSMSTunnel{sid, os.Getenv("SMSTUNNEL_API_KEY")},
Timeout: 10 * time.Second,
},
}
httpClient.SetAccountSid(sid)
tw := twilio.NewRestClientWithParams(twilio.ClientParams{Client: httpClient})
// Your Verify Service SID (VA…) works as it is.
service := os.Getenv("TWILIO_VERIFY_SERVICE_SID")
to := os.Args[1]
if len(os.Args) < 3 {
// go run . +15558675310: texts a code to the number
params := &verify.CreateVerificationParams{}
params.SetTo(to)
params.SetChannel("sms")
verification, err := tw.VerifyV2.CreateVerification(service, params)
if err != nil {
log.Fatal(err)
}
fmt.Println(*verification.Status) // pending
return
}
// go run . +15558675310 123456: checks the code the person typed
params := &verify.CreateVerificationCheckParams{}
params.SetTo(to)
params.SetCode(os.Args[2])
check, err := tw.VerifyV2.CreateVerificationCheck(service, params)
if err != nil {
log.Fatal(err)
}
fmt.Println(*check.Status) // approved when the code is right, else pending
}
Text a code: go run . +15558675310. Check it: the same, with the code after the number.
The transport sets your key as the password itself: twilio-go refuses a password with _ in it, and SMSTunnel keys have one.
Already sending texts with the same library? The setup for Messages is in the Twilio-compatible API guide: one client can do both.
What works
- Services: make (
FriendlyName,CodeLength4 to 10, 6 by default), fetch, list, update and delete. A Service belongs to your account, so every key of the account can use it. Up to 100 per account. - Verifications: start one by SMS; fetch it by its
VESID or by the number; setStatustocanceledorapproved. Starting again for a number that has one pending texts the same code again, as Twilio does. - VerificationCheck:
CodewithToorVerificationSid. Approved and canceled verifications are gone at once, as at Twilio. - Limits, as Twilio's: a verification lasts 10 minutes from its first text; up to 5 texts (the
sixth request gets 60203); the fifth wrong code closes it (
max_attempts_reached), and later checks and new codes get 60202 until it expires. - Retries without a second text: an
Idempotency-Keyheader on the start gives a retry the first answer back (details). - Permissions: a key's
sms:sendstarts and checks verifications;sms:readreads Services and verifications.
The text and its language
The text names the Service: "Your Acme verification code is: 123456", or "Your verification code is: 123456" for a
Service without a name. Give Locale (en, ro,
es, pt, fr, de or
it; others get English) and the text is in that language. Without it, the text is in the
language of the number's country, the way Twilio Verify picks it:
- English
- Every number not listed below, such as the US, Canada and the UK Your Acme verification code is: 123456
- Romanian
- Romania, Moldova Codul de verificare pentru Acme este: 123456
- Spanish
- Spain, Mexico, Argentina, Bolivia, Chile, Colombia, Costa Rica, Cuba, the Dominican Republic, Ecuador, El Salvador, Guatemala, Honduras, Nicaragua, Panama, Paraguay, Peru, Uruguay, Venezuela Tu código de verificación de Acme es: 123456
- Portuguese
- Brazil, Portugal Seu código de verificação para Acme é: 123456
- French
- France, Belgium, Monaco Votre code de vérification pour Acme est : 123456
- German
- Germany, Austria, Switzerland, Luxembourg Ihr Bestätigungscode für Acme lautet: 123456
- Italian
- Italy, San Marino, Vatican City Il tuo codice di verifica per Acme è: 123456
In the US and Canada (+1) the text is in English, except for the Dominican Republic's area codes 809, 829 and 849.
Android apps: AppHash
Give AppHash, the 11 characters Android's SMS Retriever API gives your app, and the text takes
Twilio's format for it, so your app can read the code by itself: <#> Your Acme verification code is: 123456 He42w354ol9.
The answers
Starting a verification answers 201:
{
"sid": "VEa7c7726d7a819cef0252bc2586c75a2d",
"service_sid": "VAeb9323114370563770acd7d16a5d8270",
"account_sid": "AC00000000000000000000000000000000",
"to": "+15558675310",
"channel": "sms",
"status": "pending",
"valid": false,
"date_created": "2026-11-20T22:15:16Z",
"date_updated": "2026-11-20T22:15:16Z",
"lookup": {},
"amount": null,
"payee": null,
"send_code_attempts": [
{ "time": "2026-11-20T22:15:16Z", "channel": "SMS", "attempt_sid": "VLfd44c255b0c460f011fb1e92481cccb6" }
],
"sna": null,
"url": "https://api.smstunnel.io/v2/Services/VAeb9323114370563770acd7d16a5d8270/Verifications/VEa7c7726d7a819cef0252bc2586c75a2d"
} The check answers 200:
{
"sid": "VEa7c7726d7a819cef0252bc2586c75a2d",
"service_sid": "VAeb9323114370563770acd7d16a5d8270",
"account_sid": "AC00000000000000000000000000000000",
"to": "+15558675310",
"channel": "sms",
"status": "approved",
"valid": true,
"amount": null,
"payee": null,
"sna_attempts_error_codes": [],
"date_created": "2026-11-20T22:15:16Z",
"date_updated": "2026-11-20T22:15:31Z"
} Lookup v2: format and validate numbers
Twilio's basic Lookup v2 answers at the same address: whether a number is valid, its international and national
formats and its country. A number written the national way needs CountryCode, as with
Twilio (/v2/PhoneNumbers/0712345678?CountryCode=RO); without it, it's read as a US number.
curl "https://api.smstunnel.io/v2/PhoneNumbers/+14159929960" \
-u "$TWILIO_ACCOUNT_SID:$SMSTUNNEL_API_KEY" {
"calling_country_code": "1",
"country_code": "US",
"phone_number": "+14159929960",
"national_format": "(415) 992-9960",
"valid": true,
"validation_errors": null,
"caller_name": null,
"sim_swap": null,
"call_forwarding": null,
"line_status": null,
"line_type_intelligence": null,
"identity_match": null,
"reassigned_number": null,
"sms_pumping_risk": null,
"phone_number_quality_score": null,
"pre_fill": null,
"url": "https://api.smstunnel.io/v2/PhoneNumbers/+14159929960"
}
An invalid number answers valid false with the reason in
validation_errors, such as TOO_SHORT. The data packages (line type,
carrier, caller name, SIM swap and the rest) need carrier data SMSTunnel doesn't have: they are always
null, never guessed. Nothing is texted or stored, and a lookup doesn't count on your plan.
In Twilio's libraries, with the same clients as above:
- Node.js
client.lookups.baseUrl = 'https://api.smstunnel.io'; const l = await client.lookups.v2.phoneNumbers('+15558675310').fetch();- Python
client.lookups.base_url = "https://api.smstunnel.io" l = client.lookups.v2.phone_numbers("+15558675310").fetch()- PHP
$l = $client->lookups->v2->phoneNumbers('+15558675310')->fetch();- Ruby
l = client.lookups.v2.phone_numbers('+15558675310').fetch- C#
// using LookupPhoneNumber = Twilio.Rest.Lookups.V2.PhoneNumberResource; var l = await LookupPhoneNumber.FetchAsync(pathPhoneNumber: "+15558675310");
- Java
// import com.twilio.rest.lookups.v2.PhoneNumber; PhoneNumber l = PhoneNumber.fetcher("+15558675310").fetch();- Go
// lookups "github.com/twilio/twilio-go/rest/lookups/v2" l, err := tw.LookupsV2.FetchPhoneNumber("+15558675310", &lookups.FetchPhoneNumberParams{})
What doesn't work
- Channels other than SMS
- Voice calls, WhatsApp, email, RCS, silent network auth and auto: refused with 60223. SMSTunnel sends texts only.
- CustomCode, CustomFriendlyName
- Refused with 60204: SMSTunnel always makes the code itself, and the text names the Service.
- CustomMessage, templates
CustomMessageis refused with 60243;TemplateSid,TemplatesandTemplateCustomSubstitutionswith 60204. The text is the one above, in its language.- Amount and Payee (PSD2)
- Refused with 60204, on the start and on the check.
- RateLimits
- Refused with 60204. SMSTunnel's own limits apply: 5 texts and 5 wrong codes per verification, and the per-key limits.
- Service settings that change the SMS
LookupEnabled,SkipSmsToLandlines,Psd2Enabled,DoNotShareWarningEnabled,CustomCodeEnabledandVerifyEventSubscriptionEnabledset to true, or aDefaultTemplateSid: refused with 60204. Settings of Push, TOTP, WhatsApp and Passkeys are ignored.- Push, TOTP, Passkeys, Fraud Guard
- Not available: Verify here sends codes by text and checks them.
- Locales
- Seven languages. Any other Locale gets the English text.
- Lookup data packages
- Line type, carrier, caller name, SIM swap and the others need carrier data SMSTunnel doesn't have: they are always null, even when Fields asks for them.
Errors
Every error comes in Twilio's shape (code, message,
more_info, status), so your code's error handling keeps working:
- HTTP 400 · code 20001
- 20001
- A required parameter is missing:
To,Channel,FriendlyNameorStatus. - HTTP 400 · code 60200
- 60200
- A value SMSTunnel can't take:
Tonot in international format, aCodethat isn't 4 to 10 letters or digits,CodeLengthoutside 4 to 10, anAppHashthat isn't 11 characters. - HTTP 400 · code 60221
- 60221
- A check with neither
TonorVerificationSid. - HTTP 400 · code 60223
- 60223
- A channel other than
sms. - HTTP 400 · code 60243
- 60243
CustomMessage.- HTTP 403 · code 60204
- 60204
- A feature SMSTunnel doesn't have: see the list below.
- HTTP 403 · code 60605
- 60605
- A short code, a premium-rate or a satellite number. Nothing is sent or stored.
- HTTP 403 · code 20403
- 20403
- The key lacks the permission, or the account already has 100 Services.
- HTTP 404 · code 20404
- 20404
- No pending verification for that number or SID: approved, canceled, expired, or never started. Or a Service SID that isn't VA and 32 hex characters.
- HTTP 429 · code 60203
- 60203
- A sixth text for the same verification.
- HTTP 429 · code 60202
- 60202
- Five wrong codes: the verification is closed until it expires.
- HTTP 429 · code 60212
- 60212
- Too many requests for the same number at the same moment.
- HTTP 429 · code 60245
- 60245
- Your plan's limit for the day, in SMSTunnel's words.
- HTTP 429 · code 20429
- 20429
- Too many requests: 30 starts and 60 checks a minute per key, with
Retry-After. - HTTP 401 · code 20003
- 20003
- No key, or a wrong one.
Worth knowing
- Your sign-in code allowance. Each text counts as a sign-in code, like codes sent with POST /api/v1/sms/send-2fa: the Free plan sends 50 a day, and paid plans have no daily cap on codes.
- The code is in your message history. SMSTunnel keeps only a hash of the code to check it. The text that carried it is a text from your phone, though: it is in your account's Messages, like any sign-in code, and the key that started the verification sees it in the list of its texts.
- Phone offline? The text waits and goes out when the phone is back, but the verification still ends 10 minutes after it started. Keep the phone that sends the codes charged and online.
- A phone sends the codes. At most 28 SMS parts in 65 seconds per phone (Android allows about 30 a minute). For many sign-ins at once, Twilio Verify fits better, and the two can run side by side.
- Numbers in international format, like
+15558675310, as Twilio Verify needs too.
If it doesn't work
- A connection error, or an address like
verify.smstunnel.io: Verify answers only athttps://api.smstunnel.io. In Node.js and Python, setclient.verify's base URL, not onlyclient.api's. -
401, code20003: the password isn't an SMSTunnel key, or the key was deleted. - Code
60200"Invalid parameter: To": write the number in international format, with+and the country code. - Code
20404when checking: there is no pending verification for that number. It was approved or canceled, or the 10 minutes are over: start a new one. - The code doesn't arrive: your phone is offline. Open the SMSTunnel app on it and check that it's linked and online.
Build it with an AI assistant
Copy this prompt into Claude, ChatGPT, Cursor or Copilot and replace the part in [brackets]. Don't paste your API key into the chat: the prompt doesn't need it.
Help me switch my code that sends sign-in codes with Twilio Verify to SMSTunnel's Verify-compatible API, so my own phone texts the codes. My code is written in [language / framework].
About SMSTunnel (https://smstunnel.io): my own apps and tools hand text messages (SMS) to my SMSTunnel account, and my own Android phone sends them from my own number, on my own SIM and plan. The phone runs the SMSTunnel app from Google Play (https://play.google.com/store/apps/details?id=io.smstunnel.app), signed in to my account.
What I want: [describe what should send a text, to whom, and when]
How it works:
- The API key comes from my SMSTunnel dashboard (https://dashboard.smstunnel.io): Apps → Add an app → Create the key. It is shown only once and can send texts and check whether they went out.
- Verify v2 by SMS is at https://api.smstunnel.io (not smstunnel.io): the same paths as Twilio's, /v2/Services/{ServiceSid}/Verifications and /v2/Services/{ServiceSid}/VerificationCheck, with HTTP Basic auth: any Account SID as the user name and my SMSTunnel API key as the password (X-API-Key or Authorization: Bearer work too). My Twilio Service SID works as it is: a VA + 32 hex SID the account hasn't used is made on first use. POST /v2/Services with FriendlyName makes a named one.
- Start: To (international format) and Channel=sms → 201, status pending; the text "Your {FriendlyName} verification code is: {code}" goes out from my phone. Check: Code and To (or VerificationSid) → status approved and valid true when right, pending otherwise. Cancel or approve: POST …/Verifications/{VE sid or the number} with Status=canceled or approved. A new start for a number with a pending verification resends the same code.
- Language: Locale (en, ro, es, pt, fr, de, it; others English); without Locale, the language of the number's country (Romanian for +40 and +373, Spanish for Spain and Latin America, Portuguese for +55 and +351, French for +33, +32, +377, German for +49, +43, +41, +352, Italian for +39, +378, +379, else English). AppHash (11 characters) gives Twilio's Android SMS Retriever format: "<#> " + the text + " " + the hash.
- Limits: a verification lasts 10 minutes; 5 texts (60203 after), 5 wrong codes (the 5th sets max_attempts_reached, then 60202); CodeLength 4 to 10, default 6; FriendlyName up to 32 letters, digits, spaces, - and _, at most 4 digits; 100 Services per account; 30 starts and 60 checks a minute per key; the codes use the sign-in code allowance of my plan. Short codes, premium-rate and satellite numbers: 60605.
- Not available: channels other than sms (60223), CustomCode, CustomFriendlyName, Amount/Payee, RateLimits, templates (60204), CustomMessage (60243), Push, TOTP, Passkeys. Errors use Twilio's shape {"code", "message", "more_info", "status"}.
- Twilio's libraries (tested 20 Nov 2026): Node.js twilio 6.3.1: client.verify.baseUrl = 'https://api.smstunnel.io'; Python twilio 9.13.0: client.verify.base_url = "https://api.smstunnel.io"; PHP, Ruby, C#, Java and Go: the same HTTP client that changes the host for Messages (see https://smstunnel.io/integrations/twilio-compatible/#libraries) changes it for Verify and Lookup too.
- Lookup v2: GET https://api.smstunnel.io/v2/PhoneNumbers/{number}[?CountryCode=XX] answers Twilio's basic fields (valid, validation_errors, phone_number in E.164, national_format, country_code, calling_country_code); every data package is null. Node.js and Python also need client.lookups.baseUrl / base_url.
- The text with the code is kept in my SMSTunnel Messages like any text sent with /api/v1/sms/send-2fa, and the key that started the verification sees it in GET …/Messages.json; the verification itself keeps only a hash of the code.
Rules for your answer:
- Keep the API key in an environment variable or the platform's secret store (for example SMSTUNNEL_API_KEY). Never put it in source code, in a repository, or in code that runs in a browser or a mobile app: call SMSTunnel from a server. I will not paste my key in this chat; use a placeholder.
- Validate phone numbers before sending (international format, like +14155550123) and skip or report the invalid ones.
- Handle errors: log or show what went wrong, retry only after 429, 5xx or network errors and only a few times, and never send the same text twice.
- Only send texts people expect from me: alerts to myself, reminders, sign-in codes, updates they asked for. No unsolicited texts. Responsible use
Built for alerts to yourself and your team, and texts people expect from you. One text goes to one number. Sending unsolicited messages from a consumer SIM generally breaches mobile carrier terms of service.
Twilio is a trademark of Twilio Inc.. SMSTunnel is a third-party integration and is not affiliated with, endorsed by, or sponsored by Twilio Inc..