Setting Up Webhook
Description
This endpoint allows you to configure a webhook to receive notifications for certain events.
POST {baseUrl}/api/v1/configure/configure-webhook
Content-Type: application/json
Authorization: Basic base64encode({clientId:clientSecret})
{
"endpoint_id": "KHUID00001234",
"webhook_url": "https://example.com/webhook"
}Method
POST
Headers
- Content-Type:
application/json - Authorization:
Basic base64encode({clientId:clientSecret})- The
clientId:clientSecretshould be base64 encoded.
- The
Payload
| Key | Required | Type | Description |
|---|---|---|---|
endpoint_id | No | String | The main identifier of this entity (CamInvoice ID). If no endpoint_id is provided, modification will be applied to all |
webhook_url | Yes | String | The URL to which notifications will be sent. |
Success Response
HTTP status code: 200
| Key | Definition |
|---|---|
message | "successful" – Indicates successful setup. |
Error Response
HTTP status code: 401
| Key | Definition |
|---|---|
error | The error code indicating the nature of the failure. |
error_description | "Invalid client credentials" – Typically shown when authentication details are wrong. |
Example Usage
Here’s how you can use curl to set up the webhook:
curl -X POST "{baseUrl}/api/v1/configure/configure-webhook" \
-H "Content-Type: application/json" \
-H "Authorization: Basic $(echo -n '{clientId}:{clientSecret}' | base64)" \
-d '{
"endpoint_id": "KHUID00001234",
"webhook_url": "https://example.com/webhook"
}'Notes
- Ensure that the
webhook_urlis accessible from the server sending the webhook. - The provided
endpoint_idshould correspond to a valid module configuration.