Backend
Supabase
Score a signup from a Supabase Edge Function or a database trigger.
What exists today
A plain fetch from an Edge Function. Keep the API key in Supabase's secrets, never in a client-side call, or anyone can read it out of your app.
Setup
- 1supabase secrets set LAYERCALL_API_KEY=your_key
- 2In an Edge Function, POST to /v1/score/user with the new user's ip, email and phone.
- 3Act on verdict — reject, flag for review, or require email verification.
- 4Call it from an auth hook or a trigger so it cannot be skipped by a client that talks to the database directly.
Code
const res = await fetch("https://www.layercall.com/v1/score/user", {
method: "POST",
headers: {
"X-Api-Key": Deno.env.get("LAYERCALL_API_KEY")!,
"Content-Type": "application/json",
},
body: JSON.stringify({ ip, email, phone }),
});
const { verdict, risk_score } = await res.json();
if (verdict === "block") throw new Error("Signup rejected");Questions
Can I call this from the browser?
No. Any key shipped to a browser is public the moment someone opens devtools, and it would be billed against your account by whoever finds it. Call it from an Edge Function or your backend.