Protect your online identity with TempPhoneNumber. Use our free temporary non-VoIP phone numbers to verify accounts on WhatsApp, Telegram, Google, and 3,000+ services without exposing your private info.
Live SMS Feed
Protect your online identity with TempPhoneNumber. Use our free temporary non-VoIP phone numbers to verify accounts on WhatsApp, Telegram, Google, and 3,000+ services without exposing your private info.
Live SMS Feed
Stay informed on account verification safety tips, telecom protocols, developer MCP integrations, and digital identity defense strategies.
Comprehensive step-by-step masterclass explaining how real non-VoIP temporary numbers protect you from spam calls, targeted ads, and data broker profiling.
Learn how to integrate the temphonenumber MCP server with Claude Desktop, Cursor, and local LLMs to automate SMS verification workflows programmatically.
An in-depth telecom engineering breakdown of Home Location Register (HLR) pings, SS7 signaling, and carrier lookup databases used by verification systems.
How to register Telegram accounts securely without leaking your primary SIM number or exposing your contact book to data scraping.
Best practices for software engineers provisioning international temporary numbers for automated testing of AI platform signups and API access.
The architectural difference between physical tier-1 cellular routing and virtual PBX numbers, explaining why banks and secure apps reject VoIP.
Subscribe to our newsletter for country stock updates, feature announcements, and API changes.
Join 15,000+ privacy-conscious users. Unsubscribe at any time.
To automate SMS OTP verification with the TempPhoneNumber REST API, exchange your Client ID and Client Secret at POST /oauth/token for a Bearer token, look up a websiteId via GET /api/services, provision a line with POST /api/buyNumbers, retrieve your order via GET /api/getNumbers and GET /api/getNumber/{id}, and call POST /api/flagNumber/{id} if no SMS arrives.

