---
title: Update a Webhook
slug: feature-experimentation/api/update-a-webhook
docTags: 
createdAt: 2026-10-01T19:58:02.336Z
---

{
  "id": "cq6HpUwDTKaNjZFx2Z-n7",
  "type": "api-oas-v2",
  "data": {
    "method": "PATCH",
    "url": "https://api.optimizely.com/v2/webhooks/{webhook_id}",
    "servers": [
      {
        "url": "https://api.optimizely.com/v2/webhooks/{webhook_id}"
      }
    ],
    "name": "Update a Webhook",
    "description": "Update a webhook by ID",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "webhook_id",
          "type": "integer",
          "example": 12345,
          "description": "The webhook identifier"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "Webhook request body",
          "customType": "WebhookRequestBody",
          "schema": [
            {
              "name": "description",
              "kind": "required",
              "type": "string",
              "description": "A short description of the Webhook.",
              "example": "Webhook description"
            },
            {
              "name": "events",
              "kind": "required",
              "type": "array",
              "description": "List of events subscribed to the webhook.",
              "example": "",
              "itemType": "string",
              "customType": "string[]",
              "itemExample": "",
              "itemDefault": ""
            },
            {
              "name": "name",
              "kind": "required",
              "type": "string",
              "description": "Name of the Webhook."
            },
            {
              "name": "url",
              "kind": "required",
              "type": "string",
              "description": "Webhook URL"
            }
          ],
          "modelRef": "#/components/schemas/WebhookRequestBody",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKey",
          "name": "apiKey",
          "kind": "optional",
          "type": "http",
          "scheme": "bearer"
        },
        {
          "id": "OAuth2",
          "name": "OAuth2",
          "kind": "optional",
          "type": "oauth2",
          "description": "<p>Write applications that authenticate with the REST API via OAuth 2.0. Or, to authenticate using a personal token, see <a href=\"https://docs.developers.optimizely.com/web/docs/personal-token\" target=\"_blank\">https://docs.developers.optimizely.com/web/docs/personal-token</a></p>",
          "oauth2Flows": {
            "authorizationCode": {
              "authorizationUrl": "https://app.optimizely.com/oauth2/authorize",
              "tokenUrl": "https://app.optimizely.com/oauth2/token",
              "scopes": {
                "all": "Full access to your account"
              }
            }
          },
          "requiredScopes": [
            "read",
            "write"
          ]
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Return updated Webhook info",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Webhook",
            "schema": [
              {
                "name": "active",
                "kind": "optional",
                "type": "boolean",
                "readOnly": true,
                "description": "Is Webhook active."
              },
              {
                "name": "created",
                "kind": "optional",
                "type": "string",
                "readOnly": true,
                "description": "Created time."
              },
              {
                "name": "description",
                "kind": "optional",
                "type": "string",
                "description": "A short description of the Webhook.",
                "example": "Webhook description"
              },
              {
                "name": "events",
                "kind": "optional",
                "type": "array",
                "description": "List of events subscribed to the webhook.",
                "example": "",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              },
              {
                "name": "id",
                "kind": "optional",
                "type": "string",
                "readOnly": true,
                "description": "ID of this Webhook"
              },
              {
                "name": "last_modified",
                "kind": "optional",
                "type": "string",
                "readOnly": true,
                "description": "Last modification time."
              },
              {
                "name": "name",
                "kind": "required",
                "type": "string",
                "description": "Name of the Webhook."
              },
              {
                "name": "project_id",
                "kind": "required",
                "type": "integer",
                "description": "ID of the project of the Environment."
              },
              {
                "name": "url",
                "kind": "required",
                "type": "string",
                "description": "Webhook URL"
              }
            ],
            "modelRef": "#/components/schemas/Webhook",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Invalid request body supplied",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": []
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "Invalid credentials",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": []
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "403",
        "description": "You do not have access to the specified Webhook",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": []
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "IE6MVCgMNKFm6oKx3u0vd",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request PATCH \\\n     --url https://api.optimizely.com/v2/webhooks/{webhook_id} \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"description\": \"Webhook description\",\n     \"events\": [],\n     \"name\": \"\",\n     \"url\": \"\"\n     }'"
        },
        {
          "id": "zZhk2-JbMvPd_Ug8m0C6W",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"description\": \"Webhook description\",\n   \"events\": [],\n   \"name\": \"\",\n   \"url\": \"\"\n});\n\nvar requestOptions = {\n   method: 'PATCH',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.optimizely.com/v2/webhooks/{webhook_id}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "Rfh9spFLfDtRER0g5eLdx",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.optimizely.com/v2/webhooks/{webhook_id}\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"description\": \"Webhook description\",\n   \"events\": [],\n   \"name\": \"\",\n   \"url\": \"\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "ZRMTlT3t0vHb5hH03s7eu",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.optimizely.com/v2/webhooks/{webhook_id}\"\n\npayload = json.dumps({\n   \"description\": \"Webhook description\",\n   \"events\": [],\n   \"name\": \"\",\n   \"url\": \"\"\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"PATCH\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "IE6MVCgMNKFm6oKx3u0vd"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Return updated Webhook info\n{\n  \"active\": false,\n  \"created\": \"\",\n  \"description\": \"Webhook description\",\n  \"events\": [\n    \"\"\n  ],\n  \"id\": \"\",\n  \"last_modified\": \"\",\n  \"name\": \"\",\n  \"project_id\": 0,\n  \"url\": \"\"\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Invalid request body supplied\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Invalid credentials\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        },
        {
          "id": "response-3-403",
          "language": "403",
          "code": "// You do not have access to the specified Webhook\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}