## Documentation Index

Fetch the complete documentation index at: [/llms.txt](https://docs.mem0.ai/llms.txt)

Use this file to discover all available pages before exploring further.

### Python

```
# 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)
```

### JavaScript

```
// 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));
```

### cURL

```
# 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'
```

### PHP

```
<?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);
```

### Go

```
package main

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

func main() {
	// Update a webhook
	payload := strings.NewReader(`{
		"name": "Updated Webhook",
		"url": "https://new-webhook-url.com",
		"event_types": ["memory:add"]
	}`)

req, _ := http.NewRequest("PUT", "https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/", payload)
	req.Header.Add("Authorization", "Token your-api-key")
	req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)
	fmt.Println(string(body))

// Delete a webhook
	req, _ = http.NewRequest("DELETE", "https://api.mem0.ai/api/v1/webhooks/your_webhook_id/webhook/", nil)
	req.Header.Add("Authorization", "Token your-api-key")

res, _ = http.DefaultClient.Do(req)
	defer res.Body.Close()
	body, _ = ioutil.ReadAll(res.Body)
	fmt.Println(string(body))
}
```

### Java

```java
// 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("{\n    \"name\": \"Updated Webhook\",\n    \"url\": \"https://new-webhook-url.com\",\n    \"event_types\": [\"memory:add\"]\n  }")
  .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();
```

### Authorization

Authorization
- type: `string`
- location: `header`
- required: `true`

API key authentication. Prefix your Mem0 API key with 'Token '. Example: 'Token your_api_key'

### Path Parameters

- `webhook_id`: string (required) - Unique identifier of the webhook.

### Body

- `name`: string - New name for the webhook
- `url`: string - New URL endpoint for the webhook
- `event_types`: enum<string>[] - New list of event types to subscribe to

Available options:

- `memory:add`
- `memory:update`
- `memory:delete`
- `memory:categorize`

### Response

**200** - Webhook updated successfully

Example response:
```json
{
  "message": "Webhook updated successfully"
}
```

Error responses:
```json
{
  "error": "<string>"
}
```

```json
{
  "error": "You don't have access to this webhook"
}
```

```json
{
  "error": "Webhook not found"
}
```
