> ## Documentation Index
> Fetch the complete documentation index at: https://docs.periskope.app/llms.txt
> Use this file to discover all available pages before exploring further.

# 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.



## OpenAPI

````yaml api-reference/openapi-generated.json POST /v1/knowledge-base/faq/create
openapi: 3.0.3
info:
  title: Periskope API
  version: 1.0.0
  description: >-
    Periskope external API.


    Responses use a flat, unwrapped shape: most endpoints return the resource at
    the top level, and list endpoints return a wrapper object with pagination
    inline (e.g. `{ from, to, count, chats: [...] }`). The documented response
    schemas describe these shapes directly.
servers:
  - url: https://api.periskope.app
security:
  - bearerAuth: []
paths:
  /v1/knowledge-base/faq/create:
    post:
      tags:
        - Knowledge Base
      summary: Create an FAQ
      description: >-
        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.
      operationId: createFaq
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                question:
                  type: string
                  minLength: 1
                  description: The question the AI agent should learn the answer to
                  example: What is Periskope?
                answer:
                  type: string
                  minLength: 1
                  description: The answer to the question
                  example: Periskope is a platform to manage WhatsApp at scale.
                attachment:
                  type: object
                  properties:
                    filename:
                      type: string
                      minLength: 1
                      description: >-
                        Name to store the attachment under, including the file
                        extension
                      example: pricing.pdf
                    file:
                      type: string
                      description: >-
                        File content as a base64 string or a data: URI
                        (data:application/pdf;base64,<content>). Data URIs must
                        have the application/pdf MIME type. Provide exactly one
                        of file, url or base64.
                      example: JVBERi0xLjQKJcTl8uXrp...
                    url:
                      type: string
                      description: >-
                        Publicly accessible URL to fetch the attachment from.
                        Provide exactly one of file, url or base64.
                      example: https://example.com/files/pricing.pdf
                    base64:
                      type: string
                      description: >-
                        File content as a base64 string or a data: URI
                        (data:application/pdf;base64,<content>). Data URIs must
                        have the application/pdf MIME type. Provide exactly one
                        of file, url or base64.
                      example: JVBERi0xLjQKJcTl8uXrp...
                  required:
                    - filename
                  description: >-
                    A single attachment to store with the FAQ. Requires filename
                    plus exactly one content source: file, url or base64.
                is_active:
                  type: boolean
                  description: >-
                    Whether the FAQ is active immediately. Defaults to false —
                    the entry stays inactive until approved.
                  example: false
              required:
                - question
                - answer
      responses:
        '200':
          description: The created FAQ entry
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeBaseContext'
              examples:
                default:
                  summary: Response body
                  value:
                    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'
        '401':
          description: Invalid, expired or missing API token
          content:
            application/json:
              examples:
                error:
                  summary: Invalid, expired or missing API token
                  value:
                    code: UNAUTHORIZED_ERROR
                    message: Invalid bearer auth token
                    status: 401
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: UNAUTHORIZED_ERROR
                  message:
                    type: string
                    example: Invalid bearer auth token
                  status:
                    type: integer
                    example: 401
                example:
                  code: UNAUTHORIZED_ERROR
                  message: Invalid bearer auth token
                  status: 401
        '422':
          description: Request validation failed
          content:
            application/json:
              examples:
                error:
                  summary: Request validation failed
                  value:
                    code: VALIDATION_ERROR
                    message: Request validation failed
                    status: 422
                    fields:
                      body.chat_id:
                        message: chat_id is required
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: VALIDATION_ERROR
                  message:
                    type: string
                    example: Request validation failed
                  status:
                    type: integer
                    example: 422
                  fields:
                    type: object
                    additionalProperties:
                      type: object
                      properties:
                        message:
                          type: string
                        value: {}
                    example:
                      body.chat_id:
                        message: chat_id is required
                example:
                  code: VALIDATION_ERROR
                  message: Request validation failed
                  status: 422
                  fields:
                    body.chat_id:
                      message: chat_id is required
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              examples:
                error:
                  summary: Rate limit exceeded
                  value:
                    code: RATE_LIMIT_ERROR
                    message: You can only make 100 requests per second
                    status: 429
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: RATE_LIMIT_ERROR
                  message:
                    type: string
                    example: You can only make 100 requests per second
                  status:
                    type: integer
                    example: 429
                example:
                  code: RATE_LIMIT_ERROR
                  message: You can only make 100 requests per second
                  status: 429
        '500':
          description: Internal server error
          content:
            application/json:
              examples:
                error:
                  summary: Internal server error
                  value:
                    code: UNKNOWN_ERROR
                    message: Internal server error
                    status: 500
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: UNKNOWN_ERROR
                  message:
                    type: string
                    example: Internal server error
                  status:
                    type: integer
                    example: 500
                example:
                  code: UNKNOWN_ERROR
                  message: Internal server error
                  status: 500
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: typescript
          label: TypeScript
          source: |-
            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();
        - lang: bash
          label: cURL
          source: >-
            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."
              }'
components:
  schemas:
    KnowledgeBaseContext:
      type: object
      properties:
        context_id:
          type: string
          description: >-
            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.
          example: 00000000-0000-0000-0000-000000000000
        org_id:
          type: string
          description: Id of the organization the entry belongs to
          example: 00000000-0000-0000-0000-000000000000
        question:
          type: string
          description: >-
            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").
          example: What is Periskope?
        answer:
          type: string
          description: >-
            The answer text the AI agent draws on. For document chunks, the
            extracted text of the chunk.
          example: Periskope is a platform to manage WhatsApp at scale.
        type:
          type: string
          enum:
            - faq
            - document
            - self-learned
          description: >-
            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.
          example: faq
        embedding:
          type: string
          description: >-
            Vector embedding of the entry, serialized as a string. Used
            internally for semantic retrieval — safe to ignore.
          example: '[-0.0123,0.0456,0.0789,...]'
        attachments:
          description: >-
            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.
          example:
            - 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:
          type: number
          description: >-
            Average rating of AI answers generated from this entry. null when
            the entry has not been rated.
          example: null
        document_id:
          type: string
          description: >-
            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.
          example: 00000000-0000-0000-0000-000000000000
        is_active:
          type: boolean
          description: >-
            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.
          example: true
        metadata:
          description: >-
            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.
          example:
            fileName: product-faq.pdf
            chunkIndex: 1
            tokenCount: 180
            source: qa
        tags:
          type: array
          items:
            type: string
          description: Tags assigned to the entry. null when untagged.
          example: null
        created_at:
          type: string
          description: When the entry was created, as an ISO 8601 timestamp
          example: '2026-01-15T09:30:00.000Z'
        updated_at:
          type: string
          description: >-
            When the entry was last updated, as an ISO 8601 timestamp. null when
            never updated.
          example: '2026-01-15T09:30:00.000Z'
      description: >-
        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.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        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.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.