Prompt
How do I verify a user's identity before account creation with an API?
Latest observation
Oct 28, 2026
OpenAI APIWeb search: off
To verify a user’s identity before creating an account via an API, you typically add an identity verification step in your signup flow and only create the account after verification succeeds.
Common approach
-
Collect basic signup info
- Email / phone
- Legal name, date of birth, address
- Optional ID document info depending on your requirements
-
Create a “pending” signup record
- Store the user as
pending_verification - Do not activate the account yet
- Store the user as
-
Send a verification challenge
- Email verification link/code
- SMS OTP
- Government ID check
- Selfie/liveness check
- Knowledge-based or other identity checks if needed
-
Verify the response
- Your API receives the code/document/selfie
- Validate it server-side
- If using a third-party identity provider, call their verification API
-
Create the account only after success
- Mark the user as
verified - Issue auth tokens / activate account
- Reject or expire pending signups if verification fails
- Mark the user as
API design pattern
Example flow
POST /signup/start- Creates a pending verification session
- Returns a
verification_id
POST /signup/verify- Accepts OTP or verification result
- Confirms identity
POST /signup/complete- Creates the actual user account after verification passes
Example with email/phone OTP
1. Start signup
POST /signup/start
Content-Type: application/json
{
"email": "user@example.com",
"phone": "+15551234567",
"name": "Jane Doe"
}
Response:
{
"verification_id": "verif_123",
"status": "pending"
}
2. Verify code
POST /signup/verify
Content-Type: application/json
{
"verification_id": "verif_123",
"code": "482911"
}
Response:
{
"status": "verified"
}
3. Create account
POST /signup/complete
Content-Type: application/json
{
"verification_id": "verif_123",
"password": "StrongPassword123!"
}
Response:
{
"user_id": "user_456",
"status": "active"
}
If you need stronger identity verification
For regulated or higher-risk use cases, use a third-party identity verification service such as:
- Persona
- Stripe Identity
- Onfido
- Veriff
- Trulioo
Typical API pattern:
- Your backend creates a verification session with the provider
- User submits ID/selfie through the provider’s UI or SDK
- Provider sends a webhook to your backend with the result
- Your backend creates the account if the result is approved
Important security practices
- Verify on the server side, not the client
- Use short-lived codes/tokens
- Rate-limit verification attempts
- Expire pending verification sessions
- Store sensitive data encrypted at rest
- Minimize what you store unless legally required
- Use webhooks with signature verification if using third-party providers
Recommended model
If you want a clean architecture, use:
pending_verificationverifiedactiverejected
This prevents account creation until identity checks pass.
If you want, I can also show:
- a REST API design
- a Node.js/Express example
- a Python/FastAPI example
- or a flow using a third-party KYC provider