Webhooks

View All Subscribed Webhooks

Users can retrieve a list of all webhooks they are subscribed to, along with relevent subscription details. To retrieve a list of webhooks, initiate a GET request directed at the following endpoint:

https://cubi-sandbox-api.customersbank.com/webhooks/v1/

This request requires the additional data to be included in the query of the request.

Query Parameter Data Element Details:

NameTypeDescription
paginateResultsbooleanindicates whether the request should be paginated
pageint32indicates the page to return
perPageint32indicates how many items are on a pages
sortOnstringindicates the attribute by which the data is sorted (you can sort by any field included in the response)
sortAscendingbooleanindicates if the data is sorted in ascending or descending order

Example Request:

GET //webhooks/v1?paginateResults=false HTTP/1.1
Host: cubi-sandbox-api.customersbank.com
Authorization: Bearer *****

A successful request will generate a response of 200 – Ok.

Example Response:

Response Data Element Details:

NameTypeDescription
eventTypeNamestring
callbackUrluri
secretTextstring
descriptionstring
idstring
modificationDatedate-time
creationDatedate-time
isActiveboolean

Error Handling:
Common errors will include:
400 – Bad Request
401 – Unauthorized
403 – Forbidden
404 – Not Found
422 – Unprocessable Content

For guidance on troubleshooting error codes please consult the Error Code Handling section of this guide.


View a Specific Subscribed Webhook

Similar to the prior request, a user can obtain the same level of information for a specific webhook if they know the Id of that webhook. To get information for a specific webhook, initiate a GET request directed to the following endpoint:

https://cubi-sandbox-api.customersbank.com/webhooks/v1/{id}

This request requires the additional data to be included in the path of the request.

Path Parameter Data Element Details:

NameTypeDescription
idstringwebhook id

Example Request:

A successful request will generate a response of 200 – Ok.

Example Response:

Response Data Element Details:

NameTypeDescription
eventTypeNamestring
callbackUrluri
secretTextstring
descriptionstring
idstring
modificationDatedate-time
creationDatedate-time
isActiveboolean

Error Handling:
Common errors will include:
400 – Bad Request
401 – Unauthorized
403 – Forbidden
404 – Not Found
422 – Unprocessable Content

For guidance on troubleshooting error codes please consult the Error Code Handling section of this guide.


Subscribe to Webhook

Users need to subscribe to a webhook to receive notifications about the events they are interested in. To subscribe to a webhook, initiate a POST request directed at the following endpoint:

https://cubi-sandbox-api.customersbank.com/webhooks/v1/

This request requires the additional data to be included in the body of the request.

Body Parameter Data Element Details:

NameTypeDescription
eventTypeNamestring
callbackUrluri
secretTextstring
descriptionstring

Example Request:

POST /webhooks/v1/ HTTP/1.1
X-Idempotency-Key: 628bab13-6177-4ba5-b604-2fc8b9a0178f
Authorization: Bearer ******
Host: cubi-sandbox-api.customersbank.com

{
    "eventTypeName":"transfers.book-completed",
    "callbackUrl":"https://mydomain.com/api/cubix/webhooks",
    "secretText":"mysecret",
    "description":"Transfers completed"
}

A successful request will generate a response of 201 – Created.

Example Response

Error Handling:
Common errors will include:
400 – Bad Request
401 – Unauthorized
403 – Forbidden
422 – Unprocessable Content

For guidance on troubleshooting error codes please consult the Error Code Handling section of this guide.


View Webhook History

A user has the ability to view details for all webhook callbacks for a specific webhook they are subscribed to. To view all webhook callbacks, initiate a GET request directed to the following endpoint:

https://cubi-sandbox-api.customersbank.com/webhooks/v1/{id}/event-history

This request requires the additional data to be included in the path and the query of the request.

Path Parameter Data Element Details:

NameTypeDescription
idstringFormant - uuid

Query Parameter Data Element Details:

NameTypeDescription
paginateResultsbooleanindicates whether the request should be paginated
pageint32indicates the page to return
perPageint32indicates how many items are on a pages
sortOnstringindicates the attribute by which the data is sorted (you can sort by any field included in the response)
sortAscendingbooleanindicates if the data is sorted in ascending or descending order

Example Request:

