> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mem0.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Webhook

> Update an existing webhook configuration, such as its URL or event subscriptions, by webhook ID.



## OpenAPI

````yaml put /api/v1/webhooks/{webhook_id}/
openapi: 3.0.1
info:
  title: Mem0 API Docs
  description: mem0.ai API Docs
  contact:
    email: support@mem0.ai
  license:
    name: Apache 2.0
  version: v1
servers:
  - url: https://api.mem0.ai/
security:
  - ApiKeyAuth: []
paths:
  /api/v1/webhooks/{webhook_id}/:
    put:
      tags:
        - webhooks
      summary: Update Webhook
      description: Update an existing webhook
      operationId: update_webhook
      parameters:
        - name: webhook_id
          in: path
          required: true
          description: Unique identifier of the webhook.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: New name for the webhook
                url:
                  type: string
                  description: New URL endpoint for the webhook
                event_types:
                  type: array
                  items:
                    type: string
                    enum:
                      - memory:add
                      - memory:update
                      - memory:delete
                      - memory:categorize
                  description: New list of event types to subscribe to
      responses:
        '200':
          description: Webhook updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Webhook updated successfully
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '403':
          description: Unauthorized access
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: You don't have access to this webhook
        '404':
          description: Webhook not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Webhook not found
      x-code-samples:
        - lang: Python
          source: |-
            # To use the Python SDK, install the package:
            # pip install mem0ai

            from mem0 import MemoryClient
            client = MemoryClient(api_key="your_api_key")

            # Update a webhook
            webhook = client.update_webhook(
                webhook_id="your_webhook_id",
                name="Updated Webhook",
                url="https://new-webhook-url.com",
                event_types=["memory:add", "memory:categorize"]
            )
            print(webhook)

            # Delete a webhook
            response = client.delete_webhook(webhook_id="your_webhook_id")
            print(response)
        - lang: JavaScript
          source: |-
            // To use the JavaScript SDK, install the package:
            // npm i mem0ai

            import MemoryClient from 'mem0ai';
            const client = new MemoryClient({ apiKey: 'your-api-key' });

            // Update a webhook
            client.updateWebhook('your_webhook_id', {
              name: 'Updated Webhook',
              url: 'https://new-webhook-url.com',
              event_types: ['memory:add', 'memory:categorize']
            })
              .then(webhook => console.log(webhook))
              .catch(err => console.error(err));

            // Delete a webhook
            client.deleteWebhook('your_webhook_id')
              .then(response => console.log(response))
              .catch(err => console.error(err));
        - lang: cURL
          source: |-
            # Update a webhook
            curl --request PUT \
              --url 'https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/' \
              --header 'Authorization: Token your-api-key' \
              --header 'Content-Type: application/json' \
              --data '{
                "name": "Updated Webhook",
                "url": "https://new-webhook-url.com",
                "event_types": ["memory:add"]
              }'

            # Delete a webhook
            curl --request DELETE \
              --url 'https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/' \
              --header 'Authorization: Token your-api-key'
        - lang: PHP
          source: |-
            <?php

            $curl = curl_init();

            // Update a webhook
            curl_setopt_array($curl, [
              CURLOPT_URL => "https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/",
              CURLOPT_RETURNTRANSFER => true,
              CURLOPT_CUSTOMREQUEST => "PUT",
              CURLOPT_POSTFIELDS => json_encode([
                "name" => "Updated Webhook",
                "url" => "https://new-webhook-url.com",
                "event_types" => ["memory:add"]
              ]),
              CURLOPT_HTTPHEADER => [
                "Authorization: Token your-api-key",
                "Content-Type: application/json"
              ],
            ]);

            $response = curl_exec($curl);

            // Delete a webhook
            curl_setopt_array($curl, [
              CURLOPT_URL => "https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/",
              CURLOPT_RETURNTRANSFER => true,
              CURLOPT_CUSTOMREQUEST => "DELETE",
              CURLOPT_HTTPHEADER => ["Authorization: Token your-api-key"],
            ]);

            $response = curl_exec($curl);
            curl_close($curl);
        - lang: Go
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\t// Update a webhook\n\tpayload := strings.NewReader(`{\n\t\t\"name\": \"Updated Webhook\",\n\t\t\"url\": \"https://new-webhook-url.com\",\n\t\t\"event_types\": [\"memory:add\"]\n\t}`)\n\n\treq, _ := http.NewRequest(\"PUT\", \"https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/\", payload)\n\treq.Header.Add(\"Authorization\", \"Token your-api-key\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\tfmt.Println(string(body))\n\n\t// Delete a webhook\n\treq, _ = http.NewRequest(\"DELETE\", \"https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/\", nil)\n\treq.Header.Add(\"Authorization\", \"Token your-api-key\")\n\n\tres, _ = http.DefaultClient.Do(req)\n\tdefer res.Body.Close()\n\tbody, _ = ioutil.ReadAll(res.Body)\n\tfmt.Println(string(body))\n}"
        - lang: Java
          source: >-
            // Update a webhook

            HttpResponse<String> response =
            Unirest.put("https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/")
              .header("Authorization", "Token your-api-key")
              .header("Content-Type", "application/json")
              .body("{
                \"name\": \"Updated Webhook\",
                \"url\": \"https://new-webhook-url.com\",
                \"event_types\": [\"memory:add\"]
              }")
              .asString();

            // Delete a webhook

            HttpResponse<String> response =
            Unirest.delete("https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/")
              .header("Authorization", "Token your-api-key")
              .asString();
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        API key authentication. Prefix your Mem0 API key with 'Token '. Example:
        'Token your_api_key'

````