Skip to main content

Overview

The WebhooksAPI provides methods to register, list, and manage webhook endpoints that receive real-time notifications about account events. All webhook operations are accessed through the client.webhooks property.

Methods

list()

List all registered webhooks for your account.
Parameters:
  • account_id: The unique account identifier
Returns: list[Webhook] - List of webhook objects Example:

create()

Register a new webhook endpoint.
Parameters:
  • account_id: The account to monitor
  • url: The webhook endpoint URL (must be HTTPS)
Returns: Webhook - The created webhook object Example:

delete()

Remove a registered webhook.
Parameters:
  • webhook_id: The unique webhook identifier
Returns: dict - Deletion confirmation Example:

Webhook Processing Utilities

Monzoh provides built-in utilities to parse and validate incoming webhook payloads with type safety.

Core Functions

parse_webhook_payload()

Parse and validate any incoming webhook payload:
Parameters:
  • body: Raw request body (string or bytes)
Returns: Parsed webhook payload with validated data Raises:
  • WebhookParseError: If payload parsing or validation fails

parse_transaction_webhook()

Convenience function for transaction-specific webhooks:

Webhook Event Handling

Setting up a Complete Webhook Server

Here’s a complete example using the webhook utilities:

Webhook Registration Helper

Create a helper script to register webhooks:

Testing Webhooks

Test your webhook endpoint before registering:

Webhook Security

Rate Limiting

Implement rate limiting to prevent abuse:

Best Practices

  1. Use HTTPS: Webhook URLs must use HTTPS in production
  2. Handle idempotency: Process duplicate events gracefully
  3. Respond quickly: Return 200 status code within 10 seconds
  4. Log events: Maintain logs for debugging and monitoring
  5. Implement retries: Handle temporary failures with retry logic
  6. Rate limiting: Protect your endpoint from excessive requests
The Webhooks API enables real-time monitoring and automated responses to account events, making it possible to build responsive financial applications and automated workflows.