Build custom phone validation workflows using the Loqate API. This guide covers implementation patterns and integration strategies for JavaScript, PHP, and .NET. For pre-built solutions, see Tag integrations or platform integrations. Security and configuration details are in API Security.Documentation Index
Fetch the complete documentation index at: https://docs.loqate.com/llms.txt
Use this file to discover all available pages before exploring further.
These examples demonstrate core integration patterns. Adapt error handling and configuration for your production environment.
Architecture Decisions
Client-side validationQuick to implement and requires less technical expertise, but exposes your API key in client code. Mitigate with domain restrictions in account settings. Best for real-time form validation. Server-side validation
Keeps credentials secure and provides full control over validation logic. Best for backend workflows and batch processing.
API Overview
Phone Validation uses a single endpoint that returns validation status, carrier information, and formatted numbers. Endpoint:POST /PhoneNumberValidation/Interactive/Validate/v2.20/json6.ws
Parameters:
Key- Your API keyPhone- Phone number to validateCountry- ISO country code (optional if number includes country prefix)
Basic Implementation
Handling Results
TheIsValid field returns "Yes", "No", or "Maybe". A "Maybe" response indicates temporary carrier network issues—treat it as potentially valid.
Error Handling
The API returns standard HTTP status codes. Handle errors based on your application’s requirements.| Status | Meaning | Action |
|---|---|---|
| 400 | Bad request | Check request parameters |
| 401 | Unauthorized | Verify API key |
| 403 | Forbidden | Check service permissions or rate limits |
| 500 | Server error | Retry with exponential backoff |
Integration Patterns
Real-Time Form Validation
Validate phone numbers on blur with debouncing to reduce API calls.Batch Validation
Process multiple numbers with rate limiting.Multi-Country Support
Auto-detect user location and adjust validation accordingly.Data Storage
Store validated numbers in international format for consistency.Testing
Test with numbers in various formats and countries:| Number | Country | Expected | Type |
|---|---|---|---|
| +441244657333 | GB | Valid | Landline |
| +447700900123 | GB | Valid | Mobile |
| +14155552671 | US | Valid | Mobile |
| +441234567 | GB | Invalid | N/A |
Security
Configure API key restrictions in your account settings:- Add domain restrictions for client-side implementations
- Use IP allowlists for server-side implementations
- Set rate limits to prevent abuse
- Rotate keys periodically

