Search Context
curl --request POST \
--url https://agentos.useparagon.com/api/context/projects/{projectId}/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "q2 roadmap",
"topK": 10,
"segmentsPerRecord": 1,
"sources": [
"googledrive"
],
"identity": "user@example.com"
}
'import requests
url = "https://agentos.useparagon.com/api/context/projects/{projectId}/search"
payload = {
"query": "q2 roadmap",
"topK": 10,
"segmentsPerRecord": 1,
"sources": ["googledrive"],
"identity": "user@example.com"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: 'q2 roadmap',
topK: 10,
segmentsPerRecord: 1,
sources: ['googledrive'],
identity: 'user@example.com'
})
};
fetch('https://agentos.useparagon.com/api/context/projects/{projectId}/search', 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://agentos.useparagon.com/api/context/projects/{projectId}/search",
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([
'query' => 'q2 roadmap',
'topK' => 10,
'segmentsPerRecord' => 1,
'sources' => [
'googledrive'
],
'identity' => 'user@example.com'
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://agentos.useparagon.com/api/context/projects/{projectId}/search"
payload := strings.NewReader("{\n \"query\": \"q2 roadmap\",\n \"topK\": 10,\n \"segmentsPerRecord\": 1,\n \"sources\": [\n \"googledrive\"\n ],\n \"identity\": \"user@example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://agentos.useparagon.com/api/context/projects/{projectId}/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"q2 roadmap\",\n \"topK\": 10,\n \"segmentsPerRecord\": 1,\n \"sources\": [\n \"googledrive\"\n ],\n \"identity\": \"user@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agentos.useparagon.com/api/context/projects/{projectId}/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"q2 roadmap\",\n \"topK\": 10,\n \"segmentsPerRecord\": 1,\n \"sources\": [\n \"googledrive\"\n ],\n \"identity\": \"user@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"id": "6f1c0b2e-1a2b-4c3d-8e9f-0a1b2c3d4e5f.rec_1",
"syncId": "6f1c0b2e-1a2b-4c3d-8e9f-0a1b2c3d4e5f",
"source": "googledrive",
"relevancy": 1,
"rerankScore": 0.82,
"generation": 3,
"displayName": "Q2 roadmap",
"segments": [
{
"pointer": "chk_anchor",
"chunkId": "chk_anchor",
"text": "The Q2 roadmap covers launch dates.",
"relevancy": 1,
"rerankScore": 0.82
}
]
}
],
"usage": {
"returned": 1,
"segmentsReturned": 1,
"generation": 3,
"retrievalMode": "hybrid",
"rerankOutcome": "applied",
"dropped": {
"segmentsBeyondPoolCap": 0,
"segmentsUnjoinable": 0,
"segmentsNotSearchable": 0,
"recordsBeyondTopK": 0
},
"permissionFiltered": true,
"identities": {
"applied": {
"googledrive": [
"user@example.com"
]
},
"unused": []
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"hint": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterMs": 123,
"details": [
{
"field": "<string>",
"issue": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"hint": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterMs": 123,
"details": [
{
"field": "<string>",
"issue": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"hint": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterMs": 123,
"details": [
{
"field": "<string>",
"issue": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"hint": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterMs": 123,
"details": [
{
"field": "<string>",
"issue": "<string>"
}
]
}
}Context
Search Context
Search your users’ synced content and return the best matching passages.
POST
/
api
/
context
/
projects
/
{projectId}
/
search
Search Context
curl --request POST \
--url https://agentos.useparagon.com/api/context/projects/{projectId}/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "q2 roadmap",
"topK": 10,
"segmentsPerRecord": 1,
"sources": [
"googledrive"
],
"identity": "user@example.com"
}
'import requests
url = "https://agentos.useparagon.com/api/context/projects/{projectId}/search"
payload = {
"query": "q2 roadmap",
"topK": 10,
"segmentsPerRecord": 1,
"sources": ["googledrive"],
"identity": "user@example.com"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: 'q2 roadmap',
topK: 10,
segmentsPerRecord: 1,
sources: ['googledrive'],
identity: 'user@example.com'
})
};
fetch('https://agentos.useparagon.com/api/context/projects/{projectId}/search', 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://agentos.useparagon.com/api/context/projects/{projectId}/search",
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([
'query' => 'q2 roadmap',
'topK' => 10,
'segmentsPerRecord' => 1,
'sources' => [
'googledrive'
],
'identity' => 'user@example.com'
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://agentos.useparagon.com/api/context/projects/{projectId}/search"
payload := strings.NewReader("{\n \"query\": \"q2 roadmap\",\n \"topK\": 10,\n \"segmentsPerRecord\": 1,\n \"sources\": [\n \"googledrive\"\n ],\n \"identity\": \"user@example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://agentos.useparagon.com/api/context/projects/{projectId}/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"q2 roadmap\",\n \"topK\": 10,\n \"segmentsPerRecord\": 1,\n \"sources\": [\n \"googledrive\"\n ],\n \"identity\": \"user@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agentos.useparagon.com/api/context/projects/{projectId}/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"q2 roadmap\",\n \"topK\": 10,\n \"segmentsPerRecord\": 1,\n \"sources\": [\n \"googledrive\"\n ],\n \"identity\": \"user@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"id": "6f1c0b2e-1a2b-4c3d-8e9f-0a1b2c3d4e5f.rec_1",
"syncId": "6f1c0b2e-1a2b-4c3d-8e9f-0a1b2c3d4e5f",
"source": "googledrive",
"relevancy": 1,
"rerankScore": 0.82,
"generation": 3,
"displayName": "Q2 roadmap",
"segments": [
{
"pointer": "chk_anchor",
"chunkId": "chk_anchor",
"text": "The Q2 roadmap covers launch dates.",
"relevancy": 1,
"rerankScore": 0.82
}
]
}
],
"usage": {
"returned": 1,
"segmentsReturned": 1,
"generation": 3,
"retrievalMode": "hybrid",
"rerankOutcome": "applied",
"dropped": {
"segmentsBeyondPoolCap": 0,
"segmentsUnjoinable": 0,
"segmentsNotSearchable": 0,
"recordsBeyondTopK": 0
},
"permissionFiltered": true,
"identities": {
"applied": {
"googledrive": [
"user@example.com"
]
},
"unused": []
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"hint": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterMs": 123,
"details": [
{
"field": "<string>",
"issue": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"hint": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterMs": 123,
"details": [
{
"field": "<string>",
"issue": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"hint": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterMs": 123,
"details": [
{
"field": "<string>",
"issue": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"hint": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterMs": 123,
"details": [
{
"field": "<string>",
"issue": "<string>"
}
]
}
}Search returns up to
topK records (default 10, maximum 50). Each record includes up to segmentsPerRecord matching passages (default 1, maximum 5).
Results are ordered by relevancy, a rank-based score for ordering results within a single response. Don’t compare relevancy values across different requests. When reranking is applied, rerankScore holds the reranker’s score for that passage. Otherwise it is null.
To read more of the text around a passage, pass its pointer to Read Segment Context.
const response = await fetch(
`https://agentos.useparagon.com/api/context/projects/${projectId}/search`,
{
method: "POST",
headers: {
Authorization: `Bearer ${paragonUserToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: "q2 roadmap",
topK: 10,
segmentsPerRecord: 1,
identity: "user@example.com",
}),
},
);
Authorizations
Your Paragon User Token (JWT), which you can generate using your project's signing keys.
Path Parameters
Body
application/json