API Reference
API Reference

Managing Webhook Endpoints

How to change the URL of a webhook endpoint and the events it receives, and how to do it without losing events or declining card transactions.

You manage your webhook endpoints yourself through the Webhooks API. An endpoint is an HTTPS URL plus the list of events it receives (subscriptionEvents). The available events are listed in Real-Time Integration.

Requests to the Webhooks API are authenticated the same way as the Cards API: send X-Key-Id and X-Signature as described in Accessing API.

🚧

Change endpoints carefully

Your webhook configuration is used for every event Altery sends you, including live card authorizations. A wrong URL, a missing event or an inactive endpoint takes effect for all of your cards within about a minute:

  • CardAuthorizationRequest is synchronous. If Altery cannot reach the endpoint, gets a non-2xx response, a response that is not a valid authorization answer, or no answer in time, the card transaction is declined.
  • Without a CardAuthorizationRequest subscription, transactions are approved without your decision. If no active endpoint is subscribed to CardAuthorizationRequest (the event was removed from subscriptionEvents or the endpoint is Inactive), Altery does not ask you and authorizes card transactions without your approval or decline.
  • Notifications stop. Events that are not in subscriptionEvents, or that would go to an Inactive endpoint, are not sent. Events missed this way are not resent after you fix the configuration; only events that happen after the fix are sent.
  • A URL that fails (wrong path, expired certificate, firewall) makes deliveries fail until it is fixed.

Make changes in a quiet period, follow the steps below, and keep the previous values so that you can restore them at once.

Before you change an endpoint

  1. Read the current configuration and save it, so that you can restore it:

    curl https://api.altery.com/v1/webhooks \
      -H "X-Key-Id: <your-key-id>" \
      -H "X-Signature: <signature>"
  2. Prepare the new URL before you point Altery at it:

    • it uses HTTPS and resolves to a public address;
    • it runs the same handler as the current one and verifies signatures as described in Webhook Security (the signing keys do not change when the URL changes);
    • for CardAuthorizationRequest, it answers within the time limit agreed with Altery.
  3. Keep the previous URL running for one more minute. Changes are saved at once and the API returns the new values immediately, but event delivery picks them up within about one minute. During that minute some events can still be sent to the previous URL, or according to the previous subscriptions. Do not switch off the previous URL until at least one minute after the change, otherwise those events fail.

Change the endpoint URL

Send only the field you change with PATCH. Fields you leave out keep their current values.

📘

The requests and responses on this page are examples. Replace <webhookId>, the URLs and the event lists with your own values; IDs and timestamps in the responses are illustrative.

Example request

curl -X PATCH https://api.altery.com/v1/webhooks/<webhookId> \
  -H "Content-Type: application/json" \
  -H "X-Key-Id: <your-key-id>" \
  -H "X-Signature: <signature>" \
  -d '{
    "endpoint": "https://hooks.example.com/altery/v2"
  }'

Example response 200 OK:

{
  "id": "c8f8dd9f-7f74-498b-8ea7-1fa9622e2255",
  "name": "Production webhooks",
  "endpoint": "https://hooks.example.com/altery/v2",
  "status": "Active",
  "subscriptionEvents": ["CardAuthorizationRequest", "CardTransactionApproved", "CardTransactionCleared"],
  "createdAt": "2026-09-01T10:00:00.000Z",
  "updatedAt": "2026-10-12T09:30:00.000Z",
  "createdBy": "API",
  "updatedBy": "API",
  "errorCode": 0,
  "errorMsgs": []
}

Altery checks the new URL when you save it. If the check fails, the endpoint keeps its previous URL and you get 400 Bad Request (see Validation errors).

Change the subscribed events

subscriptionEvents is always sent as the complete list. It replaces the stored list; it does not add to it. To add one event, read the endpoint, add the event to its current list and send the whole list back.

Example request: add CardTransactionRefunded to an endpoint that receives three events.

curl -X PATCH https://api.altery.com/v1/webhooks/<webhookId> \
  -H "Content-Type: application/json" \
  -H "X-Key-Id: <your-key-id>" \
  -H "X-Signature: <signature>" \
  -d '{
    "subscriptionEvents": [
      "CardAuthorizationRequest",
      "CardTransactionApproved",
      "CardTransactionCleared",
      "CardTransactionRefunded"
    ]
  }'
🚧

Sending ["CardTransactionRefunded"] alone would unsubscribe the endpoint from the other three events, including CardAuthorizationRequest.

Each event may appear only once in the list, ignoring case. A list such as ["CardIssued", "cardissued"] is rejected with 400 Bad Request.

Check the change with a test event

After every change, send a test event to the endpoint and check that your system received it and answered with 2xx.

Example request

curl -X POST https://api.altery.com/v1/webhooks/<webhookId>/test \
  -H "Content-Type: application/json" \
  -H "X-Key-Id: <your-key-id>" \
  -H "X-Signature: <signature>" \
  -d '{
    "payloadJson": "{\"message\":\"configuration check\"}"
  }'

Example response 200 OK, with the delivery status and your endpoint's answer:

{
  "deliveryResponse": {
    "deliveryId": "test#c8f8dd9f-7f74-498b-8ea7-1fa9622e2255#5b0d...",
    "deliveryStatus": "Succeeded",
    "deliveryResponse": {
      "body": "{\"received\":true}",
      "headers": { "content-type": "application/json" },
      "statusCode": 200
    }
  },
  "errorCode": 0,
  "errorMsgs": []
}

If deliveryStatus is not Succeeded, restore the previous configuration with the values you saved, then investigate.

Stop events to an endpoint

To stop all events to an endpoint without deleting it, set its status to Inactive.

Example request

curl -X PATCH https://api.altery.com/v1/webhooks/<webhookId> \
  -H "Content-Type: application/json" \
  -H "X-Key-Id: <your-key-id>" \
  -H "X-Signature: <signature>" \
  -d '{ "status": "Inactive" }'

Events are not queued while the endpoint is inactive: events that happen in that time are not sent later. If the endpoint receives CardAuthorizationRequest, card transactions are approved without your decision while it is inactive.

Validation errors

Changes are rejected with 400 Bad Request and nothing is saved. The reason is returned in errorMsgs.

Example response 400 Bad Request:

{
  "errorCode": -2,
  "errorMsgs": ["Only HTTPS webhook targets are allowed."]
}

The possible messages:

Error messageCause
Only HTTPS webhook targets are allowed.The URL does not use HTTPS.
Webhook endpoint must be an absolute HTTPS URI.The URL is relative or malformed.
Webhook endpoint must not contain user credentials.The URL contains user:password@.
Webhook host could not be resolved.The host name does not resolve in DNS.
Private-range webhook targets are not allowed. (and similar)The host resolves to a private, loopback or reserved address.
Subscription event '<event>' is listed more than once.The same event appears twice in subscriptionEvents.
Webhook status '<status>' is invalid.status is not Active or Inactive.

Checklist

  • Current configuration saved.
  • New URL deployed, reachable over HTTPS and verifying signatures.
  • subscriptionEvents sent as the complete list.
  • Test event delivered with Succeeded.
  • Previous URL kept running for at least one minute after the change, so that it still receives the events sent to it until delivery switches to the new URL.