Javascript
const url = 'https://studyfetchapi.com/api/v1/materials/search'; const options = { method: 'POST', headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'}, body: '{"query":"What is photosynthesis?","topK":5,"materialIds":["<string>"],"folderIds":["<string>"]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); }
{ "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>" ] } }
API Key for authentication
Search query
"What is photosynthesis?"
Number of results to return
Limit search to specific material IDs
Limit search to materials within specific folders (includes subfolders)
Search completed successfully
Original search query
Search results
Show child attributes
Total number of results
Whether results were filtered by scope
Search scope
Was this page helpful?