Node.js
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
phone: 'YOUR_PHONE_NUMBER', // e.g., '919876543210'
});
async function createDocument() {
const response = await client.knowledgeBase.createDocument({
document: {
url: 'https://example.com/document.pdf',
filename: 'document.pdf'
}
});
console.log(response);
}
createDocument();curl -X POST \
https://api.periskope.app/v1/knowledge-base/document/create \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER' \
-d '{
"document": {
"url": "https://example.com/document.pdf",
"filename": "document.pdf"
}
}'{
"file_name": "Frank.pdf",
"document_id": "88a010a1-c6ac-4f8f-be15-850bee5372b7",
"file_path": "org-assets/2997dd64-89bf-48d3-9a22-b314fca017e5/ai_assets/documents/88a010a1-c6ac-4f8f-be15-850bee5372b7/Frank.pdf",
"chunks_count": 1
}Knowledge Base APIs
Create Document
Process and create document entries in the knowledge base. The document will be split into chunks for efficient retrieval.
Node.js
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
phone: 'YOUR_PHONE_NUMBER', // e.g., '919876543210'
});
async function createDocument() {
const response = await client.knowledgeBase.createDocument({
document: {
url: 'https://example.com/document.pdf',
filename: 'document.pdf'
}
});
console.log(response);
}
createDocument();curl -X POST \
https://api.periskope.app/v1/knowledge-base/document/create \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER' \
-d '{
"document": {
"url": "https://example.com/document.pdf",
"filename": "document.pdf"
}
}'{
"file_name": "Frank.pdf",
"document_id": "88a010a1-c6ac-4f8f-be15-850bee5372b7",
"file_path": "org-assets/2997dd64-89bf-48d3-9a22-b314fca017e5/ai_assets/documents/88a010a1-c6ac-4f8f-be15-850bee5372b7/Frank.pdf",
"chunks_count": 1
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Array of file URLs to process
Show child attributes
Show child attributes
Example:
{
"url": "https://example.com/document.pdf",
"filename": "document.pdf"
}
Was this page helpful?