A successful request will generate a response of 200 - Ok.

Example Response:

Response Data Element Details:

NameTypeDescription
idstring
accountIdstring
eventTypeNamestring | null
callbackUrluri
statusTextstring | null
jsonPayloadTextstring | null
attemptDatedate-time

Error Handling:
Common errors will include:
400 – Bad Request
401 – Unauthorized
403 – Forbidden
404 – Not Found
422 – Unprocessable Content

For guidance on troubleshooting error codes please consult the Error Code Handling section of this guide.


/{subscriptionId}/event-history/{id}/replay - POST

need definition for this endpoint

https://cubi-sandbox-api.customersbank.com/webhooks/v1/{subscriptionId}/event-history/{id}/replay

This request requires the additional data to be included in the path of the request.

Path Parameter Data Element Details:

NameTypeDescription
idstring
subscriptionIdstring

Example Request:

A successful request will generate a response of 201 - Created.

Example Response:

Error Handling:
Common errors will include:
400 – Bad Request
401 – Unauthorized
403 – Forbidden
422 – Unprocessable Content

For guidance on troubleshooting error codes please consult the Error Code Handling section of this guide.


Modify Existing Webhook

After subscribing to a webhook, users can update the callback URL or the description of the webhook. To modify an existing webhook, initiate a PUT request directed at the following endpoint:

https://cubi-sandbox-api.customersbank.com/webhooks/v1/{id}

This request requires the additional data to be included in the path and the body of the request.

Path Parameter Data Element Details:

NameTypeDescription
idstring

Body Parameter Data Element Details:

NameTypeDescription
accountIdstring | null
callbackUrluri | null
descriptionstring | null

Example Request:

A successful request will generate a response of 200 - Ok.

Example Response:

Response Data Element Details:

NameTypeDescription
eventTypeNamestring
callbackUrluri
secretTextstring
descriptionstring

Error Handling:
Common errors will include:
400 – Bad Request
401 – Unauthorized
403 – Forbidden
404 – Not Found
422 – Unprocessable Content

For guidance on troubleshooting error codes please consult the Error Code Handling section of this guide.


Delete Webhook

If a user decides a webhook is no longer needed and wants to stop receiving it permanently, they can delete the webhook subscription. To delete a webhook subscription, initiate a DELETE request directed at the following endpoint:

https://cubi-sandbox-api.customersbank.com/webhooks/v1/{id}

This request requires the additional data to be included in the path and the body of the request.

Path Parameter Data Element Details:

NameTypeDescription
idstring

Example Request:

A successful request will generate a response of 200 - Ok.

Example Response:

Error Handling:
Common errors will include:
400 – Bad Request
401 – Unauthorized
403 – Forbidden
404 – Not Found
422 – Unprocessable Content

For guidance on troubleshooting error codes please consult the Error Code Handling section of this guide.


Disable Webhook

If a user wants to temporarily stop receiving a webhook callback for a specific webhook, they can disable the webhook. Unlike deleting it, disabling awebhook allows the user to enable it again later. To disable a webhook, initiate a POST request directed at the following endpoint:

https://cubi-sandbox-api.customersbank.com/webhooks/v1/{id}/disable

This request requires the additional data to be included in the path and the body of the request.

Path Parameter Data Element Details:

NameTypeDescription
idstring

Example Request:

A successful request will generate a response of 200 - Ok.

Example Response:

Error Handling:
Common errors will include:
400 – Bad Request
401 – Unauthorized
403 – Forbidden
422 – Unprocessable Content

For guidance on troubleshooting error codes please consult the Error Code Handling section of this guide.


Enable Webhook

If a user has previously disabled a webhook they can re-enable it at any time. To enable a previously disabled webhook, initiate a POST request directed at the following endpoint:

https://cubi-sandbox-api.customersbank.com/webhooks/v1/{id}/enable

This request requires the additional data to be included in the path and the body of the request.

Path Parameter Data Element Details:

NameTypeDescription
idstring

Example Request:

A successful request will generate a response of 200 - Ok.

Example Response:

Error Handling:
Common errors will include:
400 – Bad Request
401 – Unauthorized
403 – Forbidden
422 – Unprocessable Content

For guidance on troubleshooting error codes please consult the Error Code Handling section of this guide.