Skip to main content
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 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"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

document_id
string
required

The document ID to retrieve

Example:

"doc_xyz789"

Response

200 OK

document_id
string

The unique identifier for this document

type
string

Type of entry (document)

question
string

Question of the document

answer
string

Answer of the document

attachments
string[]

Attachments of the document

metadata
object

Metadata of the document

embedding
number[]

Embedding of the document

created_at
string

Creation timestamp