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

# Answer from knowledge

> Returns the answer an agent would give to a question, written only from its knowledge, with the passages it used. Send `source_ids` to search exactly those sources, or `agent_id` to search what that agent attaches; `agent_id` also gives the answer the agent's own instructions. `answered` is false when the passages don't contain the answer. When passages were found but no answer could be written in time, `answer` is null and `error` is `answer_unavailable`. Send `instructions` to try unsaved instructions instead of the agent's saved prompt. Each workspace gets about 30 answers an hour; past that it's a `429` with `Retry-After`.

**Scopes:** `knowledge:read`



## OpenAPI

````yaml /api-reference/openapi.json post /v1/knowledge/answer
openapi: 3.1.0
info:
  title: Kallabot API
  version: '2026-11-07'
  description: >
    The Kallabot API lets you build and run AI agents that answer and make phone
    calls and reply on

    WhatsApp, Messenger, Instagram and website chat.


    - **Base URL:** `https://api.kallabot.com`

    - **Auth:** `Authorization: Bearer kb_live_…` (create a key in the dashboard
    under Settings → API keys).
      Each operation lists the scopes its key needs. A workspace key (`kb_live_…`) belongs to the workspace;
      a personal key (`kbp_live_…`) acts as the person who made it, within their role, and is logged under
      their name. Operations marked **Needs a personal key** need someone behind them, so only a personal
      key works there. The browser side of a web call is the exception: its
      `/client` operations take only the session's `X-Webcall-Grant`, so your key never reaches the page.
    - **Errors:** every error is `application/problem+json` with a stable `code`
    ([error reference](https://docs.kallabot.com/developers/errors)).

    - **Retries:** send an `Idempotency-Key` on creates and control actions; a
    retry with the same key never runs twice.

    - **Rate limits:** every response carries `RateLimit-Limit`,
    `RateLimit-Remaining` and `RateLimit-Reset`;
      a `429` carries `Retry-After`.
    - **Versions:** the API is versioned by date. Send `Kallabot-Version:
    2026-11-07` to pin the version
      you built against; without it you get the current version (`2026-11-07`). Every response names the
      version that answered in `Kallabot-Version`, and an unknown version is refused with 400
      `unsupported_api_version`.
    - **Lists:** every list takes `limit` and `cursor` and answers `{data,
    next_cursor, has_more}`. Pass
      `next_cursor` back as `cursor` for the next page; cursors are opaque.
    - **Concurrency:** reads of versioned objects carry an `ETag` (the revision
    in quotes, e.g. `"7"`); send it back as
      `If-Match` and a stale write is refused with 412. Where `If-Match` is marked required, a write without it gets 428.
    - **SDKs:** the official SDKs send `X-Kallabot-SDK`. A deprecated release
    gets a `Kallabot-SDK-Warning` header;
      a release that has been switched off is refused with 426 `sdk_version_unsupported` and must upgrade.
    - **Webhooks:** every event Kallabot sends is listed under Webhooks with its
    payload, signed with
      [Standard Webhooks](https://docs.kallabot.com/developers/webhooks) headers.
  contact:
    name: Kallabot support
    email: contact@kallabot.com
    url: https://docs.kallabot.com
  termsOfService: https://kallabot.com/terms
servers:
  - url: https://api.kallabot.com
    description: Production
security:
  - apiKey: []
tags:
  - name: Agents
    description: >-
      Create, version, publish and archive the AI agents that answer and make
      calls and chats.
  - name: Calls
    description: >-
      Place phone calls, read them back with transcripts, recordings and
      timings, and control live calls.
  - name: Scheduled calls
    description: >-
      Book an outbound call for later; Kallabot dials at the right time in the
      callee's time zone.
  - name: Web calls
    description: Start a voice call from a browser (WebRTC) with a short-lived grant.
  - name: Tools
    description: >-
      Give agents actions: HTTP API tools, MCP servers, and the secrets they
      use.
  - name: Workflows
    description: >-
      Read the workspace's automations, their runs, app connections and
      templates; start a workflow; browse the apps agents' tools are built from.
  - name: Knowledge
    description: Index websites, files and catalogs so agents answer from your own facts.
  - name: Numbers
    description: >-
      Search, buy and configure phone numbers, port numbers in, and choose
      caller IDs.
  - name: SIP trunks
    description: Bring your own carrier over SIP and attach its numbers to agents.
  - name: Inbox
    description: >-
      Read chat threads from WhatsApp, Messenger, Instagram and web chat, and
      manage their state.
  - name: Web chat
    description: Create and publish website chat widgets.
  - name: Webhooks
    description: >-
      Receive signed events when calls end, messages arrive and more; inspect
      and replay deliveries.
  - name: Minutes
    description: Read the workspace's minutes and move them between the pool and people.
  - name: Billing
    description: >-
      See the plan, prices and invoices; open Checkout or the billing portal,
      sync seats and set auto top-up. Money is integer minor units plus
      `currency`.
paths:
  /v1/knowledge/answer:
    post:
      tags:
        - Knowledge
      summary: Answer from knowledge
      description: >-
        Returns the answer an agent would give to a question, written only from
        its knowledge, with the passages it used. Send `source_ids` to search
        exactly those sources, or `agent_id` to search what that agent attaches;
        `agent_id` also gives the answer the agent's own instructions.
        `answered` is false when the passages don't contain the answer. When
        passages were found but no answer could be written in time, `answer` is
        null and `error` is `answer_unavailable`. Send `instructions` to try
        unsaved instructions instead of the agent's saved prompt. Each workspace
        gets about 30 answers an hour; past that it's a `429` with
        `Retry-After`.


        **Scopes:** `knowledge:read`
      operationId: answerFromKnowledge
      parameters:
        - name: Kallabot-Version
          in: header
          required: false
          description: >-
            The API version to answer as, a date (`YYYY-MM-DD`). Leave it out
            for the current version (`2026-11-07`). An unknown version is
            refused with 400 `unsupported_api_version`.
          schema:
            type: string
            enum:
              - '2026-11-07'
            example: '2026-11-07'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnswerRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeAnswer'
          headers:
            RateLimit-Limit:
              description: Requests allowed per minute for this credential.
              schema:
                type: integer
            RateLimit-Remaining:
              description: Requests left in the current window.
              schema:
                type: integer
            RateLimit-Reset:
              description: Seconds until the window is full again.
              schema:
                type: integer
            X-Request-Id:
              description: Quote this when contacting support.
              schema:
                type: string
            Kallabot-Version:
              description: The API version that answered this request.
              schema:
                type: string
                example: '2026-11-07'
            Kallabot-SDK-Warning:
              description: >-
                Sent when the SDK release that made the request is deprecated:
                what to upgrade to. The SDKs log it once.
              schema:
                type: string
        '400':
          $ref: '#/components/responses/UnsupportedApiVersion'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/InvalidRequest'
        '426':
          $ref: '#/components/responses/SdkVersionUnsupported'
        '429':
          description: >-
            More than 30 answers in an hour for this workspace (dashboard and
            API keys together), or the API's own per-minute limits.
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
            RateLimit-Limit:
              description: Answers allowed per hour for this workspace.
              schema:
                type: integer
            RateLimit-Remaining:
              description: Answers left.
              schema:
                type: integer
            RateLimit-Reset:
              description: Seconds until the hourly allowance is full again.
              schema:
                type: integer
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  title:
                    type: string
                  status:
                    type: integer
                  code:
                    type: string
                  detail:
                    type: string
                  retryable:
                    type: boolean
              example:
                type: https://docs.kallabot.com/errors/rate_limited
                title: Too many requests
                status: 429
                code: rate_limited
                retryable: true
                detail: >-
                  You've tested 30 questions in the last hour. Try again in 2
                  minutes.
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - apiKey: []
components:
  schemas:
    AnswerRequest:
      properties:
        query:
          type: string
          maxLength: 500
          minLength: 1
          title: Query
        agent_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Id
          description: Search what this agent attaches (its draft).
        source_ids:
          anyOf:
            - items:
                type: string
              type: array
              maxItems: 40
            - type: 'null'
          title: Source Ids
          description: Or exactly these sources.
        channel:
          type: string
          enum:
            - playground
            - phone
            - web
            - whatsapp
            - instagram
            - messenger
            - web_chat
            - tiktok
          title: Channel
          default: playground
        top_k:
          type: integer
          maximum: 10
          minimum: 1
          title: Top K
          default: 3
        lang:
          type: string
          maxLength: 8
          title: Lang
          default: en
        instructions:
          anyOf:
            - type: string
              maxLength: 20000
            - type: 'null'
          title: Instructions
          description: >-
            The agent's instructions as the owner is editing them, up to 20,000
            characters. When present and not blank, the answer follows these
            instead of the agent's saved prompt. They never change which sources
            are searched.
      additionalProperties: false
      type: object
      required:
        - query
      title: AnswerRequest
      description: >-
        A question a caller might ask, answered the way the agent would from its
        knowledge.


        `source_ids`, when sent, are exactly the sources searched (the editor's

        ticked ones, saved or not); otherwise the agent's attached sources are.

        `agent_id` also supplies the agent's own instructions for the answer.
    KnowledgeAnswer:
      properties:
        answer:
          anyOf:
            - type: string
            - type: 'null'
          title: Answer
          description: >-
            What the agent would say, in one to three short sentences. Null when
            no passage matched or the answer couldn't be written (see `error`).
        answered:
          type: boolean
          title: Answered
          description: >-
            True only when the passages contained the answer. False when nothing
            matched, the passages didn't say, or the answer couldn't be written.
        error:
          anyOf:
            - type: string
              const: answer_unavailable
            - type: 'null'
          title: Error
          description: >-
            `answer_unavailable`: the passages were found but the model didn't
            write an answer in time. Show the passages instead.
        passages:
          items:
            $ref: '#/components/schemas/KnowledgePassage'
          type: array
          title: Passages
          description: The passages the answer was written from.
        path:
          anyOf:
            - type: string
            - type: 'null'
          title: Path
          description: How the passages were found, as in search.
        matched:
          type: boolean
          title: Matched
          description: At least one passage matched.
        latency_ms:
          type: number
          title: Latency Ms
          description: Search time in milliseconds.
        answer_ms:
          anyOf:
            - type: number
            - type: 'null'
          title: Answer Ms
          description: Time spent writing the answer; null when no model ran.
        total_ms:
          type: number
          title: Total Ms
          description: Total time in milliseconds.
      type: object
      required:
        - answered
        - passages
        - matched
        - latency_ms
        - total_ms
      title: KnowledgeAnswer
    KnowledgePassage:
      properties:
        chunk_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Chunk Id
          description: The passage id.
        label:
          anyOf:
            - type: string
            - type: 'null'
          title: Label
          description: Where it is from, e.g. `Price list › Marina Gate 2`.
        text:
          type: string
          title: Text
          description: The passage.
        score:
          anyOf:
            - type: number
            - type: 'null'
          title: Score
          description: How well it matched.
      type: object
      required:
        - text
      title: KnowledgePassage
    Problem:
      type: object
      description: >-
        An RFC 9457 problem. `code` is the stable contract; `title` and `detail`
        are for people.
      required:
        - type
        - title
        - status
        - code
        - retryable
      properties:
        type:
          type: string
          format: uri
          example: https://docs.kallabot.com/errors/not_found
        title:
          type: string
          example: Agent not found
        status:
          type: integer
          example: 404
        code:
          type: string
          example: not_found
        detail:
          type: string
          example: Agent does not exist, or you do not have access to it.
        retryable:
          type: boolean
          example: false
        field_problems:
          type: array
          items:
            type: object
            properties:
              path:
                type: string
                description: JSON Pointer to the field.
                example: /to
              code:
                type: string
                example: missing
              message:
                type: string
                example: Field required
        request_id:
          type: string
          example: req_01HZX3K9Q2
  responses:
    UnsupportedApiVersion:
      description: Kallabot-Version names a version this API doesn't have
      headers:
        X-Request-Id:
          description: Quote this when contacting support.
          schema:
            type: string
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: https://docs.kallabot.com/errors/unsupported_api_version
            title: Kallabot-Version names a version this API doesn't have
            status: 400
            code: unsupported_api_version
            retryable: false
    Unauthenticated:
      description: Missing or invalid API key
      headers:
        X-Request-Id:
          description: Quote this when contacting support.
          schema:
            type: string
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: https://docs.kallabot.com/errors/unauthenticated
            title: Missing or invalid API key
            status: 401
            code: unauthenticated
            retryable: false
    Forbidden:
      description: The key lacks a required scope
      headers:
        X-Request-Id:
          description: Quote this when contacting support.
          schema:
            type: string
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: https://docs.kallabot.com/errors/insufficient_scope
            title: The key lacks a required scope
            status: 403
            code: insufficient_scope
            retryable: false
    Conflict:
      description: Conflicts with the resource's current state
      headers:
        X-Request-Id:
          description: Quote this when contacting support.
          schema:
            type: string
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: https://docs.kallabot.com/errors/revision_conflict
            title: Conflicts with the resource's current state
            status: 409
            code: revision_conflict
            retryable: false
    InvalidRequest:
      description: One or more fields are not valid
      headers:
        X-Request-Id:
          description: Quote this when contacting support.
          schema:
            type: string
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: https://docs.kallabot.com/errors/invalid_request
            title: One or more fields are not valid
            status: 422
            code: invalid_request
            retryable: false
    SdkVersionUnsupported:
      description: 'This SDK release is switched off: upgrade the SDK'
      headers:
        X-Request-Id:
          description: Quote this when contacting support.
          schema:
            type: string
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: https://docs.kallabot.com/errors/sdk_version_unsupported
            title: 'This SDK release is switched off: upgrade the SDK'
            status: 426
            code: sdk_version_unsupported
            retryable: false
    InternalError:
      description: Something went wrong on our side
      headers:
        X-Request-Id:
          description: Quote this when contacting support.
          schema:
            type: string
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: https://docs.kallabot.com/errors/internal_error
            title: Something went wrong on our side
            status: 500
            code: internal_error
            retryable: true
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: kb_live_<lookup>_<secret> | kbp_live_<lookup>_<secret>
      description: >-
        An API key from Settings → API keys, sent as `Authorization: Bearer
        kb_live_…`. A workspace key starts `kb_`; a personal key starts `kbp_`
        and acts as its owner.

````

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