API Documentation
Integrate WhichOtp directly into your application. Our REST API is designed to be predictable, resource-oriented, and easy to use across all popular programming languages.
Authentication
The WhichOtp API uses API keys to authenticate requests. You can view and manage your API keys in your Dashboard.
Your API requests must include the Authorization: Bearer header.
Base URL
All API requests should be made to the following base URL:
https://api.whichotp.com/api/v1Errors
If an error occurs, the API will return an appropriate HTTP status code along with a JSON response containing an error key. For input validation errors, it returns detailed arrays.
Standard Error
{
"error": "Insufficient balance"
}Validation Error
{
"success": false,
"message": "Validation failed",
"errors": [
{
"field": "serviceId",
"message": "Invalid serviceId. Must be a valid UUID."
}
]
}/balance
Retrieve your current account balance.
Request
curl -X GET "text-blue-400 underline">https://api.whichotp.com/api/v1/balance \ -H "Authorization: Bearer YOUR_API_KEY"
Response
{
"balance": 150.50,
"currency": "USD"
}/services
List all currently available services and their exact pricing.
Request
curl -X GET "text-blue-400 underline">https://api.whichotp.com/api/v1/services \ -H "Authorization: Bearer YOUR_API_KEY"
Example Response
{
"services": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "WhatsApp",
"price": 1.50,
"available": true
}
]
}/orders/buy
Purchase a temporary virtual number for verification.
Request
serviceId— (Required) UUID of the service from the /services endpoint.
curl -X POST "text-blue-400 underline">https://api.whichotp.com/api/v1/orders/buy \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"serviceId":"123e4567-e89b-12d3-a456-426614174000"}'
Response
{
"id": "ord_89b12d3a456",
"phoneNumber": "+1234567890",
"cost": 1.50,
"status": "waiting",
"createdAt": "2023-10-01T12:00:00Z"
}/orders/:id
Poll this endpoint every 5-10 seconds to retrieve the SMS code once received.
Request
curl -X GET "text-blue-400 underline">https://api.whichotp.com/api/v1/orders/ord_89b12d3a456 \ -H "Authorization: Bearer YOUR_API_KEY"
Response
{
"id": "ord_89b12d3a456",
"phoneNumber": "+1234567890",
"status": "completed",
"smsCode": "593821",
"cost": 1.50
}Status can be: waiting, completed, cancelled, or refunded.
/orders/:id/cancel
Cancel a waiting order. Funds will be instantly returned to your balance.
Request
curl -X POST "text-blue-400 underline">https://api.whichotp.com/api/v1/orders/ord_89b12d3a456/cancel \ -H "Authorization: Bearer YOUR_API_KEY"
Response
{
"id": "ord_89b12d3a456",
"status": "refunded",
"refundedAmount": 1.50
}