Update Project - Mem0

Documentation Index

Fetch the complete documentation index at: /llms.txt

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

Usage Examples

Python

# To use the Python SDK, install the package:
# pip install mem0ai

from mem0 import MemoryClient

client = MemoryClient(api_key="your_api_key")

new_categories = [
    {"cooking": "For users interested in cooking and culinary experiences"},
    {"fitness": "Includes content related to fitness and workouts"}
]

response = client.update_project(custom_categories=new_categories)
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" });

const newCategories = [
    {"cooking": "For users interested in cooking and culinary experiences"},
    {"fitness": "Includes content related to fitness and workouts"}
];

client.updateProject({ custom_categories: newCategories })
  .then(response => console.log(response))
  .catch(err => console.error(err));

CURL

curl --request PATCH \
  --url https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/ \
  --header 'Authorization: Token <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "custom_categories": [
      {"cooking": "For users interested in cooking and culinary experiences"},
      {"fitness": "Includes content related to fitness and workouts"}
    ]
  }'

Go

// To use the Go SDK, install the package:
// go get github.com/mem0ai/mem0-go

package main

import (
    "fmt"
    "github.com/mem0ai/mem0-go"
)

func main() {
    client := mem0.NewClient("your-api-key")

newCategories := []map[string]string{
        {"cooking": "For users interested in cooking and culinary experiences"},
        {"fitness": "Includes content related to fitness and workouts"},
    }

response, err := client.UpdateProject(mem0.UpdateProjectParams{
        CustomCategories: newCategories,
    })
    if err != nil {
        fmt.Printf("Error: %v\n", err)
        return
    }
    fmt.Printf("%+v\n", response)
}

PHP

<?php
// To use the PHP SDK, install the package:
// composer require mem0ai/mem0-php

require_once('vendor/autoload.php');

use Mem0MemoryClient;

$client = new MemoryClient('your-api-key');

$newCategories = [
    ['cooking' => 'For users interested in cooking and culinary experiences'],
    ['fitness' => 'Includes content related to fitness and workouts']
];

try {
    $response = $client->updateProject(['custom_categories' => $newCategories]);
    print_r($response);
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}
?>

Java

// To use the Java SDK, add this dependency to your pom.xml:
// <dependency>
//     <groupId>ai.mem0</groupId>
//     <artifactId>mem0-java</artifactId>
//     <version>1.0.0</version>
// </dependency>

import ai.mem0.MemoryClient;
import java.util.*;

public class Example {
    public static void main(String[] args) {
        MemoryClient client = new MemoryClient("your-api-key");

List<Map<String, String>> newCategories = Arrays.asList(
            Collections.singletonMap("cooking", "For users interested in cooking and culinary experiences"),
            Collections.singletonMap("fitness", "Includes content related to fitness and workouts")
        );

try {
            Map<String, Object> params = new HashMap<>();
            params.put("custom_categories", newCategories);

Object response = client.updateProject(params);
            System.out.println(response);
        } catch (Exception e) {
            System.err.println("Error: " + e.getMessage());
        }
    }
}

Ruby

require 'uri'
require 'net/http'

url = URI("https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/projects/{project_id}/")

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"<string>\",\n  \"description\": \"<string>\",\n  \"custom_instructions\": [\n    \"<string>\"\n  ],\n  \"custom_categories\": [\n    {}\n  ],\n  \"multilingual\": true\n}";

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

Response Codes

{
  "message": "Project updated successfully"
}
{
  "message": "Organization or project not found"
}

Authorizations

Path Parameters

Body Parameters