2. Create User Onboarding

Next, create a User Onboarding. For KYC, the party_type should be individual. When KYB functionality exists, there will be a business type.

There are optional fields for verified_email and verified_phone, where you can enter an email address or phone number that you have verified previously with the user. Phone numbers should include the country code (e.g. +1 for US-based phone numbers) and be formatted without spaces (e.g. +11234567890). This data will be compared against what the user enters and is a signal for the KYC checks.

You can also optionally prefill fields in the user onboarding flow using the data parameter. Individuals can still edit the fields. Please pay close attention to the format and names of the attributes, as other data will be ignored.

In order to automatically process the User Onboarding without any user interaction, provide prefilled data via the data field, and set the status field to processing.

curl --request POST \
  -u ORGANIZATION_ID:API_KEY \
  --url https://app.moderntreasury.com/api/user_onboardings \
  -H 'Content-Type: application/json' \
  -d '{
    "party_type": "individual"
  }'
curl --request POST \
  -u ORGANIZATION_ID:API_KEY \
  --url https://app.moderntreasury.com/api/user_onboardings \
  -H 'Content-Type: application/json' \
  -d '{
    "party_type": "individual",
    "verified_email": "[email protected]",
    "verified_phone": "+12223334444"
  }'
curl --request POST \
  -u ORGANIZATION_ID:API_KEY \
  --url https://app.moderntreasury.com/api/user_onboardings \
  -H 'Content-Type: application/json' \
  -d '{
     "party_type": "individual",
     "data": {
        "first_name": "Harry",
        "last_name": "Potter",
        "date_of_birth": "1990-01-02",
        "phone_number": "+11111111111",
        "email": "[email protected]",
        "address": {
          "line1": "Hogsmeade Ave",
          "line2": "",
          "locality": "San Francisco",
          "region": "CA",
          "postal_code": "94108",
          "country": "USA"
        },
        "taxpayer_identifier": "123456789",
        "external_account": {
          "account_details": [
            {
              "account_number": "1111111111",
              "account_number_type": "other"
            }
          ],
          "routing_details": [
            {
              "routing_number": "021000021",
              "routing_number_type": "aba"
            }
          ],
           "account_type": "checking"
        }
     }
  }'
curl --request POST \
  -u ORGANIZATION_ID:API_KEY \
  --url https://app.moderntreasury.com/api/user_onboardings \
  -H 'Content-Type: application/json' \
  -d '{
     "status":"processing",
     "party_type": "individual",
     "data": {
        "first_name": "Harry",
        "last_name": "Potter",
        "date_of_birth": "1990-01-02",
        "phone_number": "+11111111111",
        "email": "[email protected]",
        "address": {
          "line1": "Hogsmeade Ave",
          "line2": "",
          "locality": "San Francisco",
          "region": "CA",
          "postal_code": "94108",
          "country": "USA"
        },
        "taxpayer_identifier": "123456789",
        "external_account": {
          "account_details": [
            {
              "account_number": "1111111111",
              "account_number_type": "other"
            }
          ],
          "routing_details": [
            {
              "routing_number": "021000021",
              "routing_number_type": "aba"
            }
          ],
           "account_type": "checking"
        }
     }
  }'

This API request will return a User Onboarding object. The id is used in future steps.

{
  "id": "dacabe14-4b1b-4219-8226-02b3d247477d",
  "object": "user_onboarding",
  "live_mode": true,
  "metadata": {},
  "party_type": "individual",
  "status": "pending",
  "counterparty_id": null,
  "external_account_id": null,
  "decision_id": null,
  "created_at": "2022-05-24T02:45:08Z",
  "updated_at": "2022-05-24T02:45:08Z"
}

🚧

Warning

Be careful not to share your API key with your frontend, as it is private. Create User Onboarding objects in your backend only.

Next, we will guide you through embedding the flow. We have created a React component, as well as an example with pure Javascript.