Skip to main content

Overview

Delete an existing webhook subscription to stop receiving notifications for subscribed events. This endpoint is used by Zapier when users remove or disable trigger integrations, ensuring clean webhook management and preventing unnecessary API calls.
This endpoint is primarily used by Zapier integrations but can be used with any webhook service that follows the same pattern.

Authentication

All requests require a valid API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY

Delete Webhook

curl -X DELETE 'https://app.timetracker.in/api/integrations/zapier/webhooks/wh_1234567890abcdef' \
  -H 'Authorization: Bearer YOUR_API_KEY'

Path Parameters

id
string
required
The unique identifier of the webhook subscription to delete.Format: Webhook ID (e.g., wh_1234567890abcdef)Example: wh_1234567890abcdef

Response

Success Response

{
  "success": true
}
success
boolean
Confirms successful webhook deletion.

Error Responses

{
  "error": "Webhook not found"
}
The specified webhook ID doesn’t exist or has already been deleted.
{
  "error": "Failed to delete webhook"
}
The webhook exists but couldn’t be deleted due to system constraints.
{
  "error": "Unauthorized"
}
Invalid or missing API key in the Authorization header.
{
  "error": "User ID not found in authentication result"
}
The API key is valid but doesn’t contain the required user identification.
{
  "error": "Internal server error"
}
An unexpected server error occurred. Try again or contact support.

Zapier Integration Usage

Automatic Cleanup

Zapier automatically calls this endpoint when:
1

Trigger Removal

When users delete a Zap that contains webhook triggers, Zapier calls this endpoint to clean up the subscription.
2

Integration Disconnection

When users disconnect the Timetracker integration from their Zapier account, all associated webhooks are automatically removed.
3

Error Recovery

If a webhook subscription fails or becomes invalid, Zapier may attempt to clean it up to prevent future issues.

Webhook Lifecycle

Subscribe: When setting up a trigger, Zapier calls the subscribe endpoint to create a webhook subscription.
Monitoring: The webhook remains active and receives event notifications until deleted.
Cleanup: When no longer needed, Zapier calls this delete endpoint to remove the subscription.

Important Notes

Immediate Effect: Webhook deletion takes effect immediately. No further notifications will be sent to the registered URL after successful deletion.
Idempotent Operation: Deleting a non-existent webhook returns a success response, making this operation safe to retry.
Best Practices:
  • Always store webhook IDs when creating subscriptions for later cleanup
  • Implement proper error handling for deletion failures
  • Consider implementing webhook health checks to detect stale subscriptions
  • Use HTTPS endpoints only for security
  • Monitor webhook deletion logs for integration health

Webhook Management

Finding Webhook IDs

To find webhook IDs for deletion, you can:
  1. Store during creation: Save the webhook ID returned from the subscribe endpoint
  2. List webhooks: Use the webhook listing endpoint (if available) to find active subscriptions
  3. Zapier management: Check your Zapier account’s webhook management interface

Bulk Cleanup

For managing multiple webhooks:
// Example: Delete multiple webhooks
const webhookIds = ['wh_123', 'wh_456', 'wh_789'];

for (const webhookId of webhookIds) {
  try {
    const response = await fetch(`https://app.timetracker.in/api/integrations/zapier/webhooks/${webhookId}`, {
      method: 'DELETE',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    });
    
    if (response.ok) {
      console.log(`Deleted webhook: ${webhookId}`);
    }
  } catch (error) {
    console.error(`Failed to delete webhook ${webhookId}:`, error);
  }
}

Security Considerations

Access Control: Only the user who created a webhook can delete it. Webhook IDs are workspace-specific and cannot be accessed across different user accounts.
Audit Trail: Webhook deletions are logged for security and compliance purposes. Consider implementing audit logging in your applications.

Troubleshooting

Common Issues

Cause: The webhook ID is incorrect or the webhook was already deleted.Solution:
  • Verify the webhook ID is correct
  • Check if the webhook was already deleted
  • Ensure you’re using the correct API key for the workspace
Cause: Invalid API key or missing authorization header.Solution:
  • Verify your API key is correct and active
  • Ensure the Authorization header is properly formatted
  • Check that your API key has the necessary permissions
Cause: Webhook appears to still be active after deletion.Solution:
  • Wait a few minutes for the deletion to propagate
  • Check if multiple webhooks exist for the same URL
  • Verify the webhook ID was correct

Integration Testing

To test webhook deletion in your integration:
  1. Create a test webhook using the subscribe endpoint
  2. Store the webhook ID returned in the response
  3. Delete the webhook using this endpoint
  4. Verify deletion by attempting to trigger the webhook (should fail)
  5. Clean up any test data created during testing
This ensures your integration properly handles the complete webhook lifecycle.