How to Implement Text2FA API (Full Integration Guide)
Introduction
If you’re building an app or website and need to integrate SMS-based verification — such as OTPs or temporary phone numbers — the Text2FA API provides a full suite of endpoints to help you automate this process. Their documentation outlines how to request temporary numbers, get messages, manage rentals and more. text2fa.com
Watch in youtube: https://youtu.be/fYJnsarQMVg
In this post, we’ll walk through:
- What the API offers
- How to authenticate and make requests
- Key endpoints you’ll use for temporary and rental numbers
- Best practices and things to watch out for
What is Text2FA?
Text2FA is a service offering virtual/temporary phone numbers and SMS receipt capabilities. It’s designed for scenarios where you need to receive verification codes without using a personal phone number. The API enables you to programmatically manage this via HTTP requests. (See their general service description) text2fa.com
Authentication & Setup
Before making API calls, you’ll need:
- An API token provided by Text2FA
- To include in all requests an
Authorizationheader containing that token. text2fa.com - An
Accept: application/jsonheader. text2fa.com - For POST requests, set
Content-Type: application/x-www-form-urlencoded. text2fa.com
Key Endpoints
Here are some of the primary API endpoints you’ll work with:
1. Account Details
- Endpoint:
GET /api/v1/account-details - Purpose: Retrieves your account info and current balance. text2fa.com
- Headers required: Authorization + Accept.
2. Temporary Number (S1) Flow
- Service List:
GET /api/v1/services-s1→ list of available services for S1. text2fa.com - US States (if you need US-state scoped numbers):
GET /api/v1/us-statestext2fa.com - Request Number:
POST /api/v1/request-number-s1- Params:
service_key,state(optional),request_premium(if you want to bid premium) text2fa.com
- Params:
- Reuse Number:
POST /api/v1/reuse-number-s1→ reuse a number you previously ordered. text2fa.com - Reject Number:
POST /api/v1/reject-number-s1→ release a number you don’t need. text2fa.com - Number Details:
GET /api/v1/number-details-s1?order_id=<id>→ get info about specific order. text2fa.com - Reserved List:
GET /api/v1/reserved-list-s1→ see reserved S1 numbers under your account. text2fa.com
3. Temporary Number (S2) Flow
- Similar to S1 but a different category.
- Service List:
GET /api/v1/services-s2text2fa.com - Request Number:
POST /api/v1/request-number-s2(withservice_key) text2fa.com - Reject Number, Number Details, Reserved List all follow similar patterns. text2fa.com
4. Rental Numbers
- Service List:
GET /api/v1/rental-service-listtext2fa.com - States/Countries:
GET /api/v1/rental-statestext2fa.com - Request Rental Number:
POST /api/v1/request-rental-number- Params:
service_key,duration(in days) text2fa.com
- Params:
- Reserved List:
GET /api/v1/rental-reserve-listtext2fa.com - Get Message:
GET /api/v1/rental-message?order_id=<id>→ retrieve SMS for that number. text2fa.com - Active Rentals:
GET /api/v1/active-rental-numberstext2fa.com - Renew Rental:
POST /api/v1/renew-rental(params: order_id, additional_days) text2fa.com - Cancel Rental:
POST /api/v1/cancel-rental(param: order_id) text2fa.com
Embedding the Video
You can embed the tutorial video (above) into your WordPress post using the standard YouTube embed approach. Here’s how:
- Copy the YouTube link:
https://youtu.be/fYJnsarQMVg - In your WordPress editor, either paste it directly (Gutenberg auto-embed) or use the “YouTube” block.
- Place it suitably early in the post so readers can watch the walkthrough while reading.
Best Practices
- Use the right service key: Make sure you select the correct service (S1, S2 or Rental) depending on your use case.
- Manage premium requests: If regular numbers are unavailable, you can set
request_premiumto bid higher for priority access. - Poll for messages: For temporary numbers, many workflows require checking the number details then waiting/polling for an SMS code.
- Set up webhooks: The documentation mentions you can configure a webhook URL for real-time events (number assignment, SMS reception, rental updates). text2fa.com
- Handle rejections & cleanups: If you no longer need a number, it’s good practice to release it (Reject endpoint) so you don’t waste resources.
- Monitor your balance: Since usage costs money, keep an eye on your account balance and usage to avoid unexpectedly running out.
