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 createDocument() {
  const response = await client.knowledgeBase.createDocument({
    document: {
      url: 'https://example.com/document.pdf',
      filename: 'document.pdf'
    }
  });

  console.log(response);
}

createDocument();
{
  "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

Authorization
string
header
required

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

Body

application/json
document
object
required

Array of file URLs to process

Example:
{
"url": "https://example.com/document.pdf",
"filename": "document.pdf"
}

Response

201 Created

file_name
string

The filename of the document

document_id
string

The ID of the document

file_path
string

The path of the document

chunks_count
number

The number of chunks created for the document