Step 6: update a webhook

You can update a webhook's details at any point in time using the API.

In the previous example, you might have noticed that the authorizationHeader and sharedSecret were null. Let's add those in now, as well as update the webhook URL.

info

Regardless of which details you're updating, you'll need to include the enabled parameter in your request.

SandboxProduction
Copy
Copied
curl -i -X PATCH \
  'https://api-sandbox.equalsmoney.com/v2/webhooks/{webhookId}?accountId={accountId}' \
  -H 'Authorization: ApiKey {apiKey}' \
  -H 'Content-Type: application/json' \
  -d '{
    "sharedSecret": "{sharedSecret}",
    "url": "{webhookUrl}",
    "authorizationHeader": "{authorisationHeader}",
    "enabled": true
}'
Copy
Copied
curl -i -X PATCH \
  'https://api.equalsmoney.com/v2/webhooks/{webhookId}?accountId={accountId}' \
  -H 'Authorization: ApiKey {apiKey}' \
  -H 'Content-Type: application/json' \
  -d '{
    "sharedSecret": "{sharedSecret},
    "url": "{webhookUrl}",
    "authorizationHeader": "{authorisationHeader}",
    "enabled": true
}'

If your request is successful, you'll receive a 200 response containing the updated webhook details.

Copy
Copied
{
  "id": "542609c1-8bf9-46b1-830f-4b87d09d3cf1",
  "productId": "d926625b-5e11-4ec1-b4cd-0af2a8021efc",
  "accountId": "F12345",
  "webhookEventTypeId": "a4dcc403-41aa-4f2e-acf6-32dbaec78e72",
  "url": "https://webhook.site/18b086d3-4g0e-5063-9fb6-09ed799db8d",
  "enabled": true,
  "authorizationHeader": "Basic AXVubzpwQDU1dzByYM==",
  "sharedSecret": "123e4567-e89b-12d3-a456-426614174000",
  "createdAt": "2024-01-09T10:33:33.000Z",
  "updatedAt": "2024-01-09T10:44:31.153Z",
  "webhookEventTypeName": "AccountActivated"
}

Next