Carrier-grade SMS verification
built for scale & automation.
Direct programmatic provisioning of real non-VoIP physical SIM phone lines. Instant OTP webhook callbacks, multi-step session reuse, and high-throughput telephony routing for microservices, autonomous agents, and backend engineers.
Introduction
The temphonenumber API provides programmatic access to our carrier-grade physical SIM telephony network. All endpoints adhere to REST conventions, consume JSON request payloads, return standard JSON responses, and enforce standard OAuth 2.0 Bearer token authorization.
100% Real Physical SIMs
Real SIM cards connected to major tier-1 telecom carriers (AT&T, Verizon, T-Mobile, Vodafone). Works reliably on WhatsApp, OpenAI, Telegram, and Google without blocks.
Instant OTP Webhooks
Receive SMS payloads in real-time via signed HMAC-SHA256 HTTPS webhook callbacks or low-latency polling with sub-150ms processing speed.
Zero-Risk Auto Refund
If an SMS is not received within the activation window (or if you cancel/flag the number), credits are 100% refunded to your balance instantly.
Base URLs & Protocol Standards
https://api.temphonenumber.comContent-Type: application/json • Accept: application/jsonAuthentication
To access authenticated endpoints, exchange your API Client ID and Client Secret for an OAuth2 Bearer Access Token. All subsequent requests require the Authorization: Bearer <token> header.
Authorization: Bearer <token>Request Parameters
4 fieldsclient_idbodystringYour Developer API Client ID obtained from the Developer Settings dashboard.
cli_live_9482019348client_secretbodystringYour secret API key. Never expose this secret in client-side code or public repositories.
grant_typebodystringThe OAuth 2.0 authorization grant type.
client_credentialsclient_credentialsscopebodystringSpace-delimited list of permissions requested.
*Response Schema Attributes
4 attributesaccess_tokenstringtok_live_79a2f1c804b9e28dBearer authentication token to pass in headers.
token_typestringBearerAlways "Bearer".
expires_ininteger86400Token lifetime in seconds (default: 86,400s / 24h).
scopestringstr:read str:write ltr:manageGranted permission scopes.
HTTP Status Codes
curl -X POST "https://api.temphonenumber.com/oauth/token" \
-H "Content-Type: application/json" \
-d '{
"client_id": "client_live_83920194",
"client_secret": "sec_live_99482019348",
"grant_type": "client_credentials"
}'{
"access_token": "tok_live_79a2f1c804b9e28d",
"token_type": "Bearer",
"expires_in": 86400,
"scope": "str:read str:write ltr:manage esim:read webhook:manage"
}Quick Start: 3-Step Verification Pipeline
Follow this complete programmatic workflow to order a real physical SIM line, trigger an SMS verification in your target app, and ingest the OTP code:
Query Services & Rates
Call GET /api/services to retrieve the service ID, current line availability, and cost per verification (e.g. WhatsApp, OpenAI, Telegram).
Provision Physical SIM
Call POST /api/buyNumbers with the target websiteId to immediately allocate an active E.164 phone line.
Receive OTP Code
Poll GET /api/getNumber/{id} every 3-5 seconds or register an instant HTTPS Webhook to receive the SMS OTP payload automatically.
Rate Limits & Throttling
Our gateway employs a sliding token-bucket algorithm to protect carrier interconnects and ensure maximum delivery throughput. Standard developer accounts are provisioned with 250 requests per minute. Enterprise tiers support up to 10,000 req/min.
| Response Header | Type | Description | Example |
|---|---|---|---|
| X-RateLimit-Limit | integer | The maximum requests allowed per 60-second window. | 250 |
| X-RateLimit-Remaining | integer | Remaining quota of requests available in the current window. | 248 |
| X-RateLimit-Reset | unix timestamp | UTC timestamp when the rate limit window resets. | 1723789400 |
| Retry-After | seconds | Sent on HTTP 429. Number of seconds to pause before retrying. | 3 |
Instead of polling GET /api/getNumber/{id}, register a webhook using POST /api/webhook/set. Webhooks deliver OTPs within milliseconds of carrier receipt and consume zero rate limit quota.
Error Handling & Schemas
All error responses return standard HTTP status codes accompanied by a structured JSON payload containing a machine-readable error.code and human-readable message:
{
"error": {
"code": "INSUFFICIENT_FUNDS",
"message": "Your wallet balance is $0.25, but service WhatsApp requires $0.85.",
"doc_url": "https://temphonenumber.com/en/developers/api#errors",
"request_id": "req_8492019481"
}
}Wallet balance is lower than the line purchase cost. Top up via billing portal.
All physical SIM lines for this service/country are in use. Try another country or retry in 60s.
The 20-minute activation window elapsed without SMS arrival. Full credit is refunded automatically.
Invalid or expired Bearer access token. Obtain a new token via POST /oauth/token.
Exceeded the burst rate limit. Follow the Retry-After header duration.
Missing required JSON body parameters or invalid ISO country code.
Gateway Health Check
Check the live operational status of the telephony gateway, active physical SIM bank nodes, and carrier interconnect latency.
Response Schema Attributes
4 attributesstatusstringhealthyOverall health indicator ("healthy" | "degraded").
databasestringconnectedDatabase cluster connectivity status.
carriersstringonlineTier-1 telephony gateway link state.
timestampstring (ISO 8601)2026-08-16T10:00:00.000ZServer time of telemetry report.
HTTP Status Codes
curl -X GET "https://api.temphonenumber.com/api/health"
{
"status": "healthy",
"database": "connected",
"carriers": "online",
"timestamp": "2026-08-16T10:00:00.000Z"
}Engine Version
Returns the active deployment version, supported protocol features, and build signature of the core telephony engine.
Response Schema Attributes
3 attributesversionstring1.0.4Semantic version of the active API release.
enginestringtelephony-v1-fastCore routing engine build identifier.
regionstringus-east-1AWS / Cloudflare edge point-of-presence.
HTTP Status Codes
curl -X GET "https://api.temphonenumber.com/api/version"
{
"version": "1.0.4",
"engine": "telephony-v1-fast",
"region": "us-east-1"
}Get Wallet Balance
Retrieve the real-time available credits, currency code, and auto-reload configuration for the authenticated account.
Authorization: Bearer <token>Response Schema Attributes
3 attributesbalancenumber (USD)148.50Available wallet credits.
currencystringUSDBilling currency (always "USD").
formattedstring$148.50Pre-formatted currency string.
HTTP Status Codes
curl -X GET "https://api.temphonenumber.com/api/user/balance" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
{
"balance": 148.5,
"currency": "USD",
"formatted": "$148.50"
}Get Account Profile
Retrieve developer account tier, verified email, registration dates, rate limit ceilings, and active webhook routing state.
Authorization: Bearer <token>Response Schema Attributes
6 attributesuserIdstringusr_pva_8920194Unique customer identifier.
emailstring[email protected]Developer account primary email address.
tierstringSCALE_PROActive plan tier ("STARTER" | "SCALE_PRO" | "ENTERPRISE").
rateLimitstring2,000 req/minProvisioned requests per minute.
webhookStatusstringACTIVEReal-time webhook listener state ("ACTIVE" | "NONE").
createdAtstring (ISO 8601)2025-01-12T08:00:00ZAccount creation timestamp.
HTTP Status Codes
curl -X GET "https://api.temphonenumber.com/api/user/profile" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
{
"userId": "usr_pva_8920194",
"email": "[email protected]",
"tier": "SCALE_PRO",
"rateLimit": "2,000 req/min",
"webhookStatus": "ACTIVE",
"createdAt": "2025-01-12T08:00:00Z"
}Get All Services
Retrieve the complete directory of supported verification services, per-verification pricing in USD, and real-time available SIM inventory.
Request Parameters
3 fieldslimitqueryintegerNumber of services to return (max 200).
50countryquerystringFilter services by ISO 3166-1 alpha-2 country code.
USUSGBCADEFRNLcategoryquerystringFilter by category.
messagingsocialbankingaigamingResponse Schema Attributes
5 attributestotalinteger148Total number of services matching query.
services[].idstring69a13a4ef133cd20b4a7c082Unique service identifier (pass to /api/buyNumbers).
services[].namestringWhatsAppHuman-readable service title.
services[].pricenumber0.85Cost in USD per successful OTP verification.
services[].availableinteger420Real-time count of ready physical SIM lines.
HTTP Status Codes
curl -X GET "https://api.temphonenumber.com/api/services?limit=10" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
{
"total": 148,
"services": [
{
"id": "69a13a4ef133cd20b4a7c082",
"name": "WhatsApp",
"price": 0.85,
"available": 420,
"country": "US"
},
{
"id": "69a13a4ef133cd20b4a7c083",
"name": "OpenAI / ChatGPT",
"price": 0.75,
"available": 310,
"country": "US"
},
{
"id": "69a13a4ef133cd20b4a7c084",
"name": "Telegram",
"price": 0.65,
"available": 890,
"country": "US"
}
]
}Get Service by ID
Retrieve live inventory, pricing, carrier reliability score, and real-time OTP delivery rates for a specific service ID.
Request Parameters
1 fieldsidpathstringUnique service identifier (e.g. "69a13a4ef133cd20b4a7c082" or "whatsapp").
69a13a4ef133cd20b4a7c082Response Schema Attributes
5 attributesidstring69a13a4ef133cd20b4a7c082Service UUID.
namestringWhatsAppService brand name.
pricenumber0.85Price in USD per activation.
successRatestring99.4%Historical 24-hour OTP delivery success percentage.
supportedCountriesstring[]["US", "GB", "CA", "DE"]Array of ISO country codes with active inventory.
HTTP Status Codes
curl -X GET "https://api.temphonenumber.com/api/services/69a13a4ef133cd20b4a7c082" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
{
"id": "69a13a4ef133cd20b4a7c082",
"name": "WhatsApp",
"category": "Messaging",
"price": 0.85,
"successRate": "99.4%",
"availableLines": 420,
"supportedCountries": [
"US",
"GB",
"CA",
"DE",
"FR",
"NL"
]
}List Countries
Retrieve all supported telephony regions, ISO-3166 country codes, international dial prefixes, and physical SIM inventory metrics.
Request Parameters
1 fieldsservice_idquerystringFilter countries that currently possess stock for a specific service.
Response Schema Attributes
5 attributestotalCountriesinteger195Total supported country count (190+).
countries[].isostring (ISO 2)US2-letter country code.
countries[].namestringUnited StatesFull country name.
countries[].dialCodestring+1E.164 country dial prefix.
countries[].nonVoipbooleantrueGuarantees 100% physical SIM line.
HTTP Status Codes
curl -X GET "https://api.temphonenumber.com/api/countries"
{
"totalCountries": 195,
"countries": [
{
"iso": "US",
"name": "United States",
"dialCode": "+1",
"flag": "🇺🇸",
"nonVoip": true
},
{
"iso": "GB",
"name": "United Kingdom",
"dialCode": "+44",
"flag": "🇬🇧",
"nonVoip": true
},
{
"iso": "CA",
"name": "Canada",
"dialCode": "+1",
"flag": "🇨🇦",
"nonVoip": true
},
{
"iso": "DE",
"name": "Germany",
"dialCode": "+49",
"flag": "🇩🇪",
"nonVoip": true
}
]
}Purchase Number (STR)
Allocate a dedicated non-VoIP physical SIM phone line for short-term single or multi-SMS verification.
Authorization: Bearer <token>Request Parameters
4 fieldswebsiteIdbodystringTarget service identifier obtained from /api/services.
69a13a4ef133cd20b4a7c082quantitybodyintegerNumber of lines to provision simultaneously (1 - 50).
1countrybodystring2-letter ISO country code for the phone line.
USUSGBCADEFRNLwebhook_urlbodystring (URL)Dynamic HTTPS callback endpoint for instant SMS OTP delivery.
Response Schema Attributes
5 attributesorderIdstringord_69d4b8946fdb87c1f163e1c9Unique order identifier to track OTP or cancel.
statusstringPENDINGInitial order state ("PENDING" | "ACTIVE").
phoneNumberstring (E.164)+14155552671Allocated physical SIM phone number.
costnumber (USD)0.85Deducted credit amount in USD.
expiresAtinteger (unix)1723790600Timestamp when 20-min activation window closes.
HTTP Status Codes
curl -X POST "https://api.temphonenumber.com/api/buyNumbers" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"websiteId": "69a13a4ef133cd20b4a7c082",
"quantity": 1,
"webhook_url": "https://my-app.com/webhooks/sms"
}'{
"orderId": "ord_69d4b8946fdb87c1f163e1c9",
"status": "PENDING",
"phoneNumber": "+14155552671",
"expiresAt": 1723790600,
"cost": 0.85
}Get Active Order & SMS OTP
Poll the status of an active number order and retrieve incoming SMS text and extracted OTP code.
Authorization: Bearer <token>Request Parameters
1 fieldsidpathstringOrder identifier returned from /api/buyNumbers.
ord_69d4b8946fdb87c1f163e1c9Response Schema Attributes
6 attributesorderIdstringord_69d4b8946fdb87c1f163e1c9Order identifier.
statusstringCOMPLETED"PENDING" | "COMPLETED" | "EXPIRED" | "FLAGGED".
phoneNumberstring (E.164)+14155552671Active phone number.
smsstringYour WhatsApp code is: 849-201Complete received SMS text payload.
codestring849201Parsed numeric or alphanumeric verification code.
receivedAtstring (ISO 8601)2026-08-16T10:14:22ZUTC timestamp of SMS delivery.
HTTP Status Codes
curl -X GET "https://api.temphonenumber.com/api/getNumber/ord_69d4b8946fdb87c1f163e1c9" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
{
"orderId": "ord_69d4b8946fdb87c1f163e1c9",
"status": "COMPLETED",
"phoneNumber": "+14155552671",
"sms": "Your WhatsApp code is: 849-201",
"code": "849201",
"receivedAt": "2026-08-16T10:14:22Z"
}Flag Number (Refund Credit)
Cancel an unresponsive number and instantly release the line back to carrier pool with full credit refund.
Authorization: Bearer <token>Request Parameters
1 fieldsidpathstringOrder ID to cancel and refund.
ord_69d4b8946fdb87c1f163e1c9Response Schema Attributes
4 attributesorderIdstringord_69d4b8946fdb87c1f163e1c9Cancelled order ID.
statusstringFLAGGED_REFUNDEDUpdated state: "FLAGGED_REFUNDED".
refundedAmountnumber (USD)0.85Exact balance credited back to wallet.
refundedAtstring (ISO 8601)2026-08-16T10:14:22.000ZUTC timestamp of refund event.
HTTP Status Codes
curl -X POST "https://api.temphonenumber.com/api/flagNumber/ord_69d4b8946fdb87c1f163e1c9" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
{
"orderId": "ord_69d4b8946fdb87c1f163e1c9",
"status": "FLAGGED_REFUNDED",
"refundedAmount": 0.85,
"refundedAt": "2026-08-16T10:14:22.000Z"
}Reuse Phone Number
Re-activate a previously used physical SIM number for 2FA re-verification or subsequent SMS messages.
Authorization: Bearer <token>Request Parameters
1 fieldsidpathstringOriginal order ID to reactivate.
ord_69d4b8946fdb87c1f163e1c9Response Schema Attributes
4 attributesorderIdstringord_69d4b8946fdb87c1f163e1c9New order identifier.
reusedbooleantrueConfirms line reactivation.
phoneNumberstring (E.164)+14155552671Same dedicated phone number.
expiresAtinteger (unix)1723791200New expiration timestamp.
HTTP Status Codes
curl -X POST "https://api.temphonenumber.com/api/reuseNumber/ord_69d4b8946fdb87c1f163e1c9" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
{
"orderId": "ord_69d4b8946fdb87c1f163e1c9",
"reused": true,
"status": "ACTIVE",
"phoneNumber": "+14155552671",
"expiresAt": 1723791200
}Get SMS Messages
Poll or fetch message history and delivery logs for a given rental transaction or line ID.
Authorization: Bearer <token>Request Parameters
1 fieldsidpathstringOrder ID to query.
ord_69d4b8946fdb87c1f163e1c9Response Schema Attributes
4 attributesorderIdstringord_69d4b8946fdb87c1f163e1c9Order identifier.
messages[].senderstringWhatsAppService or sender identity.
messages[].bodystringYour WhatsApp verification code is: 849-201Full text body.
messages[].codestring849201Parsed verification code.
HTTP Status Codes
curl -X GET "https://api.temphonenumber.com/api/sms/ord_69d4b8946fdb87c1f163e1c9" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
{
"orderId": "ord_69d4b8946fdb87c1f163e1c9",
"messages": [
{
"sender": "WhatsApp",
"body": "Your WhatsApp verification code is: 849-201",
"code": "849201",
"receivedAt": "2026-08-16T10:14:22Z"
}
]
}Rent Long-Term Number (LTR)
Reserve a persistent dedicated physical SIM number for 7, 30, or 90 days with unlimited incoming SMS reception.
Authorization: Bearer <token>Request Parameters
4 fieldsserviceIdbodystringService identifier or "all" for multi-service inbox.
alldurationDaysbodyintegerLease period in days (7, 30, 90, 180, 365).
3073090180365countrybodystringISO country code.
USautoRenewbodybooleanAuto-renew line from wallet balance before expiration.
falseResponse Schema Attributes
5 attributesrentalIdstringltr_9481948201Dedicated subscription UUID.
statusstringACTIVESubscription state ("ACTIVE").
phoneNumberstring (E.164)+14155558912Dedicated physical SIM line.
expiresAtstring (ISO 8601)2026-09-15T10:00:00ZUTC subscription expiry timestamp.
pricenumber (USD)18.50Billed monthly rate.
HTTP Status Codes
curl -X POST "https://api.temphonenumber.com/api/ltr/rent" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"serviceId": "69a13a4ef133cd20b4a7c082",
"durationDays": 30,
"country": "US"
}'{
"rentalId": "ltr_9481948201",
"status": "ACTIVE",
"phoneNumber": "+14155558912",
"country": "US",
"service": "WhatsApp + Telegram + Any",
"startsAt": "2026-08-16T10:00:00Z",
"expiresAt": "2026-09-15T10:00:00Z",
"autoRenew": false,
"price": 18.5
}Renew LTR Line
Extend the lease duration of an existing long-term dedicated number before expiry to preserve the phone line.
Authorization: Bearer <token>Request Parameters
2 fieldsidpathstringLong-term rental ID to renew.
ltr_9481948201extendDaysbodyintegerNumber of additional days to extend lease.
3073090180365Response Schema Attributes
4 attributesrentalIdstringltr_9481948201Rental UUID.
statusstringRENEWED"RENEWED".
newExpiresAtstring (ISO 8601)2026-10-15T10:00:00ZExtended expiry UTC timestamp.
chargedAmountnumber (USD)18.50Renewal price charged to wallet.
HTTP Status Codes
curl -X PUT "https://api.temphonenumber.com/api/ltr/renew/ltr_9481948201" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "extendDays": 30 }'{
"rentalId": "ltr_9481948201",
"status": "RENEWED",
"phoneNumber": "+14155558912",
"newExpiresAt": "2026-10-15T10:00:00Z",
"chargedAmount": 18.5
}Get Active LTR Rentals
Retrieve all active and expiring long-term physical SIM number subscriptions associated with your account.
Authorization: Bearer <token>Response Schema Attributes
5 attributestotalinteger2Active rentals count.
rentals[].idstringltr_9481948201Subscription UUID.
rentals[].phoneNumberstring (E.164)+14155558912Assigned telephone number.
rentals[].servicestringAll ServicesConfigured service routing scope.
rentals[].expiresAtstring (ISO 8601)2026-09-15T10:00:00ZExpiry UTC timestamp.
HTTP Status Codes
curl -X GET "https://api.temphonenumber.com/api/ltr/rentals" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
{
"total": 2,
"rentals": [
{
"id": "ltr_9481948201",
"phoneNumber": "+14155558912",
"service": "All Services",
"expiresAt": "2026-09-15T10:00:00Z",
"status": "ACTIVE"
},
{
"id": "ltr_9481948202",
"phoneNumber": "+447700900123",
"service": "WhatsApp",
"expiresAt": "2026-09-20T10:00:00Z",
"status": "ACTIVE"
}
]
}Get LTR SMS Inbox
Retrieve all historical and real-time incoming SMS text payloads received by a persistent long-term phone number.
Authorization: Bearer <token>Request Parameters
1 fieldsidpathstringLong-term rental ID.
ltr_9481948201Response Schema Attributes
4 attributesrentalIdstringltr_9481948201Rental UUID.
messages[].fromstring+18005550199Sender telephone or shortcode.
messages[].textstringSecurity code: 591042Full SMS body.
messages[].codestring591042Extracted verification PIN.
HTTP Status Codes
curl -X GET "https://api.temphonenumber.com/api/ltr/sms/ltr_9481948201" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
{
"rentalId": "ltr_9481948201",
"messages": [
{
"id": "msg_01",
"from": "+18005550199",
"text": "Security code: 591042",
"code": "591042",
"receivedAt": "2026-08-16T11:20:00Z"
},
{
"id": "msg_02",
"from": "+18005550199",
"text": "Password reset PIN is 301984",
"code": "301984",
"receivedAt": "2026-08-16T12:05:00Z"
}
]
}Set Webhook Endpoint
Register your HTTP callback URL to receive instantaneous real-time events when SMS messages arrive or orders update.
Authorization: Bearer <token>Request Parameters
2 fieldsurlbodystring (HTTPS URL)Publicly reachable HTTPS endpoint on your server to receive JSON event posts.
https://api.myapp.com/webhooks/temphonenumbereventsbodystring[]Array of event types to subscribe to.
["sms.received", "order.completed"]sms.receivedorder.completedorder.refundedorder.expiredResponse Schema Attributes
4 attributesstatusstringWEBHOOK_CONFIGURED"WEBHOOK_CONFIGURED".
urlstringhttps://api.myapp.com/webhooks/temphonenumberRegistered endpoint URL.
secretstringwhsec_9482019348123984HMAC-SHA256 signing secret for payload verification.
eventsstring[]["sms.received", "order.completed"]Subscribed event topics.
HTTP Status Codes
curl -X POST "https://api.temphonenumber.com/api/webhook/set" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"url": "https://api.myapp.com/webhooks/temphonenumber",
"events": ["sms.received", "order.completed"]
}'{
"status": "WEBHOOK_CONFIGURED",
"url": "https://api.myapp.com/webhooks/temphonenumber",
"secret": "whsec_9482019348123984",
"events": [
"sms.received",
"order.completed"
]
}Get Webhook Configuration
Retrieve the currently active webhook endpoint URL, subscribed event topics, and signature verification client ID.
Authorization: Bearer <token>Response Schema Attributes
4 attributesurlstringhttps://api.myapp.com/webhooks/temphonenumberActive destination URL.
statusstringACTIVEListener state ("ACTIVE").
eventsstring[]["sms.received", "order.completed"]Subscribed event topics.
lastDeliveryStatusstring200 OKHTTP status of the most recent webhook delivery attempt.
HTTP Status Codes
curl -X GET "https://api.temphonenumber.com/api/webhook/get" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
{
"url": "https://api.myapp.com/webhooks/temphonenumber",
"status": "ACTIVE",
"events": [
"sms.received",
"order.completed",
"order.refunded"
],
"lastDeliveryStatus": "200 OK",
"lastDeliveryAt": "2026-08-16T12:00:00Z"
}Delete Webhook
Deactivate and delete the configured webhook callback destination from your account.
Authorization: Bearer <token>Response Schema Attributes
2 attributesstatusstringWEBHOOK_DELETED"WEBHOOK_DELETED".
messagestringWebhook endpoint removed successfullyConfirmation message.
HTTP Status Codes
curl -X DELETE "https://api.temphonenumber.com/api/webhook/delete" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
{
"status": "WEBHOOK_DELETED",
"message": "Webhook endpoint removed successfully"
}Send Test Webhook Event
Trigger a sample mock verification event payload to your configured URL to verify HMAC signature verification logic.
Authorization: Bearer <token>Response Schema Attributes
4 attributesstatusstringTEST_EVENT_SENT"TEST_EVENT_SENT".
deliveredbooleantrueTrue if server acknowledged with 2xx.
responseStatusCodeinteger200HTTP status code received from your server.
latencyMsinteger142Round-trip delivery duration in milliseconds.
HTTP Status Codes
curl -X POST "https://api.temphonenumber.com/api/webhook/test" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
{
"status": "TEST_EVENT_SENT",
"delivered": true,
"responseStatusCode": 200,
"latencyMs": 142,
"samplePayload": {
"event": "sms.received",
"phoneNumber": "+14155552671",
"sms": "Your verification code is 849201",
"code": "849201"
}
}Verify Webhook Signatures
temphonenumber signs all outbound webhook event payloads with an HMAC-SHA256 signature using your account's webhook secret. Verify this signature to prevent replay attacks and ensure requests originate strictly from temphonenumber servers.
Headers Dispatched With Each Event
X-temphonenumber-SignatureX-temphonenumber-Timestampimport crypto from 'crypto';
import express from 'express';
const app = express();
// Ensure you capture raw body buffer for signature calculation
app.use(express.json({ verify: (req, res, buf) => { req.rawBody = buf; } }));
app.post('/webhooks/temphonenumber', (req, res) => {
const signature = req.headers['x-temphonenumber-signature'];
const timestamp = req.headers['x-temphonenumber-timestamp'];
const webhookSecret = process.env.TEMP_PHONE_WEBHOOK_SECRET;
// 1. Concatenate timestamp and raw body
const signedPayload = `${timestamp}.${req.rawBody}`;
// 2. Compute expected HMAC-SHA256 signature
const expectedSig = crypto
.createHmac('sha256', webhookSecret)
.update(signedPayload)
.digest('hex');
// 3. Prevent timing attacks via constant-time comparison
const isValid = crypto.timingSafeEqual(
Buffer.from(signature, 'hex'),
Buffer.from(expectedSig, 'hex')
);
if (!isValid) {
return res.status(401).send('Invalid signature');
}
// Process verified event payload
const event = req.body;
if (event.event === 'sms.received') {
console.log('OTP received:', event.code, 'for line:', event.phoneNumber);
}
res.status(200).json({ received: true });
});Node.js / TypeScript SDK
Official TypeScript and Node.js client featuring built-in exponential retry logic, static typing for all endpoints, and automatic OAuth2 token management:
import { temphonenumber } from '@temphonenumber/sdk';
const client = new temphonenumber({
clientId: process.env.TEMP_PHONE_CLIENT_ID!,
clientSecret: process.env.TEMP_PHONE_CLIENT_SECRET!,
});
// 1. Purchase a physical SIM number
const order = await client.str.purchase({
service: 'whatsapp',
country: 'US',
});
console.log('Allocated line:', order.phoneNumber);
// 2. Wait for incoming SMS OTP code
const message = await client.str.waitForCode(order.id, { timeoutMs: 120_000 });
console.log('Verification code received:', message.code);Python SDK
Official Python package with complete support for async/await (asyncio), synchronous requests, and Pydantic response validation:
from temphonenumber import temphonenumberClient
client = temphonenumberClient(
client_id="your_client_id",
client_secret="your_client_secret"
)
# Purchase physical line for OpenAI / ChatGPT
order = client.str.purchase(service="openai", country="US")
print(f"Purchased number: {order.phone_number}")
# Wait for SMS code with built-in poll helper
sms = client.str.wait_for_sms(order.order_id, timeout_seconds=120)
print(f"SMS Received: {sms.code}")Go SDK
High-concurrency Go module with native context cancellation, connection pooling, and zero external dependencies:
package main
import (
"context"
"fmt"
"github.com/temphonenumber/go-sdk"
)
func main() {
client := temphonenumber.NewClient("client_id", "client_secret")
ctx := context.Background()
order, err := client.STR.Purchase(ctx, &temphonenumber.PurchaseParams{
WebsiteID: "telegram",
Quantity: 1,
})
if err != nil {
panic(err)
}
fmt.Printf("Line: %s\n", order.PhoneNumber)
}PHP SDK
Composer-compatible PHP client supporting Laravel Service Providers, Symfony Bundles, and standalone PSR-18 HTTP clients:
use temphonenumber\Client;
$client = new Client('client_id', 'client_secret');
$order = $client->str()->purchase([
'websiteId' => 'whatsapp',
'country' => 'US',
]);
echo "Assigned number: " . $order->phoneNumber;cURL & Raw HTTP
Execute direct cURL commands in bash scripts, CI/CD pipelines, Docker containers, and microservices:
curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" https://api.temphonenumber.com/api/buyNumbers -d '{"websiteId":"whatsapp"}'