This guide outlines the list of validation rules used in the Create a lead and Update significant persons endpoints. When any of the below validation rules are breached, the API returns a 422
response alongside a json body that contains information on the breached rule(s).
The error response when validation fails on any given property follows the structure below:
{
"PropertyNameThatFailedValidation": [
"message for first rule that failed",
"message for second rule that failed",
...
"message for n(th) rule that failed",
]
}
Good to know
In the example error messages in the table below, all messages for all the rules have been added (as if all rules were broken at once). When interacting with YouLend’s API, you will only receive the error messages for the actually broken rules
Create a lead validation
Property | Validation Rules | Error Message |
---|---|---|
ThirdPartyCustomerId | 1. Not Empty 2. Max length of 50 characters 3. Matches regex: ^[a-zA-Z0-9_.-]{1,50}$ | { "ThirdPartyCustomerId": [ "'Third Party Customer Id' must not be empty.", "The third party customer id is invalid." ] } |
CountryISOCode | 1. Not empty 2. See docs for allowed values | (The JSON value could not be converted to YL.Web.Api.ThirdParty.Onboarding.Models.CountryCodes. Path: $.countryISOCode | LineNumber: 4 | BytePositionInLine: 28.) |
LoanCurrencyISOCode | 1. One of "GBP", "EUR", "DKK", "PLN", "USD" 2. Not empty | { "LoanCurrencyISOCode": [ "'Loan Currency ISO Code' must not be empty.", "The loan currency code is invalid. It must be an ISO 4217 currency code. Valid codes are GBP, EUR and DKK" ] } |
KeyContactName | 1. Not empty 2. Max Length: 255 characters | { "KeyContactName": [ "'Key Contact Name' must not be empty." ] } |
Company Type | 1. Not empty 2. See docs for allowed values | { "$.companyType": [ "The JSON value could not be converted to YL.Web.Api.ThirdParty.Onboarding.Models.CompanyTypes. Path: $.companyType | LineNumber: 7 | BytePositionInLine: 26." ] } |
CompanyName | 1. Not empty 2. Minimum Length: 2 characters 3. Maximum Length: 255 characters 4. Allow alphanumeric and special characters (regex: ^[" + alphabetCharacters + "\d\s-`´“”‘’'",.@&?!£$€%+=()_:;#" + @"\/].$) | { "CompanyName": [ "'Company Name' must not be empty.", "The company name is invalid.", "The length of 'Company Name' must be at least 2 characters. You entered 1 characters.", "The length of 'Company Name' must be 255 characters or fewer. You entered 300 characters." ] } |
CompanyWebsite | 1. Maximum Length: 1000 characters 2. Match Regex: ^[a-zA-Z0-9:/-]{2,50}.[a-zA-Z0-9@:%_+.~#?&/=-].*$ | { "CompanyWebsite": [ "The company website is invalid.", "The length of 'Company Website' must be 1000 characters or fewer. You entered 1200 characters." ] } |
TradingName | 1. Minimum Length: 1 character 2. Maximum Length: 200 characters | { "TradingName": [ "The length of 'Trading Name' must be 200 characters or fewer. You entered 261 characters.", "The length of 'Trading Name' must be at least 1 characters. You entered 0 characters.", ] } |
CompanyNumber | 1. When CountryCode = IRL: Minimum length: 4 Maximum length: 10 Matches Regex: ^[a-zA-Z0-9].*$ 2. When CountryCode != IRL and != USA Minimum Length: 6 Maximum Length: 10 Matches Regex: ^[a-zA-Z0-9].*$ 3. When CountryCode == FRA Matches Regex: ^\d{9}$ | { "CompanyNumber": [ "The length of 'Company Number' must be at least 4 characters. You entered 3 characters.", "The length of 'Company Number' must be 10 characters or fewer. You entered 21 characters.", "The company number is invalid." ] } |
VatNumber | 1. Minimum Length: 6 2. Maximum Length: 14 3. Mtches Regex: ^[a-zA-Z0-9].*$ | { "VatNumber": [ "The length of 'Vat Number' must be at least 6 characters. You entered 3 characters.", "The length of 'Vat Number' must be 14 characters or fewer. You entered 261 characters.", "The vat number is invalid." ] } |
Mid | 1. Matches Regex: ^[a-zA-Z0-9]{7,}$ 2. MerchantIds property is not empty | { "Mid": [ "The mid is invalid. Acceptable MIDs must contain at least 7 alpha-numeric characters.", "You can only use one way of specifying MerchantIds." ] } |
MerchantIds | 1. Matches Regex: ^[a-zA-Z0-9]{7,}$ 2. Must be empty if Mid property is not empty and vice versa | { "MerchantIds": [ "You can only use one way of specifying MerchantIds.", "The mid is invalid. Acceptable MIDs must contain at least 7 alpha-numeric characters." ] } |
ContactPhoneNumber | 1. Minimum Length: 8 2. Maximum Length: 20 3. Matches Regex: ^[+0-9].*$ | { "ContactPhoneNumber": [ "The length of 'Contact Phone Number' must be 20 characters or fewer. You entered 49 characters.", "The company contact phone number is invalid." ] } |
ContactEmailAddress | 1. Maximum Length: 255 2. AspNetCoreCompatibleEmailValidator (check presence of one “@”) | { "ContactEmailAddress": [ "The length of 'Contact Email Address' must be 255 characters or fewer. You entered 540 characters.", "'Contact Email Address' is not a valid email address." ] } |
SignupClientIp | 1. If CountryISO Code == USA, must not be empty 2. Must be a valid IP address | { "SignupClientIp": [ "Signup Client Ip is invalid", “Signup Client Ip cannot be empty” ] } |
EmployerIdentificationNumber | 1. If CountryISO Code == USA and companyType != soleTrader, must not be empty 2. Matches Regex ^\d{2}-\d{7}$ | { "EmployerIdentificationNumber": [ "Employer Identification Number is invalid", “Employer Identification Number cannot be empty” ] } |
Update significant persons validation
Property | Validation Rules | Error Message |
---|---|---|
FirstName | 1. Not empty 2. Max length 255 3. Generic text | { "SignificantPersons[0].FirstName": [ "The length of 'First Name' must be 255 characters or fewer. You entered 1501 characters.", ] } |
Surname | 1. Not empty 2. Max length 255 3. Generic text | { "SignificantPersons[0].FirstName": [ "'First Name' must not be empty.", "The specified condition was not met for 'First Name'.", "The length of 'Surname' must be 255 characters or fewer. You entered 1501 characters." ] } |
TypeOfPerson | 1. Not empty 2. See docs for allowed values | { "$.significantPersons[0].typeOfPerson": [ "The JSON value could not be converted to YL.Web.Api.ThirdParty.Onboarding.Models.SignificantPersonTypes. Path: $.significantPersons[0].typeOfPerson | LineNumber: 5 | BytePositionInLine: 39." ] } |
DateOfBirth | 1. Validated to check that a person born on that date is >= 18 today | { "SignificantPersons[0].DateOfBirth.Year": [ "'Year' must be less than or equal to '2006'." ] } |
Line 1, City, AreaCode, Country | 1. Not empty 2. Max length 255 3. Generic text | { "SignificantPersons[0].Address.Line1": [ "'Line1' must not be empty.", "The length of 'Line 1' must be 255 characters or fewer. You entered 1501 characters." ] } |
Line2, Line3, Region | 1. Maximum Length: 255 | { "SignificantPersons[0].Address.Line2": [ "The length of 'Line 2' must be 255 characters or fewer. You entered 1501 characters." ] } |