JavaScript
import Cerca from '@cerca-dev/sdk';
const client = new Cerca({
apiKey: process.env['CERCA_API_KEY'], // This is the default and can be omitted
});
const entry = await client.context.write('agent_abc123', { content: 'content', key: 'key' });
console.log(entry.content);import os
from cerca import Cerca
client = Cerca(
api_key=os.environ.get("CERCA_API_KEY"), # This is the default and can be omitted
)
entry = client.context.write(
agent_id="agent_abc123",
content="content",
key="key",
)
print(entry.content)package main
import (
"context"
"fmt"
"github.com/matrices/cerca-go"
"github.com/matrices/cerca-go/option"
)
func main() {
client := cercago.NewClient(
option.WithAPIKey("My API Key"),
)
entry, err := client.Context.Write(
context.TODO(),
"agent_abc123",
cercago.ContextWriteParams{
Content: cercago.F("content"),
Key: cercago.F("key"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", entry.Content)
}require "cerca"
cerca = Cerca::Client.new(api_key: "My API Key")
entry = cerca.context.write("agent_abc123", content: "content", key: "key")
puts(entry)cerca context write \
--api-key 'My API Key' \
--agent-id agent_abc123 \
--content content \
--key keycurl --request PUT \
--url https://api.cerca.dev/agents/{agentId}/context/entry \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "<string>",
"key": "<string>",
"expectedVersion": 123,
"mimeType": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/agents/{agentId}/context/entry",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'content' => '<string>',
'key' => '<string>',
'expectedVersion' => 123,
'mimeType' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.put("https://api.cerca.dev/agents/{agentId}/context/entry")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"<string>\",\n \"key\": \"<string>\",\n \"expectedVersion\": 123,\n \"mimeType\": \"<string>\"\n}")
.asString();{
"content": "<string>",
"key": "<string>",
"updatedAt": "<string>",
"version": 123,
"mimeType": "<string>"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}Context
Update context entry
PUT
/
agents
/
{agentId}
/
context
/
entry
JavaScript
import Cerca from '@cerca-dev/sdk';
const client = new Cerca({
apiKey: process.env['CERCA_API_KEY'], // This is the default and can be omitted
});
const entry = await client.context.write('agent_abc123', { content: 'content', key: 'key' });
console.log(entry.content);import os
from cerca import Cerca
client = Cerca(
api_key=os.environ.get("CERCA_API_KEY"), # This is the default and can be omitted
)
entry = client.context.write(
agent_id="agent_abc123",
content="content",
key="key",
)
print(entry.content)package main
import (
"context"
"fmt"
"github.com/matrices/cerca-go"
"github.com/matrices/cerca-go/option"
)
func main() {
client := cercago.NewClient(
option.WithAPIKey("My API Key"),
)
entry, err := client.Context.Write(
context.TODO(),
"agent_abc123",
cercago.ContextWriteParams{
Content: cercago.F("content"),
Key: cercago.F("key"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", entry.Content)
}require "cerca"
cerca = Cerca::Client.new(api_key: "My API Key")
entry = cerca.context.write("agent_abc123", content: "content", key: "key")
puts(entry)cerca context write \
--api-key 'My API Key' \
--agent-id agent_abc123 \
--content content \
--key keycurl --request PUT \
--url https://api.cerca.dev/agents/{agentId}/context/entry \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "<string>",
"key": "<string>",
"expectedVersion": 123,
"mimeType": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cerca.dev/agents/{agentId}/context/entry",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'content' => '<string>',
'key' => '<string>',
'expectedVersion' => 123,
'mimeType' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.put("https://api.cerca.dev/agents/{agentId}/context/entry")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"<string>\",\n \"key\": \"<string>\",\n \"expectedVersion\": 123,\n \"mimeType\": \"<string>\"\n}")
.asString();{
"content": "<string>",
"key": "<string>",
"updatedAt": "<string>",
"version": 123,
"mimeType": "<string>"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}{
"error": "<string>",
"code": "MONTHLY_TOKEN_BUDGET_EXCEEDED"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Minimum string length:
1Example:
"agent_abc123"
Body
application/json
⌘I