> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.paymentkit.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.paymentkit.com/_mcp/server.

# Delete Webhook Endpoint

DELETE https://app.paymentkit.com/api/{account_id}/webhook-endpoints/{external_id}

Delete a webhook endpoint (soft-delete by setting is_active=False).

Protected webhooks cannot be deleted via this endpoint.

Reference: https://docs.paymentkit.com/api-reference/api-reference/webhook-endpoints/delete-webhook-endpoint

## Authentication

- `Authorization` header (bearer token, required)

## Servers

- `https://app.paymentkit.com` (Production, default)
- `https://staging.paymentkit.com` (Staging)

## Request

### Path parameters

- `external_id` (string, required)
- `account_id` (string, required)

## Response

### 200

Successful Response

- `id` (string, required) — Unique webhook endpoint identifier
- `url` (string, required) — The URL receiving webhook events
- `events` (list of string, required) — List of subscribed event types
- `is_active` (boolean, required) — Whether the webhook endpoint is active
- `is_protected` (boolean, required) — Whether the webhook endpoint is protected from deletion
- `is_blacklisted` (boolean, required) — Whether the webhook endpoint is blacklisted due to consecutive delivery failures
- `consecutive_failures` (integer, required) — Number of consecutive delivery failures (resets on success)
- `created_at` (datetime, required) — When the webhook endpoint was created
- `updated_at` (datetime, required) — When the webhook endpoint was last updated
- `description` (string, optional, nullable) — Webhook endpoint description
- `blacklisted_at` (datetime, optional, nullable) — When the webhook endpoint was blacklisted (null if not blacklisted)
- `last_failed_delivery` (object, optional, nullable) — Information about the last failed delivery (only included for blacklisted endpoints)
  - `last_response_status` (integer, optional, nullable) — HTTP status code from the last failed delivery attempt
  - `last_error` (string, optional, nullable) — Error message from the last failed delivery attempt
  - `last_attempt_at` (datetime, optional, nullable) — When the last delivery attempt was made

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "id": "whe_prod_9f8e7d6c5b4a3210",
  "url": "https://hooks.myapp.com/payment-events",
  "events": [
    "payment.succeeded",
    "payment.failed"
  ],
  "is_active": false,
  "is_protected": false,
  "is_blacklisted": false,
  "consecutive_failures": 0,
  "created_at": "2023-11-20T14:45:00Z",
  "updated_at": "2024-04-10T08:15:00Z",
  "description": "Primary production webhook for payment notifications",
  "blacklisted_at": null,
  "last_failed_delivery": null
}
```

**SDK Code**

```python
from payment_kit import PaymentKit

client = PaymentKit(
    token="YOUR_TOKEN_HERE",
)

client.webhook_endpoints.delete_webhook_endpoint(
    account_id="account_id",
    external_id="external_id",
)

```

```javascript
const url = 'https://app.paymentkit.com/api/account_id/webhook-endpoints/external_id';
const options = {
  method: 'DELETE',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.paymentkit.com/api/account_id/webhook-endpoints/external_id"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("DELETE", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://app.paymentkit.com/api/account_id/webhook-endpoints/external_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://app.paymentkit.com/api/account_id/webhook-endpoints/external_id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://app.paymentkit.com/api/account_id/webhook-endpoints/external_id', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.paymentkit.com/api/account_id/webhook-endpoints/external_id");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.paymentkit.com/api/account_id/webhook-endpoints/external_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```