cURL
curl -X POST https://reygrid.com/api/v1/agents/{AgentId}/sources/text \
-H "Authorization: Bearer $REYGRID_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Refund policy",
"content": "Orders can be refunded within 30 days of delivery."
}'from reygrid import ReyGrid
client = ReyGrid(api_key="YOUR_API_KEY")
source = client.add_text_source(
"{AgentId}",
"Refund policy",
"Orders can be refunded within 30 days of delivery.",
).source
print(source.id)import { ReyGrid } from "reygrid";
const client = new ReyGrid({ apiKey: "YOUR_API_KEY" });
const { source } = await client.addTextSource("{AgentId}", {
title: "Refund policy",
content: "Orders can be refunded within 30 days of delivery.",
});
console.log(source.id);{
"success": true,
"source": {
"id": "b7a1e2c4-5d3f-4e8a-9b10-2c4d6e8f0a1b",
"type": "text",
"title": "Refund policy"
}
}{
"success": false,
"error": {
"code": "INVALID_BODY",
"message": "Invalid body",
"list": {
"title": [
"Title too short"
]
}
}
}{
"error": "Unauthorized",
"code": "AUTH_REQUIRED"
}{
"success": false,
"error": {
"code": "PLAN_LIMIT_REACHED",
"message": "You need to upgrade your plan"
}
}{
"success": false,
"error": {
"code": "SOURCE_NOT_FOUND",
"message": "This source does not exist"
}
}Knowledge
Add a text source
Adds a titled piece of text to the agent’s knowledge.
POST
/
agents
/
{agentId}
/
sources
/
text
cURL
curl -X POST https://reygrid.com/api/v1/agents/{AgentId}/sources/text \
-H "Authorization: Bearer $REYGRID_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Refund policy",
"content": "Orders can be refunded within 30 days of delivery."
}'from reygrid import ReyGrid
client = ReyGrid(api_key="YOUR_API_KEY")
source = client.add_text_source(
"{AgentId}",
"Refund policy",
"Orders can be refunded within 30 days of delivery.",
).source
print(source.id)import { ReyGrid } from "reygrid";
const client = new ReyGrid({ apiKey: "YOUR_API_KEY" });
const { source } = await client.addTextSource("{AgentId}", {
title: "Refund policy",
content: "Orders can be refunded within 30 days of delivery.",
});
console.log(source.id);{
"success": true,
"source": {
"id": "b7a1e2c4-5d3f-4e8a-9b10-2c4d6e8f0a1b",
"type": "text",
"title": "Refund policy"
}
}{
"success": false,
"error": {
"code": "INVALID_BODY",
"message": "Invalid body",
"list": {
"title": [
"Title too short"
]
}
}
}{
"error": "Unauthorized",
"code": "AUTH_REQUIRED"
}{
"success": false,
"error": {
"code": "PLAN_LIMIT_REACHED",
"message": "You need to upgrade your plan"
}
}{
"success": false,
"error": {
"code": "SOURCE_NOT_FOUND",
"message": "This source does not exist"
}
}Authorizations
ReyGrid API key sent as a Bearer token.
Path Parameters
The ID of the agent.
Body
application/json