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

# Update webhook configuration

PATCH https://api.useroot.com/api/webhooks/{webhook_id}
Content-Type: application/json

Updates URL, description, and/or event type subscriptions. Only provided fields are changed; ``event_types`` replaces the full allowlist.

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

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: '[Code Generated] Root - Instant Account to Account Money Movement'
  version: 1.0.0
paths:
  /api/webhooks/{webhook_id}:
    patch:
      operationId: update-webhook
      summary: Update webhook configuration
      description: >-
        Updates URL, description, and/or event type subscriptions. Only provided
        fields are changed; ``event_types`` replaces the full allowlist.
      tags:
        - webhooksApi
      parameters:
        - name: webhook_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: x-api-key
          in: header
          description: >-
            RootPay API key sent in the x-api-key header. Keys are
            environment-scoped: live_* for production, test_* for sandbox.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Webhook configuration updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response_WebhookConfigResponse_'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookConfigPatchRequest'
servers:
  - url: https://api.useroot.com
    description: Production
components:
  schemas:
    WebhookEventType:
      type: string
      enum:
        - payout.debited
        - payout.settled
        - payout.failed
        - payin.settled
        - payin.failed
        - subaccount.credit_received
      title: WebhookEventType
    WebhookConfigPatchRequest:
      type: object
      properties:
        url:
          type:
            - string
            - 'null'
          format: uri
        description:
          type:
            - string
            - 'null'
        event_types:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/WebhookEventType'
          description: Replace the full subscription allowlist when provided.
      title: WebhookConfigPatchRequest
    WebhookConfigResponse:
      type: object
      properties:
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        id:
          type: string
          format: uuid
        url:
          type: string
        description:
          type:
            - string
            - 'null'
        is_active:
          type: boolean
        event_types:
          type: array
          items:
            type: string
          description: Sorted allowlist of subscribed webhook event types
      required:
        - created_at
        - updated_at
        - id
        - url
        - description
        - is_active
        - event_types
      title: WebhookConfigResponse
    Response_WebhookConfigResponse_:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/WebhookConfigResponse'
        warning:
          type:
            - string
            - 'null'
      required:
        - data
      title: Response_WebhookConfigResponse_
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        RootPay API key sent in the x-api-key header. Keys are
        environment-scoped: live_* for production, test_* for sandbox.

```

## Examples



**Request**

```json
{
  "description": "Production payouts only",
  "event_types": [
    "payout.settled",
    "payout.failed"
  ]
}
```

**Response**

```json
{
  "data": {
    "created_at": "2024-03-20T12:00:00Z",
    "updated_at": "2024-03-20T12:00:00Z",
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "url": "https://example.com/webhook",
    "description": "Production payouts only",
    "is_active": true,
    "event_types": [
      "payout.failed",
      "payout.settled"
    ]
  }
}
```

**SDK Code**

```python Update subscriptions
import requests

url = "https://api.useroot.com/api/webhooks/webhook_id"

payload = {
    "description": "Production payouts only",
    "event_types": ["payout.settled", "payout.failed"]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Update subscriptions
const url = 'https://api.useroot.com/api/webhooks/webhook_id';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"description":"Production payouts only","event_types":["payout.settled","payout.failed"]}'
};

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

```go Update subscriptions
package main

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

func main() {

	url := "https://api.useroot.com/api/webhooks/webhook_id"

	payload := strings.NewReader("{\n  \"description\": \"Production payouts only\",\n  \"event_types\": [\n    \"payout.settled\",\n    \"payout.failed\"\n  ]\n}")

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

	req.Header.Add("x-api-key", "<apiKey>")
	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 Update subscriptions
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/webhooks/webhook_id")

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

request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"description\": \"Production payouts only\",\n  \"event_types\": [\n    \"payout.settled\",\n    \"payout.failed\"\n  ]\n}"

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

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

HttpResponse<String> response = Unirest.patch("https://api.useroot.com/api/webhooks/webhook_id")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"description\": \"Production payouts only\",\n  \"event_types\": [\n    \"payout.settled\",\n    \"payout.failed\"\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.useroot.com/api/webhooks/webhook_id', [
  'body' => '{
  "description": "Production payouts only",
  "event_types": [
    "payout.settled",
    "payout.failed"
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Update subscriptions
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/webhooks/webhook_id");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"description\": \"Production payouts only\",\n  \"event_types\": [\n    \"payout.settled\",\n    \"payout.failed\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Update subscriptions
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "description": "Production payouts only",
  "event_types": ["payout.settled", "payout.failed"]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.useroot.com/api/webhooks/webhook_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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()
```