Docs
Verify emails in Laravel
Use the Http facade in a route or controller. Prefer config() over env() outside config files. The API key stays on your server; the browser only talks to your own endpoint.
Before you start
Create an API key under Settings → API keys and keep it in an environment variable named VALIDREACH_API_KEY on your server. Never ship it in browser or mobile code.
Example
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
Route::post('/verify', function (Request $request) {
$res = Http::withToken(env('VALIDREACH_API_KEY'))
->timeout(30)
->post('https://validreach.dev/api/v1/verify/single', [
'email' => $request->input('email'),
]);
if (!$res->json('success')) {
return response()->json(['status' => 'unknown']);
}
return response()->json([
'status' => $res->json('data.status'),
'is_deliverable' => $res->json('data.is_deliverable'),
]);
});Handle the result
Branch on data.status. Treat invalid and disposable as rejections, retry unknown later when retryable is true (unknown is not billed), and decide on catchall, risky and role by your own policy. HTTP 402 means out of credits and 429 means rate limited.
Related