SvelteKit Form Action Email Verification Guide
Add real-time email verification and disposable-email blocking to SvelteKit Form Action with the VeriShield Edge API. The snippet below gates a signup and returns the canonical email identity.
Language
TypeScript
Ecosystem
Vite / Svelte
Latency
< 85ms
Install
Shell
npm create svelte@latestVerification code
TypeScript
import { fail } from '@sveltejs/kit';
import { RAPIDAPI_KEY } from '$env/static/private';
export const actions = {
signup: async ({ request }) => {
const form = await request.formData();
const email = String(form.get('email'));
const res = await fetch('https://verishield-edge-api.p.rapidapi.com/v1/verify', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-RapidAPI-Key': RAPIDAPI_KEY },
body: JSON.stringify({ email })
});
const report = await res.json();
if (report.fraud_risk.recommendation === 'BLOCK') return fail(403, { error: 'Blocked' });
return { canonicalEmail: report.canonical_email };
}
};What this protects against
Disposable and temporary inboxes, Gmail dot-trick and plus-alias multi-accounting, high-entropy bot usernames, and freshly registered fraud domains. The API returns a 0-100 fraud score with an ALLOW, CHALLENGE_2FA or BLOCK recommendation.