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 getAllKnowledgeBase() {
const response = await client.knowledgeBase.getAll({
offset: 0,
limit: 10,
type: 'faq' // optional: filter by 'faq' or 'document'
});
console.log(response);
}
getAllKnowledgeBase();curl -X GET \
'https://api.periskope.app/v1/knowledge-base?offset=0&limit=10&type=faq' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER'{
"data": [
{
"context_id": "ai-context-aaauajhjdgjnomr",
"type": "faq",
"question": "How do I connect WhatsApp?",
"answer": "You can connect WhatsApp by scanning the QR code in Settings.",
"attachments": [],
"embedding": [
-0.020637017,
-0.0148050785,
0.02985098,
0.023778915,
"..."
],
"created_at": "2025-01-20T10:00:00Z",
"updated_at": "2025-01-20T10:00:00Z"
},
{
"document_id": "doc_xyz789",
"type": "document",
"filename": "user-guide.pdf",
"chunks_count": 15,
"created_at": "2025-01-19T15:30:00Z",
"updated_at": "2025-01-19T15:30:00Z"
}
],
"total": 2,
"offset": 0,
"limit": 10
}Knowledge Base APIs
Get All Knowledge Base Items
This endpoint retrieves a paginated list of all knowledge base items (FAQs and Documents)
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 getAllKnowledgeBase() {
const response = await client.knowledgeBase.getAll({
offset: 0,
limit: 10,
type: 'faq' // optional: filter by 'faq' or 'document'
});
console.log(response);
}
getAllKnowledgeBase();curl -X GET \
'https://api.periskope.app/v1/knowledge-base?offset=0&limit=10&type=faq' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER'{
"data": [
{
"context_id": "ai-context-aaauajhjdgjnomr",
"type": "faq",
"question": "How do I connect WhatsApp?",
"answer": "You can connect WhatsApp by scanning the QR code in Settings.",
"attachments": [],
"embedding": [
-0.020637017,
-0.0148050785,
0.02985098,
0.023778915,
"..."
],
"created_at": "2025-01-20T10:00:00Z",
"updated_at": "2025-01-20T10:00:00Z"
},
{
"document_id": "doc_xyz789",
"type": "document",
"filename": "user-guide.pdf",
"chunks_count": 15,
"created_at": "2025-01-19T15:30:00Z",
"updated_at": "2025-01-19T15:30:00Z"
}
],
"total": 2,
"offset": 0,
"limit": 10
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
- The offset value for paginating the results
- Default 0
Example:
"0"
- The maximum number of items to retrieve
- Default 100
Example:
"10"
- Optional filter by type: 'faq' or 'document'
- If not provided, returns all types
Example:
"faq"
Was this page helpful?