import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
});
async function main() {
const response = await client.knowledgeBase.updateFaq({
context_id: '00000000-0000-0000-0000-000000000000',
question: 'What is Periskope?',
});
console.log(response);
}
main();curl -X PATCH 'https://api.periskope.app/v1/knowledge-base/faq/00000000-0000-0000-0000-000000000000' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"question": "What is Periskope?"
}'[
{
"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": "NOT_FOUND_ERROR",
"message": "No FAQ matches context_id",
"status": 404
}{
"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
}Update FAQ
Updates the FAQ addressed by the path context_id. Send question and answer together to replace the text and regenerate its embedding (attachments are then cleared unless resent); attachments and is_active can also be updated alone — omitted fields stay unchanged.
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
});
async function main() {
const response = await client.knowledgeBase.updateFaq({
context_id: '00000000-0000-0000-0000-000000000000',
question: 'What is Periskope?',
});
console.log(response);
}
main();curl -X PATCH 'https://api.periskope.app/v1/knowledge-base/faq/00000000-0000-0000-0000-000000000000' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"question": "What is Periskope?"
}'[
{
"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": "NOT_FOUND_ERROR",
"message": "No FAQ matches context_id",
"status": 404
}{
"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
Path Parameters
Body
Response
An array containing the updated FAQ entry
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"
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"
}
}
]
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"
}
Was this page helpful?