import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
});
async function main() {
const response = await client.knowledgeBase.createDocument({
document: {
url: 'https://example.com/files/product-faq.pdf',
},
});
console.log(response);
}
main();curl -X POST 'https://api.periskope.app/v1/knowledge-base/document/create' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"document": {
"url": "https://example.com/files/product-faq.pdf"
}
}'[
{
"file_name": "product-faq.pdf",
"document_id": "00000000-0000-0000-0000-000000000000",
"file_path": "org-assets/00000000-0000-0000-0000-000000000000/ai_assets/documents/00000000-0000-0000-0000-000000000000/product-faq.pdf",
"chunks_count": 12
}
]{
"code": "ERROR",
"message": "Invalid document input — an invalid or unreachable URL, a file that is not a valid PDF, or a PDF larger than 50 MB",
"status": 400
}{
"code": "UNAUTHORIZED_ERROR",
"message": "Invalid bearer auth token",
"status": 401
}{
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"status": 422,
"fields": {
"body.chat_id": {
"message": "chat_id is required"
}
}
}{
"code": "RATE_LIMIT_ERROR",
"message": "You can only make 100 requests per second",
"status": 429
}{
"code": "UNKNOWN_ERROR",
"message": "Internal server error",
"status": 500
}Create Document
Ingests a PDF into the AI knowledge base. Provide the document as exactly one of document.url, document.base64 or document.file.
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
});
async function main() {
const response = await client.knowledgeBase.createDocument({
document: {
url: 'https://example.com/files/product-faq.pdf',
},
});
console.log(response);
}
main();curl -X POST 'https://api.periskope.app/v1/knowledge-base/document/create' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"document": {
"url": "https://example.com/files/product-faq.pdf"
}
}'[
{
"file_name": "product-faq.pdf",
"document_id": "00000000-0000-0000-0000-000000000000",
"file_path": "org-assets/00000000-0000-0000-0000-000000000000/ai_assets/documents/00000000-0000-0000-0000-000000000000/product-faq.pdf",
"chunks_count": 12
}
]{
"code": "ERROR",
"message": "Invalid document input — an invalid or unreachable URL, a file that is not a valid PDF, or a PDF larger than 50 MB",
"status": 400
}{
"code": "UNAUTHORIZED_ERROR",
"message": "Invalid bearer auth token",
"status": 401
}{
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"status": 422,
"fields": {
"body.chat_id": {
"message": "chat_id is required"
}
}
}{
"code": "RATE_LIMIT_ERROR",
"message": "You can only make 100 requests per second",
"status": 429
}{
"code": "UNKNOWN_ERROR",
"message": "Internal server error",
"status": 500
}Authorizations
Your Periskope API token, sent as Authorization: Bearer <token>. Generate one from the Periskope dashboard under Settings → API & Webhooks. API access requires an active Pro or Enterprise plan.
Body
The PDF document to ingest. Must contain exactly one content source (url, base64 or file) and may include a filename.
Show child attributes
Show child attributes
Whether the document chunks are active immediately. Defaults to false — the entries stay inactive until approved.
false
Response
The processing result for the uploaded document
Filename the document was stored under
"product-faq.pdf"
Id assigned to the uploaded document. Use it with the GET/DELETE /knowledge-base/document/{document_id} routes to fetch or delete the document and its chunks.
"00000000-0000-0000-0000-000000000000"
Storage path of the uploaded PDF in the org assets bucket
"org-assets/00000000-0000-0000-0000-000000000000/ai_assets/documents/00000000-0000-0000-0000-000000000000/product-faq.pdf"
Number of knowledge-base entries (chunks) extracted from the document
12
Was this page helpful?