POST /oauth/token using the OAuth 2.0 client_credentials flow (access_token expires in 86400 seconds).GET /api/services and GET /api/countries are public catalog endpoints that return websiteId, live stock, country iso2 codes, and USD pricing.POST /api/buyNumbers, inspect orders with GET /api/getNumbers and GET /api/getNumber/{id}, and trigger instant refunds via POST /api/flagNumber/{id}.webhookUrl and verify signatures with x-temphonenumber-signature and x-temphonenumber-timestamp.Whether you are building automated QA tests, regional onboarding checks, or backend verification workers, automating SMS reception lets you replace manual phone checks with clean HTTP calls.
Instead of spinning up fragile mobile emulators or VoIP traps that fail signup screens, the TempPhoneNumber Developer API exposes genuine Non-VoIP numbers across 150+ countries and 3,000+ services through standard REST JSON endpoints.
Here is the complete end-to-end integration guide in TypeScript and Python, matching the live endpoints documented in our API reference.
| Step | Endpoint | Auth Required? | Purpose |
|---|---|---|---|
| 1. Authenticate | POST /oauth/token | Client ID + Secret | Exchange credentials for a 24-hour Bearer token |
| 2. Discover Service | GET /api/services | No (Public) | Find websiteId, stock count, duration, and price |
| 3. Buy Number(s) | POST /api/buyNumbers | Bearer (str:write) | Rent line(s); returns batch parentId (data) |
| 4. Find Order ID | GET /api/getNumbers | Bearer (str:read) | Retrieve orderId and E.164 phone number |
| 5. Read OTP / Status | GET /api/getNumber/{id} | Bearer (str:read) | Check order status (PENDING → COMPLETED) & SMS payload |
| 6. Flag or Reuse | POST /api/flagNumber/{id} / reuseNumber/{id} | Bearer (str:write) | Auto-refund dead lines or request a follow-up SMS |
Base URL & Rate Limits: All requests go to https://api.temphonenumber.com. Keep your client_id and client_secret strictly inside server-side environment variables (TEMPHONENUMBER_CLIENT_ID, TEMPHONENUMBER_CLIENT_SECRET), never in frontend bundles or public repos.
Before purchasing numbers, exchange your Developer Portal credentials for a Bearer access token following the OAuth 2.0 client credentials pattern. Tokens remain valid for 86400 seconds (24 hours), so cache the token across requests rather than requesting a new one on every loop.
curl -X POST "https://api.temphonenumber.com/oauth/token" \
-H "Content-Type: application/json" \
-d '{
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"grant_type": "client_credentials"
}'Use the public catalog endpoints (GET /api/countries and GET /api/services) to look up the exact websiteId for the country and service you want to test. Notice that filter is passed as a URL-encoded JSON string:
const BASE_URL = 'https://api.temphonenumber.com'
interface ServiceEdge {
websiteId: string
name: string
type: 'STR' | 'LTR'
duration: string
stock: number
price: number
region: { iso2: string; cc: string }
}
async function findService(country = 'US', queryName = 'Telegram'): Promise<ServiceEdge | undefined> {
const params = new URLSearchParams({
limit: '50',
filter: JSON.stringify({ country, type: 'STR' }),
order: JSON.stringify({ name: 1 }),
})
const res = await fetch(`${BASE_URL}/api/services?${params.toString()}`)
if (!res.ok) throw new Error(`Services lookup failed: ${res.status}`)
const json = await res.json()
const edges: ServiceEdge[] = json?.data?.edges ?? []
return edges.find(
(item) => item.name.toLowerCase().includes(queryName.toLowerCase()) && item.stock > 0
)
}Once you have websiteId, call POST /api/buyNumbers. The response returns a batch parentId string in data.data, which you can immediately inspect via GET /api/getNumbers (filtering by parentId or reading your latest order) and poll via GET /api/getNumber/{orderId}:
const BASE_URL = 'https://api.temphonenumber.com'
async function getAccessToken(clientId: string, clientSecret: string): Promise<string> {
const res = await fetch(`${BASE_URL}/oauth/token`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
client_id: clientId,
client_secret: clientSecret,
grant_type: 'client_credentials',
}),
})
if (!res.ok) throw new Error(`Auth failed: ${res.status}`)
const data = await res.json()
return data.access_token
}
export async function provisionAndPollOtp(
websiteId: string,
triggerSignupWithNumber: (phone: string) => Promise<void>
): Promise<{ orderId: string; phone: string; orderData: Record<string, unknown> } | null> {
const token = await getAccessToken(
process.env.TEMPHONENUMBER_CLIENT_ID!,
process.env.TEMPHONENUMBER_CLIENT_SECRET!
)
const headers = {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
}
// 1. Purchase a temporary Non-VoIP line
const buyRes = await fetch(`${BASE_URL}/api/buyNumbers`, {
method: 'POST',
headers,
body: JSON.stringify({
services: [{ websiteId, quantity: 1 }],
}),
})
if (!buyRes.ok) throw new Error(`buyNumbers failed: ${buyRes.status}`)
const buyJson = await buyRes.json()
const parentId: string = buyJson.data
// 2. Fetch the allocated orderId & E.164 phone number
const listParams = new URLSearchParams({
limit: '5',
filter: JSON.stringify({ parentId }),
order: JSON.stringify({ createdAt: -1 }),
})
const listRes = await fetch(`${BASE_URL}/api/getNumbers?${listParams.toString()}`, { headers })
const listJson = await listRes.json()
const order = listJson?.data?.edges?.[0]
if (!order?.orderId || !order?.number) {
throw new Error('Order not found for batch parentId')
}
// 3. Submit the allocated number into your app or E2E test flow
await triggerSignupWithNumber(order.number)
// 4. Poll GET /api/getNumber/{orderId} every 5s (up to 90s)
for (let attempt = 0; attempt < 18; attempt++) {
await new Promise((r) => setTimeout(r, 5000))
const pollRes = await fetch(`${BASE_URL}/api/getNumber/${order.orderId}`, { headers })
if (!pollRes.ok) continue
const details = await pollRes.json()
const record = details?.data
if (record?.status === 'COMPLETED' || (Array.isArray(record?.messages) && record.messages.length > 0)) {
return { orderId: order.orderId, phone: order.number, orderData: record }
}
}
// 5. Flag unresponsive number for immediate balance refund
await fetch(`${BASE_URL}/api/flagNumber/${order.orderId}`, { method: 'POST', headers })
return null
}requests)Prefer Python for backend scripts, pytest suites, or data pipelines? Here is the matching pattern using requests:
import json
import os
import time
import requests
BASE_URL = "https://api.temphonenumber.com"
CLIENT_ID = os.environ["TEMPHONENUMBER_CLIENT_ID"]
CLIENT_SECRET = os.environ["TEMPHONENUMBER_CLIENT_SECRET"]
def get_token() -> str:
res = requests.post(
f"{BASE_URL}/oauth/token",
json={
"client_id": CLIENT_ID,
"client_secret": CLIENT_SECRET,
"grant_type": "client_credentials",
},
timeout=10,
)
res.raise_for_status()
return res.json()["access_token"]
def buy_and_poll(website_id: str, timeout_seconds: int = 90):
token = get_token()
headers = {"Authorization": f"Bearer {token}", "Content-Type": "application/json"}
buy_res = requests.post(
f"{BASE_URL}/api/buyNumbers",
headers=headers,
json={"services": [{"websiteId": website_id, "quantity": 1}]},
timeout=10,
)
buy_res.raise_for_status()
parent_id = buy_res.json()["data"]
orders_res = requests.get(
f"{BASE_URL}/api/getNumbers",
headers=headers,
params={
"limit": 5,
"filter": json.dumps({"parentId": parent_id}),
"order": json.dumps({"createdAt": -1}),
},
timeout=10,
)
orders_res.raise_for_status()
order = orders_res.json()["data"]["edges"][0]
order_id, phone = order["orderId"], order["number"]
print(f"Allocated Non-VoIP number: {phone} (orderId={order_id})")
deadline = time.time() + timeout_seconds
while time.time() < deadline:
time.sleep(5)
detail = requests.get(f"{BASE_URL}/api/getNumber/{order_id}", headers=headers, timeout=10).json()
record = detail.get("data", {})
if record.get("status") == "COMPLETED" or record.get("messages"):
return record
# Trigger automated refund if no code arrived within timeout
requests.post(f"{BASE_URL}/api/flagNumber/{order_id}", headers=headers, timeout=10)
return NoneFor higher-throughput pipelines, pass webhookUrl inside POST /api/buyNumbers instead of polling in a loop. Always verify the HMAC-SHA256 signature header (x-temphonenumber-signature) against ${timestamp}.${rawBody} before trusting any incoming payload:
import crypto from 'crypto'
import express from 'express'
const app = express()
app.use(express.json({ verify: (req: any, _res, buf) => { req.rawBody = buf } }))
app.post('/webhooks/temphonenumber', (req: any, res) => {
const signature = String(req.headers['x-temphonenumber-signature'] || '')
const timestamp = String(req.headers['x-temphonenumber-timestamp'] || '')
const secret = process.env.TEMP_PHONE_WEBHOOK_SECRET!
const expected = crypto
.createHmac('sha256', secret)
.update(`${timestamp}.${req.rawBody}`)
.digest('hex')
if (signature.length !== expected.length ||
!crypto.timingSafeEqual(Buffer.from(signature, 'hex'), Buffer.from(expected, 'hex'))) {
return res.status(401).send('Invalid signature')
}
if (req.body.event === 'sms.received') {
console.log('OTP received:', req.body.code, 'line:', req.body.phoneNumber)
}
res.status(200).json({ received: true })
})POST /api/reuseNumber/{id} while the session is still open.PUT /api/renewLTRNumber/{id}.Writing E2E browser tests? Check out our Playwright & Cypress SMS OTP automation guide or read the QA SMS OTP testing playbook.
常见问题
Tokens returned by POST /oauth/token remain valid for 86,400 seconds (24 hours). Cache your token in memory or Redis rather than exchanging credentials before every API request.
/api/services and /api/countries free to query?Yes. Both GET /api/services and GET /api/countries are public catalog endpoints requiring no Bearer token, so your scripts can check real-time pricing and stock before purchasing.
Call POST /api/flagNumber/{orderId} with your Bearer token (or let the short-term countdown expire without receiving a message). Store credit is returned automatically to your wallet balance.
GET /api/getNumbers and GET /api/getNumber/{id}?GET /api/getNumbers returns a cursor-paginated list of your orders (useful right after POST /api/buyNumbers to resolve the batch parentId into individual orderId records), whereas GET /api/getNumber/{id} returns full live details and incoming SMS payloads for one specific order.
Polling every 4–5 seconds works best for short-lived CI jobs (like Playwright or Cypress runs inside GitHub Actions) where spinning up a public webhook listener is extra infrastructure. Webhooks shine for persistent backend services receiving high volumes of verifications.
With six clean REST endpoints and standard OAuth 2.0 Bearer tokens, automating Non-VoIP phone verification takes less than 50 lines of TypeScript or Python. Start with public stock lookups, wrap your test flow with flagNumber auto-refund cleanup, and scale across 150+ countries without touching a physical SIM card.