import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
});
async function main() {
const response = await client.knowledgeBase.createFaq({
question: 'What is Periskope?',
answer: 'Periskope is a platform to manage WhatsApp at scale.',
});
console.log(response);
}
main();curl -X POST 'https://api.periskope.app/v1/knowledge-base/faq/create' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"question": "What is Periskope?",
"answer": "Periskope is a platform to manage WhatsApp at scale."
}'{
"context_id": "00000000-0000-0000-0000-000000000000",
"org_id": "00000000-0000-0000-0000-000000000000",
"question": "What is Periskope?",
"answer": "Periskope is a platform to manage WhatsApp at scale.",
"type": "faq",
"embedding": "[-0.0123,0.0456,0.0789,...]",
"attachments": [
{
"link": {
"url": "org-assets/00000000-0000-0000-0000-000000000000/ai_assets/00000000-0000-0000-0000-000000000000/pricing.pdf",
"type": "application/pdf",
"name": "pricing.pdf"
}
}
],
"avg_rating": null,
"document_id": "00000000-0000-0000-0000-000000000000",
"is_active": true,
"metadata": {
"fileName": "product-faq.pdf",
"chunkIndex": 1,
"tokenCount": 180,
"source": "qa"
},
"tags": null,
"created_at": "2026-01-15T09:30:00.000Z",
"updated_at": "2026-01-15T09:30:00.000Z"
}{
"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 FAQ
Creates an FAQ — a question/answer pair the AI agent learns to answer from. Its embedding is generated automatically. The entry starts inactive unless is_active is sent as true.
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
});
async function main() {
const response = await client.knowledgeBase.createFaq({
question: 'What is Periskope?',
answer: 'Periskope is a platform to manage WhatsApp at scale.',
});
console.log(response);
}
main();curl -X POST 'https://api.periskope.app/v1/knowledge-base/faq/create' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"question": "What is Periskope?",
"answer": "Periskope is a platform to manage WhatsApp at scale."
}'{
"context_id": "00000000-0000-0000-0000-000000000000",
"org_id": "00000000-0000-0000-0000-000000000000",
"question": "What is Periskope?",
"answer": "Periskope is a platform to manage WhatsApp at scale.",
"type": "faq",
"embedding": "[-0.0123,0.0456,0.0789,...]",
"attachments": [
{
"link": {
"url": "org-assets/00000000-0000-0000-0000-000000000000/ai_assets/00000000-0000-0000-0000-000000000000/pricing.pdf",
"type": "application/pdf",
"name": "pricing.pdf"
}
}
],
"avg_rating": null,
"document_id": "00000000-0000-0000-0000-000000000000",
"is_active": true,
"metadata": {
"fileName": "product-faq.pdf",
"chunkIndex": 1,
"tokenCount": 180,
"source": "qa"
},
"tags": null,
"created_at": "2026-01-15T09:30:00.000Z",
"updated_at": "2026-01-15T09:30:00.000Z"
}{
"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 question the AI agent should learn the answer to
1"What is Periskope?"
The answer to the question
1"Periskope is a platform to manage WhatsApp at scale."
A single attachment to store with the FAQ. Requires filename plus exactly one content source: file, url or base64.
Show child attributes
Show child attributes
Whether the FAQ is active immediately. Defaults to false — the entry stays inactive until approved.
false
Response
The created FAQ entry
An entry in the AI knowledge base — the content the AI agent draws on when answering queries. An entry is either an FAQ (a question/answer pair), one chunk of an uploaded PDF document, or a self-learned entry captured automatically from conversations.
Unique id of the knowledge-base entry. For FAQs, this is the id to use with the GET/PATCH/DELETE /knowledge-base/faq/{context_id} routes. Each chunk of an uploaded document has its own context_id.
"00000000-0000-0000-0000-000000000000"
Id of the organization the entry belongs to
"00000000-0000-0000-0000-000000000000"
The question the entry answers. For document chunks this is a derived heading — the document title plus the detected section or question (e.g. "product-faq — Pricing").
"What is Periskope?"
The answer text the AI agent draws on. For document chunks, the extracted text of the chunk.
"Periskope is a platform to manage WhatsApp at scale."
Kind of entry: 'faq' for question/answer pairs created via the API or dashboard, 'document' for chunks extracted from uploaded PDF documents, 'self-learned' for entries the AI agent captured automatically from conversations.
faq, document, self-learned "faq"
Vector embedding of the entry, serialized as a string. Used internally for semantic retrieval — safe to ignore.
"[-0.0123,0.0456,0.0789,...]"
Attachments stored on the entry — for FAQs created with an attachment, an array of { link: { url, type, name } } objects pointing at the stored file. null or an empty array when the entry has no attachments.
[
{
"link": {
"url": "org-assets/00000000-0000-0000-0000-000000000000/ai_assets/00000000-0000-0000-0000-000000000000/pricing.pdf",
"type": "application/pdf",
"name": "pricing.pdf"
}
}
]
Average rating of AI answers generated from this entry. null when the entry has not been rated.
null
Id of the uploaded document a chunk belongs to — use it with the GET/DELETE /knowledge-base/document/{document_id} routes. null for FAQs and self-learned entries.
"00000000-0000-0000-0000-000000000000"
Whether the entry is currently used by the AI agent when answering. Entries created via the API start inactive unless is_active is sent as true.
true
Extra metadata about the entry. For document chunks: fileName, filePath, chunkIndex, tokenCount and the extraction source ('qa' for detected Q&A pairs, 'paragraph' for paragraph blocks, 'text' for sentence windows). null for FAQs.
{
"fileName": "product-faq.pdf",
"chunkIndex": 1,
"tokenCount": 180,
"source": "qa"
}
Tags assigned to the entry. null when untagged.
null
When the entry was created, as an ISO 8601 timestamp
"2026-01-15T09:30:00.000Z"
When the entry was last updated, as an ISO 8601 timestamp. null when never updated.
"2026-01-15T09:30:00.000Z"
Was this page helpful?