Skip to main content
POST
/
webhooks
/
{id}
/
reset-circuit
Reset Circuit Breaker
curl --request POST \
  --url https://api.example.com/webhooks/{id}/reset-circuit \
  --header 'Authorization: <authorization>'
{
  "consecutiveFailures": 123,
  "circuitOpenedAt": "<string>",
  "isActive": true
}
Resets the circuit breaker for a webhook that was automatically disabled due to consecutive failures.

Overview

When a webhook experiences too many consecutive delivery failures, the circuit breaker automatically opens to prevent further attempts. This endpoint allows you to reset the circuit breaker and re-enable the webhook after you’ve fixed the underlying issue.

Authentication

Authorization
string
required
Bearer token with write:webhooks scope

Path Parameters

id
string
required
The webhook configuration ID (UUID v4)

Response

Returns the updated webhook configuration with reset circuit breaker state.
consecutiveFailures
number
Reset to 0
circuitOpenedAt
string
Reset to null
isActive
boolean
Re-enabled (true)

Example Request

curl -X POST https://api.instaview.sk/webhooks/550e8400-e29b-41d4-a716-446655440000/reset-circuit \
  -H "Authorization: Bearer sk_your_key_here"

Example Response

{
  "success": true,
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "apiKeyId": "api-key-uuid",
    "url": "https://api.example.com/webhooks/instaview",
    "name": "Production Webhook",
    "description": "Receives interview completion notifications",
    "headers": [
      { "name": "Authorization", "isMasked": true }
    ],
    "events": ["interview.completed", "analysis.completed"],
    "isActive": true,
    "maxRetries": 3,
    "timeoutMs": 30000,
    "consecutiveFailures": 0,
    "circuitOpenedAt": null,
    "createdAt": "2024-01-15T10:30:00Z",
    "updatedAt": "2024-01-16T09:00:00Z"
  }
}

Circuit Breaker Workflow

1

Identify Problem

Check consecutiveFailures and circuitOpenedAt to confirm circuit is open
2

Fix Issue

Resolve the underlying problem (endpoint availability, authentication, etc.)
3

Test Endpoint

Use the test endpoint to verify connectivity
4

Reset Circuit

Call this endpoint to re-enable the webhook
5

Monitor

Watch for new failures after reset
async function safeResetCircuit(webhookId) {
  // 1. Check current state
  const { data: webhook } = await getWebhook(webhookId);
  
  if (!webhook.circuitOpenedAt) {
    console.log('Circuit is not open, no reset needed');
    return webhook;
  }
  
  console.log(`Circuit has been open since: ${webhook.circuitOpenedAt}`);
  console.log(`Consecutive failures: ${webhook.consecutiveFailures}`);
  
  // 2. Ensure webhook has ping event for testing
  if (!webhook.events.includes('ping')) {
    console.log('Adding ping event for testing...');
    await updateWebhook(webhookId, {
      events: [...webhook.events, 'ping']
    });
  }
  
  // 3. Test connectivity first
  console.log('Testing webhook connectivity...');
  const testResult = await testWebhook(webhookId);
  
  if (!testResult.success) {
    console.error('Webhook test failed:', testResult.message);
    console.error('Fix the issue before resetting circuit');
    return null;
  }
  
  console.log('Webhook test successful');
  
  // 4. Reset circuit
  console.log('Resetting circuit breaker...');
  const { data: resetWebhook } = await resetCircuit(webhookId);
  
  console.log(`Circuit reset. Webhook is now active: ${resetWebhook.isActive}`);
  
  return resetWebhook;
}

Common Causes of Circuit Breaker Trips

  • Server crashed or was redeployed
  • DNS resolution failed
  • Network connectivity issues
Fix: Ensure your endpoint is up and accessible
  • API token expired
  • Custom header value changed
  • Authentication endpoint down
Fix: Update the webhook’s custom headers with valid credentials
  • Endpoint taking too long to respond
  • Long-running synchronous processing
  • Network latency
Fix: Acknowledge webhooks immediately and process asynchronously
  • Application errors (5xx)
  • Validation failures (4xx)
  • Incorrect response format
Fix: Check your application logs and fix the errors

Error Responses

{
  "success": false,
  "error": {
    "code": "RESOURCE_NOT_FOUND",
    "message": "Webhook configuration not found"
  }
}
{
  "success": false,
  "error": {
    "code": "RESOURCE_ACCESS_DENIED",
    "message": "Access denied to this webhook configuration"
  }
}