Webhooks

Create webhook subscriptions and receive YouLend event notifications.

Use webhooks to receive YouLend event notifications when a lead or agreement changes state.

A webhook is an HTTPS endpoint that you host. After you create a webhook subscription through the YouLend Notification API, YouLend sends a POST request to your endpoint whenever a subscribed event occurs.

Webhooks can notify you about changes throughout the application process, from applications being created and signed to agreements being funded and fully repaid. For help triggering events in the staging environment, contact your account or implementation manager.

📘

Good to know

You can create multiple webhook subscriptions if you do not want to use the same endpoint for every event. Events are sent to the endpoint configured for the corresponding subscription.

Recommended event codes

Creating a webhook

Create a subscription through the YouLend Notification API to connect your endpoint to specific event codes.

  1. Host an HTTPS endpoint that can receive POST requests.
  2. Choose the event codes you want to subscribe to.
  3. Send your endpoint URL and event-code list to the webhook subscription endpoint.

Whenever one of the subscribed events occurs, YouLend sends a webhook notification to your endpoint.

Example request to create a subscription

curl -X POST 'https://partners.staging-youlendapi.com/notification/webhooksubscription' \
      -H 'authorization: Bearer ACCESS_TOKEN' \
      -H 'Content-Type: application/json' \
      -d '{
           "eventCodes": ["ONB10001","ONB10002","ONB10003","ONB10004","LOA10013"],
           "webhookUrl": "https://your_url.com"
          }'
EnvironmentURL
EU (staging)https://partners.staging-youlendapi.com/notification/webhooksubscription
EU (production)https://youlendapi.com/notification/webhooksubscription
USA (staging)https://uspartners.staging-youlendapi.com/notification/webhooksubscription
USA (production)https://youlendapi.us/notification/webhooksubscription

After you create the subscription, YouLend sends a notification to the provided URL when any subscribed event occurs. For help triggering events in the test environment, contact your account manager.

Example notification payload

YouLend sends notifications to your endpoint as JSON payloads. The example below shows an ONB10011 event for an offer being provided.

{
    "EventCode": "ONB10011",
    "Message": "Offers Provided",
    "EventProperties": {
        "LeadId": "f3c23809-9850-4546-bd08-650068aa55f6",
          "Offers": [
              {
                "OfferId": "d08292ef-b034-4b64-a4c6-ad2babd46dbd",
                "YouWillGet": "1000.0",
                "YouWillRepay": "1200.0",
                "CurrencyISOCode": "GBP",
                "Sweep": "20.0"
              }
           ]
     }
}
⚠️

Important

Your endpoint must return a 2xx status code in a timely manner so YouLend knows the notification was received. If YouLend does not receive a 2xx response within 100 seconds, YouLend retries the request 2 more times over a period of 2 minutes.

Verify webhook requests

The create subscription response includes a secret key that is unique to each subscription. Use this secret key to verify that webhook requests are coming from YouLend. For verification details, see Webhooks verification.


Did this page help you?