import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
phone: 'YOUR_PHONE_NUMBER', // e.g., '919876543210'
});
async function getDocumentById() {
const response = await client.knowledgeBase.getDocumentById({
document_id: 'doc_xyz789'
});
console.log(response);
}
getDocumentById();{
"context_id": "ai-context-xzmejkslwqesqko",
"org_id": "2997dd64-89bf-48d3-9a22-b314fca017e5",
"question": "Document: Frank.pdf - Chunk 1",
"answer": "Sample PDF\nThis is a simple PDF file. Fun fun fun.\nLorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus facilisis odio sed mi. \nCurabitur suscipit. Nullam vel nisi. Etiam semper ipsum ut lectus. Proin aliquam, erat eget \npharetra commodo, ",
"embedding": "[0.007811843,0.023783164,0.029483568,-0.051515117,...]",
"created_at": "2025-11-05T16:30:53.671369",
"attachments": null,
"metadata": {
"fileName": "Frank.pdf",
"filePath": "org-assets/2997dd64-89bf-48d3-9a22-b314fca017e5/ai_assets/documents/88a010a1-c6ac-4f8f-be15-850bee5372b7/Frank.pdf",
"tokenCount": 416
},
"type": "document",
"document_id": "88a010a1-c6ac-4f8f-be15-850bee5372b7"
}Get a single document by document_id
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
phone: 'YOUR_PHONE_NUMBER', // e.g., '919876543210'
});
async function getDocumentById() {
const response = await client.knowledgeBase.getDocumentById({
document_id: 'doc_xyz789'
});
console.log(response);
}
getDocumentById();{
"context_id": "ai-context-xzmejkslwqesqko",
"org_id": "2997dd64-89bf-48d3-9a22-b314fca017e5",
"question": "Document: Frank.pdf - Chunk 1",
"answer": "Sample PDF\nThis is a simple PDF file. Fun fun fun.\nLorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus facilisis odio sed mi. \nCurabitur suscipit. Nullam vel nisi. Etiam semper ipsum ut lectus. Proin aliquam, erat eget \npharetra commodo, ",
"embedding": "[0.007811843,0.023783164,0.029483568,-0.051515117,...]",
"created_at": "2025-11-05T16:30:53.671369",
"attachments": null,
"metadata": {
"fileName": "Frank.pdf",
"filePath": "org-assets/2997dd64-89bf-48d3-9a22-b314fca017e5/ai_assets/documents/88a010a1-c6ac-4f8f-be15-850bee5372b7/Frank.pdf",
"tokenCount": 416
},
"type": "document",
"document_id": "88a010a1-c6ac-4f8f-be15-850bee5372b7"
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The document ID to retrieve
"doc_xyz789"
200 OK
The unique identifier for this document
Type of entry (document)
Question of the document
Answer of the document
Attachments of the document
Metadata of the document
Embedding of the document
Creation timestamp
Was this page helpful?