Self-Serve Testing
Use YouLend's staging test-support endpoints to move a test lead through the full funding lifecycle, including offer creation, signing, loan creation, funding, and state verification.
Use YouLend's staging test-support endpoints to move a test lead through offer creation, signing, loan creation, and funding without waiting for manual operational steps.
These endpoints are for staging and partner testing only. Use them to validate your integration flow before production, not to process live merchants or live funding agreements.
Overview
The self-serve testing flow follows the same core lifecycle as an Onboarding API integration, with additional Test Support API calls that let you create deterministic test offers and progress the loan state.
Create a lead through the Onboarding API and submit it to stage 1.
Create a fixed test offer, then accept it through the Onboarding API.
Retrieve the documents that need signing and create a document-signing request.
Complete test checks, prepare the loan, and create the loan record.
Fund the latest loan for the lead using the Test Support API.
API areas
Two API areas are used in this flow:
| API area | Used for |
|---|---|
| Onboarding API | Creating the lead, submitting stage 1, accepting the offer, retrieving documents, approving funding |
| Test Support API | Creating fixed offers, creating signing requests, preparing/creating/funding loans, checking journey state |
YouLend's implementation team will confirm the staging base URLs and make sure your credentials are enabled for both API areas. Test Support API access will need to be enabled separately from standard Onboarding API access.
Authentication and environments
Authenticate with YouLend's APIs using the Client Credentials flow from OAuth 2.0. See Authentication for token URLs, audience URLs, request examples, and bearer-token usage.
For self-serve testing, use the Test Support audience URL when requesting an access token for Test Support API endpoints.
The endpoint paths in this guide are relative to the relevant staging base URL:
- Onboarding API paths should be called against the Onboarding API base URL.
- Test Support API paths should be called against the Test Support API base URL.
Required IDs
Store each ID returned during the flow. Later steps depend on these values.
| ID | Where it comes from | Where it is used |
|---|---|---|
leadId | Create Lead response | Every later step |
offerId | Fixed offer response | Offer acceptance |
documentSigningId | Signing request response | Optional signing-status checks |
loanId | Create loan response | Loan reference and verification |
Happy path
Create the lead using the Onboarding API. Then complete the usual lead setup steps required by your integration, such as significant persons, bank statements, and account information.
When the lead is ready, submit it to stage 1. No request body is required.
Use the Test Support API to create one or more fixed offers for the lead.
Example request:
{
"offers": [
{
"youWillGet": 10000.0,
"youWillRepay": 12000.0,
"currencyISOCode": "GBP",
"sweep": 15.0,
"daysUntilRepayment": 180,
"minimumWeeklyRepayment": 250.0,
"maturityDate": "2026-10-01T00:00:00Z"
}
]
}Use the returned offers[].offerId in the next step.
Accept the selected offer using the Onboarding API. No request body is required.
Example 200 response — accept offer
{
"eligibleForInstantSigning": true
}This response confirms whether the lead is eligible for instant signing. It does not return the documents.
Retrieve the unsigned documents using the Onboarding API. You will use the document id and name values when creating the signing request.
Use the Test Support API to create a signing request.
Example request:
{
"documentsToSign": [
{
"document": {
"documentId": "11111111-1111-1111-1111-111111111111",
"documentName": "Receivables Purchase Agreement.pdf"
},
"documentType": "loanDocument"
}
]
}Supported documentType values:
| Document type | Use when |
|---|---|
loanDocument | Main loan or receivables purchase agreement |
directDebitMandateDocument | Direct debit mandate |
changeOfBankDocument | Change of bank document |
additionalLoanDocument | Additional loan document |
aol | Account opening letter |
Example 200 response — create signing request
{
"documentSigningId": "22222222-2222-2222-2222-222222222222"
}You can inspect the signing object through the Onboarding API with Retrieve document signing information.
Use the Test Support API to complete checks and prepare the loan. No request body is required.
This step completes the required test checks and prepares the loan prerequisites. If something is missing, the response will explain the missing prerequisite, such as borrower account details, lender selection, or suggested-loan readiness.
Use the Test Support API to create the loan. No request body is required.
Example 200 response — create loan
{
"loanId": "33333333-3333-3333-3333-333333333333",
"loanNumber": 123456,
"status": "Unfunded",
"leadId": "44444444-4444-4444-4444-444444444444",
"sourceOfferId": "55555555-5555-5555-5555-555555555555"
}Use the Test Support API to fund the latest loan for the lead. No request body is required.
Example 200 response — fund loan
{
"leadId": "44444444-4444-4444-4444-444444444444",
"loanId": "33333333-3333-3333-3333-333333333333"
}Optional: Test non-happy-path states
Use these endpoints when testing non-happy-path scenarios, such as rejected leads, pending checks, credit-risk pushbacks, or loan lifecycle events.
Update lead status
Use Update lead status.
Allowed status values:
RescindedIneligibleStage1RejectedOffersExpired
Example request:
{
"status": "Ineligible",
"reasons": [
{
"reasonCode": "EL017",
"additionalInfo": "No longer progressing this lead"
}
]
}Create or resolve a credit-risk pushback
Create a pushback with Create credit-risk pushback:
{
"reasonCode": "PB001",
"note": "Please provide proof of ID."
}Resolve a pushback with Delete credit-risk pushback. No request body is required.
Common issues
| Issue | What to check |
|---|---|
| You cannot create a fixed offer | Confirm the lead has been submitted to stage 1 |
| Offer acceptance fails | Confirm you are using the offerId returned by the fixed offer response |
| Signing request fails validation | Confirm documentsToSign is not empty and each item has a valid documentType |
| Loan prepare fails | Leave about 25-30 seconds between requests and it should go through without an error. |
| Loan create fails | Confirm the offer has been accepted and loan/prepare has completed |
| Test Support calls return unauthorized | Confirm your staging credentials are enabled for the Test Support API |
Notes
- Use these endpoints only in staging/test environments.
- Store the returned IDs from each step; later steps depend on them.
- Most lifecycle endpoints do not require a request body.
Updated about 22 hours ago