Skip to main content

Endpoint

PUT /hooks/:id
Updates an existing webhook’s configuration. You can modify the URL, timeout settings, or activate/deactivate the webhook.

Path Parameters

id
string
required
The unique identifier of the webhook to update

Request Body

name
string
A friendly name for the webhook
url
string
The HTTPS URL where webhook events will be sent
type
string
The type of webhook (PRE_TRANSACTION or POST_TRANSACTION)
active
boolean
Whether the webhook is active
timeout
integer
Timeout in seconds
retry_count
integer
Number of retry attempts

Response

id
string
Unique identifier for the webhook
name
string
The friendly name of the webhook
url
string
The webhook endpoint URL
type
string
The webhook type
active
boolean
Whether the webhook is currently active
timeout
integer
Timeout in seconds
retry_count
integer
Number of retry attempts
created_at
string
Timestamp when the webhook was created
last_run
string
Timestamp of the last execution
last_success
boolean
Whether the last execution was successful

Example Request

Update Webhook URL

curl -X PUT "https://api.blnk.io/hooks/hook_abc123def456" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://api.example.com/webhooks/new-endpoint"
  }'
{
  "url": "https://api.example.com/webhooks/new-endpoint"
}

Deactivate Webhook

{
  "active": false
}

Update Timeout and Retries

{
  "timeout": 15,
  "retry_count": 5
}

Complete Update

{
  "name": "Updated Fraud Detection",
  "url": "https://api.example.com/webhooks/fraud-check-v2",
  "active": true,
  "timeout": 8,
  "retry_count": 2
}

Example Response

{
  "id": "hook_abc123def456",
  "name": "Updated Fraud Detection",
  "url": "https://api.example.com/webhooks/fraud-check-v2",
  "type": "PRE_TRANSACTION",
  "active": true,
  "timeout": 8,
  "retry_count": 2,
  "created_at": "2024-03-04T12:00:00Z",
  "last_run": "2024-03-04T14:30:00Z",
  "last_success": true
}

Error Responses

error
string
Error message describing what went wrong

Common Errors

  • 400 Bad Request: Invalid request body or webhook data
  • 404 Not Found: Webhook with the specified ID not found
  • 500 Internal Server Error: Failed to update webhook

Partial Updates

You only need to include the fields you want to update. Other fields will remain unchanged:
{
  "timeout": 20
}
This will update only the timeout, leaving all other fields as they were.

Use Cases

Temporarily Disable Webhook

Disable a webhook during maintenance:
{
  "active": false
}
Re-enable when ready:
{
  "active": true
}

Update Endpoint URL

Migrate to a new endpoint:
{
  "url": "https://new-api.example.com/webhooks/endpoint"
}

Adjust Performance Settings

Increase timeout for slow endpoints:
{
  "timeout": 30,
  "retry_count": 5
}

Rename for Clarity

{
  "name": "Production Fraud Detection - US Region"
}

Best Practices

  1. Test before activating: Update the URL, test it manually, then set active: true
  2. Gradual rollout: Update one webhook at a time
  3. Monitor after changes: Watch last_success after updating
  4. Document changes: Keep track of why and when webhooks were modified
  5. Version your endpoints: Use versioned URLs for easier rollback

Webhook Versioning Strategy

// Old webhook
{
  "name": "Fraud Detection v1",
  "url": "https://api.example.com/webhooks/v1/fraud",
  "active": false
}

// New webhook (after testing)
{
  "name": "Fraud Detection v2",
  "url": "https://api.example.com/webhooks/v2/fraud",
  "active": true
}

Validation

Blnk validates the following when updating:
  • URL must be valid HTTPS (HTTP not allowed in production)
  • Timeout must be between 1 and 300 seconds
  • Retry count must be between 0 and 10
  • Type cannot be changed (create a new webhook instead)

Build docs developers (and LLMs) love