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)// 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));# 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
$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);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))
}// 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();require 'uri'
require 'net/http'
url = URI("https://api.mem0.ai/api/v1/webhooks/{webhook_id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"event_types\": []\n}"
response = http.request(request)
puts response.read_body{
"message": "Webhook updated successfully"
}{
"error": "<string>"
}{
"error": "You don't have access to this webhook"
}{
"error": "Webhook not found"
}Webhooks
Update Webhook
Update an existing webhook configuration, such as its URL or event subscriptions, by webhook ID.
PUT
/
api
/
v1
/
webhooks
/
{webhook_id}
/
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)// 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));# 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
$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);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))
}// 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();require 'uri'
require 'net/http'
url = URI("https://api.mem0.ai/api/v1/webhooks/{webhook_id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"event_types\": []\n}"
response = http.request(request)
puts response.read_body{
"message": "Webhook updated successfully"
}{
"error": "<string>"
}{
"error": "You don't have access to this webhook"
}{
"error": "Webhook not found"
}Authorizations
API key authentication. Prefix your Mem0 API key with 'Token '. Example: 'Token your_api_key'
Path Parameters
Unique identifier of the webhook.
Body
application/json
Response
Webhook updated successfully
Example:
"Webhook updated successfully"
Was this page helpful?
⌘I