Skip to main content

KYC Prefill Flow

The prefill flow allows users to automatically populate their KYC information using their phone number. This significantly reduces manual data entry and improves the user experience.

How It Works

  1. User provides their phone number and date of birth
  2. System sends an OTP (One-Time Password) to the phone
  3. User enters the OTP to verify phone ownership
  4. System returns prefilled user data (name, address, SSN last 4, etc.)
  5. User reviews and submits for verification via /v1/kyc/start

Step 1: Start Prefill

Initiate the prefill process with the user’s phone number and date of birth.

Request

POST /v1/kyc/prefill
{
  "phoneNumber": "+15551234567",
  "dateOfBirth": "1990-01-15",
  "userId": "user_123",
  "sessionToken": "session_abc",
  "ipAddress": "192.168.1.1"
}

Request Fields

FieldTypeRequiredDescription
phoneNumberstringYesUser’s phone number with country code
dateOfBirthstringYesDate of birth (YYYY-MM-DD format)
userIdstringYesYour internal user identifier
sessionTokenstringYesSession token for the request
ipAddressstringNoUser’s IP address for fraud detection

Response

{
  "status": {
    "decision": "pending",
    "status": "otp_sent",
    "subStatus": "",
    "externalId": "ext_abc123"
  },
  "externalId": "ext_abc123"
}

Step 2: Submit OTP

After the user receives the OTP on their phone, submit it for verification.

Request

POST /v1/kyc/prefill/otp
{
  "otp": "123456",
  "externalId": "ext_abc123"
}

Request Fields

FieldTypeRequiredDescription
otpstringYesThe 6-digit OTP received by the user
externalIdstringYesExternal ID from the prefill response

Response

On successful OTP verification, the response includes prefilled user data:
{
  "status": {
    "decision": "pending",
    "status": "prefill_complete",
    "subStatus": "",
    "externalId": "ext_abc123"
  },
  "firstName": "John",
  "middleName": "Michael",
  "lastName": "Doe",
  "dateOfBirth": "1990-01-15",
  "phoneNumber": "+15551234567",
  "email": "john.doe@example.com",
  "ssn": "1234",
  "address": {
    "addressLine1": "123 Main Street",
    "addressLine2": "Apt 4B",
    "city": "New York",
    "state": "NY",
    "postalCode": "10001",
    "country": "US"
  }
}

Prefill Response Fields

FieldTypeDescription
firstNamestringUser’s first name
middleNamestringUser’s middle name (if available)
lastNamestringUser’s last name
dateOfBirthstringDate of birth
phoneNumberstringVerified phone number
emailstringEmail address (if available)
ssnstringLast 4 digits of SSN
addressobjectAddress information
All fields except status are optional and may be null if data is not available from the prefill provider.

Step 3: Submit to KYC Verification

After receiving prefill data, use it to start the full verification process. The prefill response fields map directly to the /v1/kyc/start request.

Mapping Prefill Data to Verification Request

{
  "userId": "user_123",
  "firstName": "John",
  "middleName": "Michael",
  "lastName": "Doe",
  "email": "john.doe@example.com",
  "phoneNumber": "+15551234567",
  "dateOfBirth": "1990-01-15",
  "ssn": "123-45-6789",
  "address": {
    "addressLine1": "123 Main Street",
    "addressLine2": "Apt 4B",
    "city": "New York",
    "state": "NY",
    "postalCode": "10001",
    "country": "US"
  },
  "sessionToken": "session_abc",
  "agreementTime": "2024-01-15T10:30:00Z",
  "ipAddress": "192.168.1.1"
}
The prefill response returns only the last 4 digits of SSN. You must collect the full SSN from the user before submitting to /v1/kyc/start.

Field Mapping

Prefill ResponseVerification RequestNotes
firstNamefirstNameDirect mapping
middleNamemiddleNameDirect mapping
lastNamelastNameDirect mapping
emailemailDirect mapping, allow user to edit
phoneNumberphoneNumberDirect mapping
dateOfBirthdateOfBirthDirect mapping
ssn (last 4)ssn (full)Collect full SSN from user
addressaddressDirect mapping
-agreementTimeCapture when user accepts terms
-referralCodeOptional, if applicable
See Verification Flow for complete details on the verification request and response.

Complete Integration Flow

Error Handling

Common Errors

ErrorDescriptionResolution
Invalid phone numberPhone number format is incorrectUse E.164 format (+1XXXXXXXXXX)
OTP expiredOTP has expired (usually 10 minutes)Restart the prefill flow
OTP invalidIncorrect OTP enteredUser should re-enter or request new OTP
Prefill not availableNo data found for this phone/DOBProceed with manual verification

Retry Logic

If OTP verification fails:
  1. Allow user to retry entering OTP (up to 3 attempts)
  2. After 3 failed attempts, require new OTP request
  3. Rate limit OTP requests to prevent abuse

Sandbox Testing

For testing in the sandbox environment, use these Socure test values:

Prefill Match Test Data

FieldValueDescription
dateOfBirth1985-03-30Sandbox DOB that returns prefill data
phoneNumber14155551212Sandbox phone that matches prefill

No Prefill Match Test Data

FieldValueDescription
dateOfBirth1985-03-30Same DOB
phoneNumber12067890036Phone that has no prefill data

OTP Codes

CodeResult
123456Success - returns prefilled data
00000 (5 zeros)Reject - OTP verification fails
000000 (6 zeros)Pending - verification remains pending

Best Practices

  1. Validate phone format before sending to API (E.164 format)
  2. Display countdown timer for OTP expiration (typically 10 minutes)
  3. Allow users to skip prefill and enter data manually
  4. Pre-populate form fields with prefill data but allow editing
  5. Handle null fields gracefully - not all data may be available
  6. Collect full SSN from user since prefill only returns last 4 digits
  7. Track agreementTime when user accepts terms, before calling /v1/kyc/start