English
Receiving Google (Gmail & YouTube) SMS codes in your test pipeline
To receive a Google verification code with OTP Route, order an OTP Gateway number for the google service and the country you need, enter it where Google asks for a phone number, and read the code in the dashboard or from the API by polling or signed webhook. Pricing starts at $0.20 per code, varies by country, and is refunded automatically if no SMS arrives within 20 minutes.
What does the Google verification code API flow look like?
The service id is google, and it covers Gmail, YouTube and the wider Google account. Requests go to https://otproute.com/api/v1 with a Bearer key prefixed or_live_.
- Pick a country id from
GET /api/v1/countries, for exampledeorin. - Read the live price with
GET /api/v1/prices?country=de&service=google. A closed route shows up here, before you spend anything. - Create the order:
POST /api/v1/activationswith{"service": "google", "country": "de"}. Keep the activation id from the response. - Enter the returned number at Google's phone prompt in your test.
- Receive the code through a webhook or by polling
GET /api/v1/activations/{id}. If the test is abandoned, callPOST /api/v1/activations/{id}/cancel.
Accounts get up to 10 API keys and 300 requests per minute, and GET /api/v1/balance lets a suite check funds before it starts. The API docs describe each response field.
How should a webhook handler treat Google codes?
Subscribe one of your five webhook endpoints to activation.sms_received, and to activation.expired and activation.cancelled so waiting jobs can exit cleanly. Before trusting a request, parse X-OTPRoute-Signature (t=<unix>,v1=<hex>), recompute HMAC-SHA256 over "<t>.<raw body>" with the endpoint secret, compare it in constant time, and reject timestamps outside a short tolerance.
Then make the handler idempotent. Record the activation id the first time you process an event and ignore later deliveries of the same one. Polling remains a fine fallback for local runs or firewalled CI agents: query the activation every few seconds until it reports the code or the window ends.
When does Google ask for a phone number?
Google uses phone verification at several points, and which one appears depends on the account and the situation:
- Sign-up: creating a new Google account may include a phone check, though Google decides when to require it.
- 2-Step Verification: SMS codes are one of the second-factor options for signing in.
- Account recovery: a recovery phone can receive a code when someone is locked out.
- YouTube features: some channel features, such as longer uploads and custom thumbnails, unlock after a phone is verified.
This matters for test design. Google SMS verification for testing a sign-up step needs one code, while 2-Step Verification and recovery need the same number again later. A single-use number suits the first case; the others are covered further down.
Which countries can receive Google OTPs?
The google service is currently available in 199 countries, including the United States, Germany, India, Brazil, Indonesia, Nigeria, the United Kingdom, France, Mexico, Japan, Turkey, Egypt, the Philippines, Vietnam and Pakistan.
Country choice is not cosmetic. Google can adapt language and verification prompts to the region of the number, so match the number to the market your test account represents. A localization run for a Brazilian launch should use a Brazilian number, not whichever route is cheapest. Prices differ by country, and the pricing page explains how live rates work.
How do non-developers get a Google code from the dashboard?
Sign in, top up the wallet by card or USDT/USDC, then choose Google (Gmail & YouTube) and a country. The price appears before you confirm. Copy the number into the Google phone number field and keep the activation page open; the code appears there when the SMS lands.
Support agents and agency account managers often use this path when setting up a single test or brand account, while the engineering team drives the same wallet through the API. Every top-up comes with a PDF invoice by email, and there is no monthly fee.
Why might Google not send a code, and what can you do?
Each activation has a 20-minute window, and you pay only if the code arrives. When the window closes empty, or you cancel, the full amount returns to your wallet automatically.
Reasons a Google code does not land:
- Google may refuse a virtual number for Google verification on some flows. That decision sits with Google, and the refund covers it.
- The route may be busy at that moment. Retry later or with a different country that still fits your test.
- Sending can simply be slow. Let the window run before cancelling.
Avoid re-ordering in a tight loop after a miss; space attempts out and log the outcome per country so your suite learns which routes suit it. For CI, a development account can be switched to sandbox on request, returning simulated numbers and codes so the harness itself can be tested without wallet spend.
When is a Dedicated Number the better fit for a Google account?
A one-time number works for one code. If a Google test account must sign in again next week, pass 2-Step Verification or use phone recovery, a number that disappears after one use will lock you out. For those cases, a Dedicated Virtual Number in the United States or Canada, from $1.95/month, stays with the account while it renews and forwards inbound SMS to your webhook as number.sms_received. For long-lived accounts, consider moving 2-Step Verification to an authenticator app once the account exists.
Responsible use matters here. Follow Google's terms, keep to one account per real person or business, and use OTP Route only to test and operate your own legitimate products and accounts; its Acceptable Use Policy applies. Google, Gmail and YouTube are trademarks of Google LLC, and OTP Route has no affiliation with Google.
Frequently asked questions
Can I receive a Gmail sign-up code through an API?
Yes. Create an activation with service google and your chosen country, enter the number in the sign-up form, and collect the code from a webhook or by polling the activation.
Does the same `google` service cover YouTube?
Yes. YouTube runs on Google accounts, so phone checks for YouTube features use the same service id.
How much does a Google verification code cost?
From $0.20 per code, depending on the country. The live price comes from GET /api/v1/prices, and nothing is charged if the code does not arrive within 20 minutes.
Can I use an OTP Gateway number for Google 2-Step Verification?
Not for ongoing sign-ins, because the number serves a single code. Use a US or Canadian Dedicated Number, or an authenticator app, for accounts you will log into again.
Why did Google say my number cannot be used?
Google decides which numbers it accepts and may decline virtual ones. Cancel or let the activation expire for an automatic refund, then try later or another suitable country.
Which country should I pick for a Google test account?
Pick the market the account represents, so language and prompts match what real users there see. Check live availability for google with GET /api/v1/prices before ordering.
Is there a sandbox for testing the Google flow in CI?
A development account can be switched to sandbox on request. It returns simulated numbers and codes, enough to test webhook and polling logic without wallet charges.
Service names are trademarks of their respective owners. OTP Route is not affiliated with them. Use numbers lawfully, follow each service's terms and our Acceptable Use Policy.