cURL
curl -X POST https://reygrid.com/api/v1/agents/{AgentId}/search \
-H "Authorization: Bearer $REYGRID_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "How do I get a refund?", "limit": 3}'from reygrid import ReyGrid
client = ReyGrid(api_key="YOUR_API_KEY")
for result in client.search("{AgentId}", "How do I get a refund?", limit=3).results:
print(round(result.score, 2), result.source.title)
print(result.content)import { ReyGrid } from "reygrid";
const client = new ReyGrid({ apiKey: "YOUR_API_KEY" });
const { results } = await client.search("{AgentId}", "How do I get a refund?", { limit: 3 });
for (const r of results) console.log(r.score.toFixed(2), r.source.title, r.content);{
"success": true,
"results": [
{
"score": 0.812,
"content": "Orders can be refunded within 30 days of delivery. Refunds go back to the original payment method within 5 business days.",
"source": {
"id": "b7a1e2c4-5d3f-4e8a-9b10-2c4d6e8f0a1b",
"type": "text",
"title": "Refund policy"
}
},
{
"score": 0.564,
"content": "To request a refund, open your order history and select Request refund next to the order.",
"source": {
"id": "661a6da1-181f-43ac-9516-9847b9dd663b",
"type": "file",
"title": "handbook.pdf"
}
}
]
}{
"success": false,
"error": {
"code": "INVALID_BODY",
"message": "Invalid body",
"list": {
"title": [
"Title too short"
]
}
}
}{
"error": "Unauthorized",
"code": "AUTH_REQUIRED"
}{
"success": true,
"error": {
"code": "<string>",
"message": "<string>",
"list": [
{}
]
},
"output": {},
"usage": {
"credits": 123
}
}{
"success": false,
"error": {
"code": "SOURCE_NOT_FOUND",
"message": "This source does not exist"
}
}Search
Search knowledge
Returns the knowledge passages closest to a query, best match first, without generating an answer. Use it to build your own retrieval flows or “related articles”. No model is called: each search costs a flat 0.2 credits.
POST
/
agents
/
{agentId}
/
search
cURL
curl -X POST https://reygrid.com/api/v1/agents/{AgentId}/search \
-H "Authorization: Bearer $REYGRID_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "How do I get a refund?", "limit": 3}'from reygrid import ReyGrid
client = ReyGrid(api_key="YOUR_API_KEY")
for result in client.search("{AgentId}", "How do I get a refund?", limit=3).results:
print(round(result.score, 2), result.source.title)
print(result.content)import { ReyGrid } from "reygrid";
const client = new ReyGrid({ apiKey: "YOUR_API_KEY" });
const { results } = await client.search("{AgentId}", "How do I get a refund?", { limit: 3 });
for (const r of results) console.log(r.score.toFixed(2), r.source.title, r.content);{
"success": true,
"results": [
{
"score": 0.812,
"content": "Orders can be refunded within 30 days of delivery. Refunds go back to the original payment method within 5 business days.",
"source": {
"id": "b7a1e2c4-5d3f-4e8a-9b10-2c4d6e8f0a1b",
"type": "text",
"title": "Refund policy"
}
},
{
"score": 0.564,
"content": "To request a refund, open your order history and select Request refund next to the order.",
"source": {
"id": "661a6da1-181f-43ac-9516-9847b9dd663b",
"type": "file",
"title": "handbook.pdf"
}
}
]
}{
"success": false,
"error": {
"code": "INVALID_BODY",
"message": "Invalid body",
"list": {
"title": [
"Title too short"
]
}
}
}{
"error": "Unauthorized",
"code": "AUTH_REQUIRED"
}{
"success": true,
"error": {
"code": "<string>",
"message": "<string>",
"list": [
{}
]
},
"output": {},
"usage": {
"credits": 123
}
}{
"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