Developers
Idizer phone field
Check if a mobile number already has an Idizer mailbox, or start SMS sign-up from your form — same phone → email model as Idizer mail.
Overview
Drop an Idizer phone field on checkout, signup, or profile forms. Type digits only — + and spaces are added for you (380… → +380 50 123 45 67). Include the country code or type the national number (data-default-country). Status icons sit on the right. When the value is set (including on load via data-value) or changes, Idizer checks (debounced) whether that phone has an @idizer.com mailbox. Registered → Idizer logo with green check (hover for email). Not registered → person+ icon (tooltip: quick register — Idizer email). Tap to confirm email, Next sends SMS, Verify, then Open Idizer in a new tab.
Pair this with Sign in with Idizer (SSO) when you need a full OAuth session on your site.
Live preview
This is the real embed script on idizer.com — lookups and SMS use http://localhost:3001. Works here because the API allows this origin (CORS).
Mobile
Framework examples
Official embed at /embed/idizer-phone-field.js. Examples prefill your email field when Idizer recognizes the number or after SMS sign-up.
Add a small embed loader under `src/lib/`, a reusable field component, then mount it on your form.
export const IDIZER_API = "http://localhost:3001";
export const IDIZER_WEB = "https://idizer.com";
export const IDIZER_EMBED = "https://idizer.com/embed/idizer-phone-field.js";
declare global {
interface Window {
IdizerPhoneField?: { init: () => void };
}
}
let embedLoad: Promise<void> | null = null;
export function loadIdizerPhoneEmbed(): Promise<void> {
if (typeof window === "undefined") return Promise.resolve();
if (window.IdizerPhoneField) return Promise.resolve();
if (!embedLoad) {
embedLoad = new Promise((resolve, reject) => {
const script = document.createElement("script");
script.src = IDIZER_EMBED;
script.async = true;
script.onload = () => resolve();
script.onerror = () =>
reject(new Error("Idizer phone field script failed to load"));
document.head.appendChild(script);
});
}
return embedLoad;
}"use client";
import { useEffect, useRef } from "react";
import { IDIZER_API, IDIZER_WEB, loadIdizerPhoneEmbed } from "@/lib/idizer-phone-embed";
export type IdizerPhoneStatusDetail = {
registered?: boolean;
idizerEmail?: string | null;
phoneE164?: string | null;
};
export type IdizerPhoneFieldProps = {
label?: string;
placeholder?: string;
allowRegister?: boolean;
onStatus?: (detail: IdizerPhoneStatusDetail) => void;
onRegistered?: (detail: { idizerEmail?: string }) => void;
};
export function IdizerPhoneField({
label = "Mobile number",
placeholder = "+44 7700 900123",
allowRegister = true,
onStatus,
onRegistered,
}: IdizerPhoneFieldProps) {
const rootRef = useRef<HTMLDivElement>(null);
const onStatusRef = useRef(onStatus);
const onRegisteredRef = useRef(onRegistered);
onStatusRef.current = onStatus;
onRegisteredRef.current = onRegistered;
useEffect(() => {
const mountEl = rootRef.current;
if (!mountEl) return;
let cancelled = false;
let detach: (() => void) | undefined;
void loadIdizerPhoneEmbed().then(() => {
if (cancelled || !rootRef.current) return;
const el = rootRef.current;
el.setAttribute("data-idizer-mounted", "0");
el.className = "idizer-phone-field";
el.setAttribute("data-api-origin", IDIZER_API);
el.setAttribute("data-web-origin", IDIZER_WEB);
el.setAttribute("data-label", label);
el.setAttribute("data-placeholder", placeholder);
if (!allowRegister) el.setAttribute("data-allow-register", "false");
el.textContent = "";
const onLookup = (e: Event) => {
onStatusRef.current?.(
(e as CustomEvent<IdizerPhoneStatusDetail>).detail,
);
};
const onCreated = (e: Event) => {
onRegisteredRef.current?.(
(e as CustomEvent<{ idizerEmail?: string }>).detail,
);
};
el.addEventListener("idizer-phone-status", onLookup);
el.addEventListener("idizer-phone-registered", onCreated);
window.IdizerPhoneField?.init();
detach = () => {
el.removeEventListener("idizer-phone-status", onLookup);
el.removeEventListener("idizer-phone-registered", onCreated);
};
});
return () => {
cancelled = true;
detach?.();
};
}, [label, placeholder, allowRegister]);
return <div ref={rootRef} className="idizer-phone-field" />;
}
// ─── src/pages/CheckoutForm.tsx ───
"use client";
import { useState } from "react";
import { IdizerPhoneField } from "@/components/IdizerPhoneField";
export function CheckoutForm() {
const [email, setEmail] = useState("");
return (
<form className="mx-auto max-w-md space-y-4 p-6">
<IdizerPhoneField
onStatus={(detail) => {
if (detail.registered && detail.idizerEmail) {
setEmail(detail.idizerEmail);
}
}}
onRegistered={(detail) => {
if (detail.idizerEmail) setEmail(detail.idizerEmail);
}}
/>
<label className="block text-sm font-medium">
Email
<input
type="email"
name="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
className="mt-1 w-full rounded-lg border border-zinc-300 px-3 py-2"
autoComplete="email"
/>
</label>
</form>
);
}Ensure your production origin is listed in Idizer API CORS_ORIGIN. For headless lookup only, call POST /auth/phone/lookup from your backend instead of the browser.
Events
idizer-phone-status— fired after each lookup.detail.registered,detail.idizerEmail.idizer-phone-registered— after SMS verify creates the mailbox. Use to prefill email or continue to SSO.
Tokens from SMS verify stay in the JSON response; do not expose them in your page unless you intend to call Idizer APIs directly. Prefer SSO for partner login.
Data attributes
| Attribute | Required | Description |
|---|---|---|
| data-api-origin | yes | Idizer API origin (same as SSO, e.g. https://idizer.com) |
| data-label | no | Accessible label for the input |
| data-placeholder | no | Placeholder text |
| data-default-country | no | Default calling code for masking: "380" (UA) or "40" (RO) |
| data-allow-register | no | Set to "false" for lookup only (disabled register icon) |
| data-value | no | Prefill the tel input and run lookup on mount |
| data-show-hint | no | Set to "true" to show the @idizer.com address under the field (default: tooltip on icon only) |
| data-web-origin | no | Idizer site origin for /idizer-logo-mark.png (default: embed script origin) |
| data-logo-url | no | Full logo URL (overrides data-web-origin; same asset as SSO button) |
| data-max-width | no | Override default compact width (300px), e.g. "100%" for full row |
API reference
POST /auth/phone/lookup
Content-Type: application/json
{ "phone": "447700900123" }
→ 200 { "registered": true, "idizerEmail": "[email protected]", "phoneE164": "+447700900123" }Lookups are rate-limited per IP. Only verified, non-blocked accounts count as registered: true.
CORS & captcha
Your site origin must be allowed by Idizer API CORS (CORS_ORIGIN in production). If Turnstile captcha is enabled on Idizer, SMS send from embed may require captcha — use lookup-only mode or direct users to idizer.com/login for registration when captcha blocks automated SMS.