Register for webhook events
POST /Hooks/v2/Registrations
Use this call to:
- Create a registration to webhook events
- Edit a webhook registration
- Restart a registration if it is suspended
Request URL |
---|
https:// .../Hooks/v2/Registrations |
Sample request in cURL - POST /Hooks/v2/Registrations
In the request below, hookName
shows the event registered as LoanStatusUpdated
curl --location --request POST 'https://lendingsandbox.crbcos.com/Hooks/v2/Registrations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <Token>' \
--data-raw '{
"id": null,
"applicationName": "Cos.Lending",
"hookName": "LoanStatusUpdated",
"hookCorrelationId": "Your 3 letter MPL ID",
"options": {
"hookType": "Web",
"httpMethod": "POST",
"uri": "Add your URL here, that is specific to this event type",
"headers": {
"headerName": [
"LoanStatusUpdated"
]
},
"authenticationOptions": {
"authenticationType": "None"
}
},
"suspended": false
}'
Webhook attributes
Attribute | Description |
---|---|
id | This field can be null or populated with the registration GUID for the registration. null - when creating a new registration |
applicationName | Should always be Cos.Lending |
hookName | The name of the hook you want to register for.
|
hookCorrelationId | 3-letter MPL ID. |
suspended | True or false. True if the registration should be suspended and not send webhooks. False if the registration should be active. If you edit a suspended registration, false will restart the registration. |
options | Select the relevant values for the fields below. |
options.hookType | Delivery method for the event (enum). Select from:
|
options.httpMethod | POST |
options.uri | The URL to receive webhook events. |
options.headers.headerName | Optional header name to add to the header. |
options.authenticationOptions | Authentication options for web hooks. Select from:
|
Sample response in JSON - POST /Hooks/v2/Registrations
Use the id received in the response to update or restart the registration.
{
"Version": "2.0",
"IsSuccessful": true,
"StatusCode": 200,
"Result": {
"id": "eb62ffbd-7ed4-4146-be48-7f2a46551c0e",
"applicationName": "cos.lending",
"hookName": "LoanStatusUpdated",
...
...
..
}
}
Webhooks without Authentication
"options": {
"hookType": "Web",
"httpMethod": "POST",
"uri": "Add your URL here, that is specific to this event type",
"headers": {
"headerName": [
"Any Header you want to add to all events"
]
},
"authenticationOptions": {
"authenticationType": "None"
}
}
Webhooks with Basic Authentication
"options": {
"hookType": "Web",
"httpMethod": "POST",
"uri": "Add your URL here, that is specific to this event type",
"headers": {
"headerName": [
"Any Header you want to add to all events"
]
},
"authenticationOptions": {
"authenticationType": "Basic",
"username": "yyy",
"password": "1234"
}
}
Webhooks with OIDC Authentication
OpenID Connect using your own authentication authority.
"options": {
"hookType": "Web",
"httpMethod": "POST",
"uri": "Add your URL here, that is specific to this event type",
"headers": {
"headerName": [
"headerValue"
]
},
"authenticationOptions": {
"authenticationType": "Oidc",
"authorityUrl": "",
"clientId": "",
"clientSecret": "",
"scope": ""
}
}
Testing webhook registration
To test registering webhooks, configure a URL for the specific event you are registering to. If a URL is not yet available, then you can use the webhook.site as a temporary test solution. Follow these instructions to test the webhooks.
To register your URL to receive webhook events:
- Go to https://webhook.site.
- Click New on the top menu.
The site returns Your unique URL. - Copy to clipboard your unique URL.
Note: If you already have other webhooks registered, the browser might automatically direct you to the URL you've used.


- Paste the copied URL, into the options.uri field of the JSON body.
- Send the Registration API call, with hook type "web", to register for webhooks.
The response field Result.id is the RegistrationId of the event. You can find the registration ID with the call,
GET Hooks/v2/Registrations
Repeat the process for each event that you want to register for.
Updated 11 days ago