Invia un codice di verifica

POST /fapi/v1/verifications · chiamato dall'host di accesso dell'ambiente

Invia un messaggio con un codice a 6 cifre e un link di verifica a uno degli indirizzi email non verificati dell'utente autenticato, e restituisce l'id del tentativo di codice. L'utente digita il codice con Inserisci un codice di verifica, oppure apre il link. Entrambi sono validi per 10 minuti. Un nuovo messaggio sostituisce la verifica aperta dell'indirizzo: il codice e il link di un messaggio precedente smettono di funzionare. Non è necessaria una nuova autenticazione, perché solo la casella di posta dell'indirizzo riceve il codice. Richiede il cookie __Host-idp_session dell'utente autenticato; se il cookie manca, è scaduto o è stato revocato, restituisce 401 unauthenticated. Un'app first-party su un altro origin può invece inviare il proprio token di accesso alla Front API (Authorization: DPoP <token> con una prova DPoP; vedi Token di accesso alla Front API).

Request

Headers:

Header Required Description
Idp-Client yes SDK identifier.
Origin yes Must be exactly https://<sign-in host>.
Content-Type yes application/json.

Body:

Field Type Required Description
email_id string (UUID) yes The address's id from List email addresses.

Response

202 Accepted:

Field Type Description
id string (UUID) The code attempt's id, used in the :attempt path. It is not a secret.
expires_at string (RFC 3339) When the code and link stop working.
{"id": "0190a5c4-1b2c-7d3e-8f40-5162738400ff", "expires_at": "2026-10-12T10:10:00Z"}

Errors

Status Code When
400 malformed_request The body is not valid JSON.
400 unknown_field The body has a field other than email_id.
401 unauthenticated No valid session cookie.
403 origin_not_allowed Origin is missing or wrong.
404 not_found email_id is not one of the user's addresses.
409 conflict The address is already verified.
413 payload_too_large The body is too large.
415 unsupported_media_type Content-Type is not application/json.
422 validation_failed email_id is missing.
429 verification_rate_limited 5 verification messages were sent to this address in the last hour, including the one sent when it was added; try again later.

Example

curl -X POST https://example.keenauth.app/fapi/v1/verifications \
  -H "Idp-Client: my-app/1.0.0 (node/22.0.0)" \
  -H "Origin: https://example.keenauth.app" \
  -H "Content-Type: application/json" \
  -b cookies.txt \
  -d '{"email_id": "0190a5c4-1b2c-7d3e-8f40-516273849abc"}'

Personal data

This endpoint carries personal data: end-user profile. Personal data in the KeenAuth APIs describes what is stored, how long it is kept and how it is deleted. Do not send special categories of personal data (health, biometric data, religion, political opinions, sexual orientation) in any field.