TypeScript
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
}Knowledge Base APIs
Create Document
Ingests a PDF into the AI knowledge base. Provide the document as exactly one of document.url, document.base64 or document.file.
TypeScript
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
Body
application/json
Response
The processing result for the uploaded document
Was this page helpful?