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

# Update webhook

PUT https://api.uploadcare.com/webhooks/{id}/
Content-Type: application/x-www-form-urlencoded

Update webhook attributes.

Reference: https://uploadcare.com/docs/api/rest/webhook/update-webhook

## Authentication

- `Authorization` header (required) — Every request made to `https://api.uploadcare.com/` MUST be signed. HTTPS SHOULD be used with any authorization scheme. Requests MUST contain the `Authorization` header defining `auth-scheme` and `auth-param`: `Authorization: auth-scheme auth-param`. Every request MUST contain the `Accept` header identifying the REST API version: `Accept: application/vnd.uploadcare-v0.7+json`. There are two available authorization schemes: * For production: `Uploadcare`, a scheme where a `signature`, not your Secret API Key MUST be specified. Signatures SHOULD be generated on backend. * For quick tests: `Uploadcare.Simple`, a simple scheme where your [Secret API Key](https://app.uploadcare.com/projects/-/api-keys/) MUST be specified in every request's `auth-param`.

## Request

### Path parameters

- `id` (integer, required) — Webhook ID.

### Headers

- `Accept` (string, required) — Version header.

### Body (application/x-www-form-urlencoded)

This endpoint expects an object.

- `target_url` (string, optional) — A URL that is triggered by an event, for example, a file upload. A target URL MUST be unique for each `project` — `event type` combination.
- `event` (enum, optional) — An event you subscribe to.
  - Allowed values: `file.uploaded`, `file.infected`, `file.stored`, `file.deleted`, `file.info_updated`
- `is_active` (boolean, optional, default: true) — Marks a subscription as either active or not, defaults to `true`, otherwise `false`.
- `signing_secret` (string, optional) — Optional [HMAC/SHA-256](https://en.wikipedia.org/wiki/HMAC) secret that, if set, will be used to calculate signatures for the webhook payloads sent to the `target_url`. Calculated signature will be sent to the `target_url` as a value of the `X-Uc-Signature` HTTP header. The header will have the following format: `X-Uc-Signature: v1=<HMAC-SHA256-HEX-DIGEST>`. See [Secure Webhooks](https://uploadcare.com/docs/webhooks/#signed-webhooks) for details.

## Response

### 200

Webhook attributes successfully updated.

- `id` (integer, optional) — Webhook's ID.
- `project` (integer, optional) — Project ID the webhook belongs to.
- `created` (datetime, optional) — date-time when a webhook was created.
- `updated` (datetime, optional) — date-time when a webhook was updated.
- `event` (enum, optional) — An event you subscribe to.
  - Allowed values: `file.uploaded`, `file.infected`, `file.stored`, `file.deleted`, `file.info_updated`
- `target_url` (string, optional) — A URL that is triggered by an event, for example, a file upload. A target URL MUST be unique for each `project` — `event type` combination.
- `is_active` (boolean, optional, default: true) — Marks a subscription as either active or not, defaults to `true`, otherwise `false`.
- `version` (enum, optional) — Webhook payload's version.
  - Allowed values: `0.7`
- `signing_secret` (string, optional) — Optional [HMAC/SHA-256](https://en.wikipedia.org/wiki/HMAC) secret that, if set, will be used to calculate signatures for the webhook payloads sent to the `target_url`. Calculated signature will be sent to the `target_url` as a value of the `X-Uc-Signature` HTTP header. The header will have the following format: `X-Uc-Signature: v1=<HMAC-SHA256-HEX-DIGEST>`. See [Secure Webhooks](https://uploadcare.com/docs/webhooks/#signed-webhooks) for details.

## Errors

### 401 Unauthorized Error

Authorization errors.

- `detail` (enum, optional)
  - Allowed values: `Incorrect authentication credentials.`, `Public key {public_key} not found.`, `Secret key not found.`, `Invalid signature. Please check your Secret key.`

### 404 Not Found Error

Webhook with ID \{id} not found.

- `detail` (string, optional) — Not found.

### 406 Not Acceptable Error

Invalid version header `Accept` for this endpoint.

- `detail` (string, optional, default: Incorrect Accept header provided. Make sure to specify API version. Refer to REST API docs for details.)

### 429 Too Many Requests Error

Request was throttled.

- `detail` (string, optional)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "id": 1,
  "project": 13,
  "created": "2016-04-27T11:49:54.948615Z",
  "updated": "2016-04-27T12:04:57.819933Z",
  "event": "file.infected",
  "target_url": "http://example.com/hooks/receiver",
  "is_active": true,
  "version": "0.7",
  "signing_secret": "7kMVZivndx0ErgvhRKAr"
}
```

**SDK Code**

```javascript JS
import {
  updateWebhook,
  UploadcareSimpleAuthSchema,
} from '@uploadcare/rest-client';

const uploadcareSimpleAuthSchema = new UploadcareSimpleAuthSchema({
  publicKey: 'YOUR_PUBLIC_KEY',
  secretKey: 'YOUR_SECRET_KEY',
});

const result = await updateWebhook(
  {
    id: 1473151,
    targetUrl: 'https://yourwebhook.com',
    event: 'file.uploaded',
    isActive: true,
    signingSecret: 'webhook-secret',
  },
  { authSchema: uploadcareSimpleAuthSchema }
)

```

```php PHP
<?php
$configuration = Uploadcare\Configuration::create((string) $_ENV['UPLOADCARE_PUBLIC_KEY'], (string) $_ENV['UPLOADCARE_SECRET_KEY']);

$api = (new Uploadcare\Api($configuration))->webhook();
$webhook = $api->updateWebhook(1473151, [
    'target_url' => 'https://yourwebhook.com',
    'event' => 'file.uploaded',
    'is_active' => true,
    'signing_secret' => 'webhook-secret',
]);
\sprintf("Webhook with url %s is %s\n", $webhook->getTargetUrl(), $webhook->isActive() ? 'active' : 'not active');

```

```python Python
from pyuploadcare import Uploadcare, Webhook
uploadcare = Uploadcare(public_key='YOUR_PUBLIC_KEY', secret_key='YOUR_SECRET_KEY')

webhook_id = 1473151
webhook = uploadcare.webhooks_api.update(webhook_id, {"is_active": False})

```

```ruby Ruby
require 'uploadcare'
Uploadcare.config.public_key = 'YOUR_PUBLIC_KEY'
Uploadcare.config.secret_key = 'YOUR_SECRET_KEY'

webhook_id = 1_473_151
options = {
  target_url: 'https://yourwebhook.com',
  event: 'file.uploaded',
  is_active: true,
  signing_secret: 'webhook-secret'
}
Uploadcare::Webhook.update(webhook_id, options)

```

```swift Swift
import Uploadcare

let uploadcare = Uploadcare(withPublicKey: "YOUR_PUBLIC_KEY", secretKey: "YOUR_SECRET_KEY")

let url = URL(string: "https://yourwebhook.com")!
let webhook = try await uploadcare.updateWebhook(id: 1473151, targetUrl: url, event: .fileInfoUpdated, isActive: true, signingSecret: "webhook-secret")
print(webhook)

```

```kotlin Kotlin
import com.uploadcare.android.library.api.UploadcareClient

val uploadcare = UploadcareClient(publicKey = "YOUR_PUBLIC_KEY", secretKey = "YOUR_SECRET_KEY")

val url = URI("https://yourwebhook.com")
val webhook = uploadcare.updateWebhook(
    webhookId = 1473151,
    targetUrl = url,
    event = EventType.UPLOADED,
    isActive = true,
    signingSecret = "",
)
Log.d("TAG", webhook.toString())

```

```go
package main

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

func main() {

	url := "https://api.uploadcare.com/webhooks/143/"

	req, _ := http.NewRequest("PUT", url, nil)

	req.Header.Add("Accept", "application/vnd.uploadcare-v0.7+json")
	req.Header.Add("Authorization", "<apiKey>")
	req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

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

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

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

}
```

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

HttpResponse<String> response = Unirest.put("https://api.uploadcare.com/webhooks/143/")
  .header("Accept", "application/vnd.uploadcare-v0.7+json")
  .header("Authorization", "<apiKey>")
  .header("Content-Type", "application/x-www-form-urlencoded")
  .asString();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.uploadcare.com/webhooks/143/");
var request = new RestRequest(Method.PUT);
request.AddHeader("Accept", "application/vnd.uploadcare-v0.7+json");
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
IRestResponse response = client.Execute(request);
```