curl --request POST \
--url https://ds.cominty.com/memory \
--header 'Content-Type: application/json' \
--header 'x-cominty-token: <api-key>' \
--data '
{
"path": "<string>",
"purpose": "<string>",
"content": "<string>",
"namespace": "<string>"
}
'import requests
url = "https://ds.cominty.com/memory"
payload = {
"path": "<string>",
"purpose": "<string>",
"content": "<string>",
"namespace": "<string>"
}
headers = {
"x-cominty-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-cominty-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
path: '<string>',
purpose: '<string>',
content: '<string>',
namespace: '<string>'
})
};
fetch('https://ds.cominty.com/memory', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://ds.cominty.com/memory",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'path' => '<string>',
'purpose' => '<string>',
'content' => '<string>',
'namespace' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-cominty-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://ds.cominty.com/memory"
payload := strings.NewReader("{\n \"path\": \"<string>\",\n \"purpose\": \"<string>\",\n \"content\": \"<string>\",\n \"namespace\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-cominty-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://ds.cominty.com/memory")
.header("x-cominty-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"path\": \"<string>\",\n \"purpose\": \"<string>\",\n \"content\": \"<string>\",\n \"namespace\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ds.cominty.com/memory")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-cominty-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"path\": \"<string>\",\n \"purpose\": \"<string>\",\n \"content\": \"<string>\",\n \"namespace\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"path": "<string>",
"purpose": "<string>",
"namespace": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"content": "<string>",
"version": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Create a memory file
Create a file in a namespace. With an API token, namespace is required and omitting it returns 400 Missing namespace. path, purpose, and content are required. path has at most one folder segment. content may be empty. Creating a path that already exists in that namespace returns 409.
curl --request POST \
--url https://ds.cominty.com/memory \
--header 'Content-Type: application/json' \
--header 'x-cominty-token: <api-key>' \
--data '
{
"path": "<string>",
"purpose": "<string>",
"content": "<string>",
"namespace": "<string>"
}
'import requests
url = "https://ds.cominty.com/memory"
payload = {
"path": "<string>",
"purpose": "<string>",
"content": "<string>",
"namespace": "<string>"
}
headers = {
"x-cominty-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-cominty-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
path: '<string>',
purpose: '<string>',
content: '<string>',
namespace: '<string>'
})
};
fetch('https://ds.cominty.com/memory', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://ds.cominty.com/memory",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'path' => '<string>',
'purpose' => '<string>',
'content' => '<string>',
'namespace' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-cominty-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://ds.cominty.com/memory"
payload := strings.NewReader("{\n \"path\": \"<string>\",\n \"purpose\": \"<string>\",\n \"content\": \"<string>\",\n \"namespace\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-cominty-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://ds.cominty.com/memory")
.header("x-cominty-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"path\": \"<string>\",\n \"purpose\": \"<string>\",\n \"content\": \"<string>\",\n \"namespace\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ds.cominty.com/memory")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-cominty-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"path\": \"<string>\",\n \"purpose\": \"<string>\",\n \"content\": \"<string>\",\n \"namespace\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"path": "<string>",
"purpose": "<string>",
"namespace": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"content": "<string>",
"version": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
A Cominty Platform API secret. A key created now starts with sk-cmt-. Send it as is, or as Bearer sk-cmt-..., with at most one Bearer prefix. A key created before the prefix existed has no sk-cmt- and still works.
Query Parameters
Optional. Does not select the memory namespace. The namespace belongs in the JSON body.
Body
Relative path with at most one folder segment, for example notes/todo.md.
Short description of why the file exists. The agent reads it.
File body. An empty string is allowed.
Namespace the file belongs to. Required for an API token. At most 128 characters.
128Response
Successful Response
Path as stored.
Why the file exists.
Namespace the file belongs to.
When the file was created.
When the file was last updated.
File body. May be empty.
Opaque version identifier; echo back as version when updating.