Skip to main content

Telnyx Numbers: Identity — Full Documentation

Complete page content for Identity (Numbers section) of the Telnyx developer docs (https://developers.telnyx.com). This file: https://developers.telnyx.com/development/llms/numbers-identity-llms-full-txt.md · Root index: https://developers.telnyx.com/llms.txt

Number Lookup

Number lookup using Telnyx APIs

Source: https://developers.telnyx.com/docs/identity/number-lookup/quickstart.md

Lookup: Carrier and caller name

| cURL | Python | Node | Ruby |

cURL

Number Lookup is a service offered by the Telnyx SDK that allows the user to look up a phone number and retrieve information regarding that phone number such as:
  • Carrier name
  • Type of phone (landline, mobile, etc.)
  • Name and business associated with the number

Basic number lookup example

Running the following code will perform a number lookup on the given number parameter. Don’t forget to update YOUR_API_KEY here.
After pasting the above content, Kindly check and remove any new line added The response will look something like this:
After pasting the above content, Kindly check and remove any new line added This example shows results for a Telnyx user-owned number. It displays the formatted version of the number in the national-format value. The location of the number can be seen under portability -> city and state. Other useful information such as carrier and caller_name can be retrieved if available.

Retrieving caller name and carrier

Users may also specify the type of the request in order to receive information about the carrier and caller-name. Note that the request will always return the same object, however if the caller-name and carrier options are not sent, the return values will be null. An example of adding both these parameters to the request is shown below:
After pasting the above content, Kindly check and remove any new line added

Python

Number Lookup is a serviceis a service offered by the Telnyx SDK that allows the user to look up a phone number and retrieve information regarding that phone number such as:
  • Carrier name
  • Type of phone (landline, mobile, etc.)
  • Name and business associated with the number

Basic number lookup example

Running the following code will perform a number lookup on the given number parameter using Python.
After pasting the above content, Kindly check and remove any new line added The response will look something like this:
After pasting the above content, Kindly check and remove any new line added This example shows results for a Telnyx user-owned number. It displays the formatted version of the number in the national-format value. The location of the number can be seen under portability -> city and state.

Retrieving caller name and carrier

Users may also specify the type of the request in order to receive information about the carrier and caller-name. Note that the request will always return the same object, however if the caller-name and carrier options are not sent, the return values will be null.

Node

Number Lookup is a serviceoffered by the Telnyx SDK that allows the user to look up a phone number and retrieve information regarding that phone number such as:
  • Carrier name
  • Type of phone (landline, mobile, etc.)
  • Name and business associated with the number

Basic number lookup example

Running the following code will perform a number lookup on the given number parameter.
After pasting the above content, Kindly check and remove any new line added The response will look something like this:
After pasting the above content, Kindly check and remove any new line added This example shows results for a Telnyx user-owned number. It displays the formatted version of the number in the national-format value. The location of the number can be seen under portability -> city and state. Other useful information such as carrier and caller_name can be retrieved if available.

Retrieving caller name and carrier

Users may also specify the type of the request in order to receive information about the carrier and caller-name. Note that the request will always return the same object, however if the caller-name and carrier options are not sent, the return values will be null. An example request for these options is shown below:
After pasting the above content, Kindly check and remove any new line added

Ruby

Number Lookup is a service is a service offered by the Telnyx SDK that allows the user to look up a phone number and retrieve information regarding that phone number such as:
  • Carrier name
  • Type of phone (landline, mobile, etc.)
  • Name and business associated with the number

Basic number lookup example

Running the following code will perform a number lookup on the given number parameter.
After pasting the above content, Kindly check and remove any new line added The response will look something like this:
After pasting the above content, Kindly check and remove any new line added This example shows results for a Telnyx user-owned number. It displays the formatted version of the number in the national-format value. The location of the number can be seen under portability -> city and state. Other useful information such as carrier and caller_name can be retrieved if available.

Retrieving caller name and carrier

Users may also specify the type of the request in order to receive information about the carrier and caller-name. Note that the request will always return the same object, however if the caller-name and carrier options are not sent, the return values will be null.

Verify

Telnyx verify quickstart

Source: https://developers.telnyx.com/docs/identity/verify/quickstart.md
In this tutorial, you’ll learn how to deliver a 2FA token to any mobile number and verify that token using the Telnyx v2 API. Examples are provided in curl, Node.js, Python, Ruby, Go, Java, .NET, and PHP.

Prerequisites

Sign up at telnyx.com if you don’t have an account yet. Follow the API Keys guide to generate an API key. Set it as an environment variable:
macOS/Linux
Windows
If you prefer using an SDK over curl, install one for your language:
Node.js
Python
Ruby
Go
PHP
For Java and .NET, the examples use the standard HTTP client libraries included with the platform.

Methods of verification

There are currently three verification methods available:
  • sms - the verification code is sent in a custom or default templated message.
  • call - the code is spoken aloud in a custom or default templated message when the user answers the call.
  • flashcall - the verification code is embedded in the caller ID of a brief “flash” call (the call rings once and hangs up). The user’s app extracts the code automatically.

Create a verify profile

A Verify Profile contains several important configurations that you’ll use when sending 2-factor authentication messages and receiving responses. Before you send any 2FA messages, you need a profile to go with them. Each profile can have one of each verification method configured. It is recommended that if you wish to configure multiple applications, you use a different profile for each one. In the below example we will set up a verification profile that can use SMS using a selected message template and speech to text calling.

Select a message template

curl
Node
Python
Ruby
Go
Java
.NET
PHP

Example response

If not selected then the default template is “Your verification code is {code}.” Want to use your own branded verification messages? You can now create custom templates that match your brand voice and compliance requirements.

Create a verify profile

curl
Node
Python
Ruby
Go
Java
.NET
PHP

Example response

Don’t forget to set your TELNYX_API_KEY environment variable or replace YOUR_API_KEY in the curl examples. Take note of the profile’s id that’s returned to you, you’ll need it to send 2FA verifications. At any time, you can access all of your created Verify Profiles by API as well. You are now ready to send 2-factor authentication messages!

Trigger a verification request

To send a verification attempt, you need the Verify Profile ID, the phone number that will receive the message, and the verification type. Choose the method that best fits your use case: SMS verification sends a code via text message. This is the most common method with the widest global coverage.
curl
Node
Python
Ruby
Go
Java
.NET
PHP
User experience: The user receives a text message with a numeric code (e.g., “Your verification code is: 17686”). They enter this code in your application. Call verification speaks the code aloud when the user answers. Useful when the user cannot receive SMS (landlines, VoIP) or in regions with unreliable SMS delivery. Profile configuration for call: When creating your verify profile, include the call configuration:
Initiate a call verification:
curl
Node
Python
Ruby
Go
Java
.NET
PHP
User experience: The user receives a phone call. An automated voice reads the verification code aloud (e.g., “Your verification code is 1-7-6-8-6”). The code is repeated twice. The user then enters the code in your application. DTMF confirmation: You can optionally enable DTMF confirmation, where the user enters the code on their phone keypad during the call instead of typing it in your app. See the DTMF Confirmation guide for details.

Example response (all methods)

Choosing the right verification method

Fallback strategy: Configure multiple methods in your verify profile. Start with SMS (fastest and widest coverage), fall back to call if SMS fails. For mobile apps, consider flashcall as a zero-friction primary method with SMS as fallback.

Verify a 2FA code

The user provides the code they received (via SMS or call). Submit it to Telnyx to verify it matches:
curl
Node
Python
Ruby
Go
Java
.NET
PHP

Example response

A response_code of "accepted" confirms the code matches. Other possible values: Telnyx Verify supports webhooks to receive instant notifications when users complete verification, eliminating the need for polling. This enables event-driven workflows for faster user experiences. Learn more: Receiving Webhooks for Telnyx Verify

Next steps

Now that you’ve completed a basic verification flow, explore these guides to build a production-ready implementation: Create branded verification messages that match your app’s voice and compliance requirements. Protect against SMS pumping, brute force attacks, and other verification fraud. Receive real-time notifications when verifications complete or expire. Complete login, registration, and payment verification flow implementations.

DTMF confirmation

Source: https://developers.telnyx.com/docs/identity/verify/dtmf-confirm.md
DTMF confirmation calls a phone number, plays a TTS prompt, and collects a single keypress (1) to confirm ownership. No verification code is generated — the keypress is the confirmation. The POST /verifications/{id}/actions/verify endpoint is not used. Verification completes on the call itself. DTMF confirmation is unique to Telnyx — Twilio and Vonage Verify APIs only support code-based voice verification (read a code, then type it). Single-keypress confirmation reduces user friction and works on landlines.

Flow

Up to 3 attempts per call. After 3 wrong digits, the call ends with status invalid.

Use cases

Confirm ownership before allowing a number as outbound Caller ID. Verify numbers that cannot receive SMS. Single keypress instead of reading and typing a code. Confirm phone ownership without code entry.

Create a verify profile

Create a profile with dtmf_confirm settings. This can be combined with other verification types (SMS, call) on the same profile.
curl
Python
Node
Ruby
Go
Java
.NET
PHP
The returned id is required for verification requests.

Trigger verification

curl
Python
Node
Ruby
Go
Java
.NET
PHP

Response

Default TTS prompt:
“This is a verification call to confirm that this phone number is going to be used as a Caller ID for outbound calls. If you did not request this verification, or if someone is asking you to accept this call, please ignore this message. If you did request this verification, please press 1.”
The TTS language is determined by the language field on the Verify Profile (default: en-US).

Handle the result

Verification completes on the call — no verify endpoint call needed. Receive the outcome via webhooks.

Accepted (digit 1 pressed)

Failed (wrong digit, timeout, or call failure)

Polling alternative


Complete example

Full flow: create profile, trigger verification, handle webhook.

Verification type comparison


Troubleshooting

Verification times out with status expired. Implement a retry with delay, or fall back to SMS. Up to 3 attempts per call. After 3 failures, status is invalid. Trigger a new verification to retry. Call was not answered and no webhook received. Verify the webhook URL is configured and reachable. Poll the status endpoint as fallback. The prompt is fixed to the standard verification message. Voice and language are determined by the Verify Profile’s language setting. Custom prompt text is not yet supported. Standard Verify API rate limits apply. Avoid triggering multiple concurrent verifications for the same phone number — the previous call must complete or time out first.

Next steps

Real-time verification status updates. Branded verification messages for SMS and call types. Full API specification. SMS and call verification guide.

Custom templates

Source: https://developers.telnyx.com/docs/identity/verify/custom-templates.md
Telnyx Verify now enables you to create and register your own verification message templates instantly. This feature allows you to build compliant, branded one-time password (OTP) messages that match your brand voice while maintaining security standards.

Overview

Custom templates give you complete control over your verification messaging. Instead of using pre-built templates, you can create personalized messages that:
  • Align with your brand guidelines and tone of voice.
  • Include industry-specific security warnings and disclaimers.
  • Maintain compliance with regulatory requirements.
  • Deploy instantly without manual approval processes.

When to use custom templates

Use custom templates when:
  • You need branded verification messages that match your company’s voice.
  • Your industry requires specific compliance language in OTP messages.
  • You want to include custom security warnings or instructions.
  • You need different templates for different user segments or regions.
Use pre-built templates when:
  • You’re getting started quickly and don’t need customization.
  • Standard verification messages meet your requirements.
  • You want to minimize setup time.

Template variables

All verification templates support the following variables that will be automatically replaced when sending verifications:
  • {{app_name}} - Your application name as configured in the verify profile.
  • {{code}} - The verification code sent to the user.

Creating custom templates

Use the Telnyx API to create custom verification message templates.

Create a custom template

Example response

Save the template id returned in the response. You’ll need this ID to reference the template when creating verify profiles. For complete API details, see the Create Message Template API reference.

Real-world template examples

Here are industry-specific template examples to inspire your custom messaging:

E-commerce and retail

Banking and finance

Healthcare and telemedicine

Social media and gaming

Delivery and logistics

Travel and hospitality

Using custom templates in verify profiles

Once you’ve created a custom template, reference its ID when creating or updating a verify profile.

Example: Create verify profile with custom template

The messaging_template_id field references your custom template. When you send verifications using this profile, your custom template will be used instead of the default.

Updating custom templates

You can update existing custom templates to refine messaging or fix errors.

Update a template

Example response

Updating a template affects all verify profiles that reference it. Test template changes carefully before updating production templates. For complete API details, see the Update Message Template API reference.

Best practices

Keep messages concise

SMS messages have character limits. Keep your templates under 160 characters when possible to avoid message splitting and additional costs.

Include security warnings

For sensitive use cases like banking or healthcare, include warnings about not sharing codes:

Test before production

Always test new templates in a development environment before using them in production verify profiles. Send test verifications to confirm:
  • Variables are replaced correctly.
  • Message formatting appears as expected.
  • Character count is within limits.
  • Links or special characters display properly.

Follow compliance guidelines

Ensure your templates comply with:
  • Industry regulations (HIPAA, PCI-DSS, GDPR, etc.).
  • Carrier requirements for SMS messaging.
  • Local laws regarding verification messages.
  • Your organization’s security policies.

Consider localization

If you serve multiple regions, create separate templates for different languages and cultures. Use the verify profile’s language parameter to organize templates by locale.

Next steps


Webhooks

Source: https://developers.telnyx.com/docs/identity/verify/receiving-webhooks.md
You can choose to be notified about events on your send verifications by configuring webhooks on your verify profile.

Verify delivery status updates

The Telnyx Verify Service will attempt to notify you about the following delivery events for the send verification request:
  • verify.sent
  • verify.failed
  • verify.delivered

Delivery status Payload

Here is an example of a webhook event where a delivery receipt is returned to the sender after sending a verification:

Delivery statuses

Delivery Status Description sent The verification has been sent to the upstream provider. delivered The upstream provider has confirmed delivery of the verification. sending_failed Telnyx has failed to send the verification to the upstream provider. Please reach out to our support if you have received this status. delivery_failed The upstream provider has failed to send the verification to the receiver. Please reach out to our support if you have received this status. delivery_unconfirmed There is no indication whether or not the verification has reached the receiver. Please reach out to our support if you have received this status

Real-time verification status updates

Telnyx Verify now supports webhooks for instant verification status notifications, eliminating the need to poll the API for verification completion.

Benefits

  • Eliminates polling - No need to repeatedly check verification status through API calls.
  • Event-driven workflow - React immediately to verification state changes in real-time.
  • Faster user experience - Process verification completions instantly without delays.
  • Improved efficiency - Reduces server load and unnecessary API requests.
Configure webhooks on your Verify profile to receive real-time updates when verifications complete. For specific webhook event types, payload structures, and configuration details, refer to the Telnyx API documentation or contact Telnyx support.

Telnyx Webhook IPs

If you use an ACL or Firewall on your network, make sure you whitelist the following subnet(s): 192.76.120.192/27

Security Best Practices

Source: https://developers.telnyx.com/docs/identity/verify/security-best-practices.md
Verification flows are a high-value target for attackers. SMS pumping, toll fraud, brute-force code guessing, and social engineering can cost you money and compromise user accounts. This guide covers practical defenses you should implement alongside Telnyx Verify.

Threat overview

Rate limiting

Rate limiting is your first line of defense against abuse. Apply limits at multiple layers.

Per-phone-number limits

Restrict how many verification attempts a single phone number can trigger within a time window.
Node
Python
Go

Per-IP address limits

Prevent a single IP from triggering verifications for many different numbers (a hallmark of SMS pumping):
Node
Python

SMS pumping prevention

SMS pumping is the most costly fraud vector for verification flows. Attackers abuse your send endpoint to generate SMS revenue on number ranges they control.

Detection signals

Watch for these patterns:
  • Sequential numbers — Verification requests for +1234500001, +1234500002, +1234500003
  • Unusual country codes — Spike in verifications to countries you don’t serve
  • High failure rate — Many verifications triggered but never completed
  • Burst traffic — Sudden spike in verification requests from a single source

Defenses

Configure whitelisted_destinations on your Verify profile to only allow countries where your users are:
Don’t expose your verification endpoint to unauthenticated users. Require at least a session or account to trigger a verification. Place a CAPTCHA (reCAPTCHA, hCaptcha, Turnstile) before the phone number input to block automated submissions. Set up alerts for unusual verification volume:

Code security

Use appropriate code length

Longer codes are harder to brute-force but harder for users to enter. Balance security and usability: Configure code length in your Verify profile:

Set appropriate timeouts

Short timeouts reduce the window for brute-force attacks:
A 5-minute timeout (300 seconds) works well for most applications. Shorter timeouts (120s) add security but may frustrate users on slow networks.

Limit verification attempts

Lock out after too many failed code entries to prevent brute-force:
Node
Python

Prevent number enumeration

Don’t reveal whether a phone number exists in your system through verification responses: ❌ Vulnerable — reveals whether the number is registered:
✅ Secure — same response regardless:
Always return a consistent response and send the verification (or silently drop it) regardless of whether the number exists in your system.

Channel fallback strategy

Use multiple verification channels to improve delivery and security: Start with SMS verification — widest reach and fastest delivery. If SMS isn’t delivered within 30 seconds, offer a voice call option. This helps users on networks with delayed SMS delivery. For supported markets, flashcall verification (where the phone number itself is the code) provides instant verification with no user input required. Configure all three channels on your Verify profile:

Webhook security for Verify

Secure your verification webhook endpoint to prevent spoofed delivery notifications:
  1. Allowlist Telnyx IPs — Only accept webhooks from 192.76.120.192/27
  2. Use HTTPS — Never use plain HTTP for webhook endpoints
  3. Validate payload structure — Check for expected fields before processing
  4. Don’t trust client-side status — Always verify through webhooks or API, never trust client-reported verification status
Node
Python

Security checklist

Use this checklist when implementing Telnyx Verify in production:
  • Per-phone-number rate limit (3/10min)
  • Per-IP rate limit (10/hour)
  • Per-account/session rate limit
  • Global volume monitoring and alerting
  • Country allowlist configured on Verify profile
  • CAPTCHA before verification trigger
  • Authentication required before sending verification
  • SMS pumping detection (sequential numbers, country spikes)
  • Appropriate code length (5-6 digits)
  • Short timeout (300 seconds or less)
  • Max failed attempts lockout (5 attempts)
  • Consistent responses (no number enumeration)
  • HTTPS webhook endpoints
  • Telnyx IP allowlisting for webhooks
  • Server-side verification only (never trust client)
  • Logging and monitoring for anomalies

Next steps

Set up your first verification flow Brand your verification messages Receive real-time verification status updates Advanced fraud prevention strategies

Rate Limiting & Fraud Prevention

Source: https://developers.telnyx.com/docs/identity/verify/rate-limiting-fraud-prevention.md
This guide goes deep on the operational side of protecting your Telnyx Verify integration — server-side rate limiting architectures, geo-fencing, anomaly detection, cost controls, and incident response. For foundational security concepts, see the Security Best Practices guide.

Architecture overview

A robust fraud prevention system layers multiple defenses:
Each layer catches different attack patterns. No single defense is sufficient on its own.

Server-side rate limiting with Redis

Production rate limiting requires a distributed store. These examples use Redis for shared state across multiple application instances.

Sliding window rate limiter

Node
Python
Ruby
Go

Geo-fencing

Restrict verifications to countries where your service operates. This is the single most effective defense against SMS pumping.

Configure on Verify profile

Application-level geo-validation

Add server-side validation before calling the API as a defense-in-depth measure:
Node
Python

High-risk country codes

These country codes are frequently targeted for SMS pumping and toll fraud. Block or add extra scrutiny: Note: These are statistical patterns, not blanket rules. If you serve users in these countries, implement stronger rate limiting rather than blocking.

Anomaly detection

Build automated detection for suspicious patterns beyond simple rate limits.

Conversion rate monitoring

A healthy verification flow has a 60-80% conversion rate (codes sent vs. codes verified). A rate below 20% may indicate an attack.
Node
Python

Sequential number detection

SMS pumping often uses sequential phone numbers. Detect and block this pattern:

Cost controls

Set spend alerts

Monitor your Telnyx account spending and set alerts at the account level through the Telnyx Portal billing settings.

Implement circuit breakers

Automatically disable verifications when anomalies are detected:

Incident response

When you detect a fraud attack in progress: Stop all verification sends to limit financial damage. Look at the destination countries, IP addresses, and phone number patterns in your logs. Remove affected countries from your Verify profile’s whitelisted_destinations. Reduce rate limits, add CAPTCHA if not present, and re-enable verifications gradually. Report the incident to Telnyx Support for investigation and potential charge reversal.

Configuration reference

Summary of all Verify profile settings relevant to fraud prevention:

Next steps

Foundational security concepts for Verify Get started with Telnyx Verify Real-time verification delivery status Brand your verification messages

API Reference (Identity)

Number Lookup

Verify