Search for materials
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: 'What is photosynthesis?',
topK: 5,
materialIds: ['<string>'],
folderIds: ['<string>']
})
};
fetch('https://studyfetchapi.com/api/v1/materials/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://studyfetchapi.com/api/v1/materials/search \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"query": "What is photosynthesis?",
"topK": 5,
"materialIds": [
"<string>"
],
"folderIds": [
"<string>"
]
}
'import requests
url = "https://studyfetchapi.com/api/v1/materials/search"
payload = {
"query": "What is photosynthesis?",
"topK": 5,
"materialIds": ["<string>"],
"folderIds": ["<string>"]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"query": "<string>",
"results": [
{
"score": 123,
"text": "<string>",
"chunkIndex": 123,
"material": {
"id": "<string>",
"name": "<string>",
"contentType": "<string>"
}
}
],
"totalResults": 123,
"filtered": true,
"scope": {
"materialIds": [
"<string>"
],
"folderIds": [
"<string>"
]
}
}Materials
Search for materials
POST
/
api
/
v1
/
materials
/
search
Search for materials
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: 'What is photosynthesis?',
topK: 5,
materialIds: ['<string>'],
folderIds: ['<string>']
})
};
fetch('https://studyfetchapi.com/api/v1/materials/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://studyfetchapi.com/api/v1/materials/search \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"query": "What is photosynthesis?",
"topK": 5,
"materialIds": [
"<string>"
],
"folderIds": [
"<string>"
]
}
'import requests
url = "https://studyfetchapi.com/api/v1/materials/search"
payload = {
"query": "What is photosynthesis?",
"topK": 5,
"materialIds": ["<string>"],
"folderIds": ["<string>"]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"query": "<string>",
"results": [
{
"score": 123,
"text": "<string>",
"chunkIndex": 123,
"material": {
"id": "<string>",
"name": "<string>",
"contentType": "<string>"
}
}
],
"totalResults": 123,
"filtered": true,
"scope": {
"materialIds": [
"<string>"
],
"folderIds": [
"<string>"
]
}
}Authorizations
API Key for server-to-server authentication. Resolves to the owning organization.
Body
application/json
Response
Search completed successfully
Was this page helpful?