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

# Update a webhook

PUT https://api.middesk.com/v1/webhooks/{id}
Content-Type: application/json

Updates webhook endpoint settings. Event schemas are managed through the nested event_schemas resource, not through webhook updates.

Reference: https://docs.middesk.com/api-reference/webhooks/update-webhook

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `id` (string, required) — Webhook ID

### Body (application/json)

This endpoint expects an object.

- `url` (string, optional) — Webhook endpoint URL
- `secret` (string, optional) — Secret for webhook signature verification
- `disabled_at` (string, optional) — Timestamp when webhook was disabled
- `enabled_events` (list of string, optional) — Array of event types to subscribe to
- `oidc_auth_method` (enum, optional) — OIDC authentication method for obtaining access tokens. Required when configuring OIDC. 'private_key_jwt' — requires oidc_client_id, oidc_token_endpoint, oidc_access_token_ttl_seconds. 'client_secret' — requires oidc_client_id, oidc_client_secret, oidc_token_endpoint, oidc_access_token_ttl_seconds. Both methods optionally accept oidc_scope and oidc_resource_uri.
  - Allowed values: `private_key_jwt`, `client_secret`
- `oidc_client_id` (string, optional) — OIDC client ID. Required for both auth methods.
- `oidc_client_secret` (string, optional) — OIDC client secret. Required when oidc_auth_method is 'client_secret'. Write-only; never returned in responses.
- `oidc_token_endpoint` (string, optional) — OIDC token endpoint URL. Required for both auth methods.
- `oidc_resource_uri` (string, optional) — Optional. OIDC resource URI (Microsoft-specific; use oidc_scope for standard OAuth 2.0).
- `oidc_scope` (string, optional) — Optional. OAuth 2.0 scope for the token request (e.g. "api://\<app-id>/.default").
- `oidc_access_token_ttl_seconds` (integer, optional) — OIDC access token TTL in seconds. Required for both auth methods.

## Response

### 200

webhook updated

- `any`

## Errors

### 404 Update Webhook Request Not Found Error

webhook not found

- `errors` (list of ErrorResponseErrorsItem, required)

## Types

### ErrorResponseErrorsItem

- `message` (string, required)
- `parameter` (string, optional) — Request parameter associated with the error, when applicable

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "created_at": "2025-01-07T12:00:00.000Z",
  "enabled_events": [
    "business.created",
    "business.updated",
    "order.updated"
  ],
  "event_schemas": [
    {
      "created_at": "2025-01-07T12:00:00.000Z",
      "id": "3f2a1c9e-8b4d-4e21-9c77-1a2b3c4d5e6f",
      "namespace": "business.updated",
      "object": "webhook_event_schema",
      "schema": "{ id name status }",
      "updated_at": "2025-01-07T12:00:00.000Z"
    }
  ],
  "id": "f2a3b4c5-d6e7-8901-5678-9abcdef01234",
  "object": "webhook",
  "updated_at": "2025-01-07T12:00:00.000Z",
  "url": "https://example.com/webhooks/middesk"
}
```

**SDK Code**

```python Webhook updated
import requests

url = "https://api.middesk.com/v1/webhooks/id"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript Webhook updated
const url = 'https://api.middesk.com/v1/webhooks/id';
const options = {
  method: 'PUT',
  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 Webhook updated
package main

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

func main() {

	url := "https://api.middesk.com/v1/webhooks/id"

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

	req, _ := http.NewRequest("PUT", 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 Webhook updated
require 'uri'
require 'net/http'

url = URI("https://api.middesk.com/v1/webhooks/id")

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

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

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

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

HttpResponse<String> response = Unirest.put("https://api.middesk.com/v1/webhooks/id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.middesk.com/v1/webhooks/id', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Webhook updated
using RestSharp;

var client = new RestClient("https://api.middesk.com/v1/webhooks/id");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Webhook updated
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://api.middesk.com/v1/webhooks/id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```