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

# Search knowledge as a worker would

> Finds the passages a digital worker would read for a question: give `worker` to search the knowledge bases it searches, or `knowledge_base_ids`, and `account` to search as it does when it answers that account. Up to 5 passages come from each knowledge base, each at least 0.5 similar to the query, best first; only searchable documents are found. A worker set to search no knowledge base finds nothing.



## OpenAPI

````yaml /api/statisfy-api.openapi.json post /v1/knowledge_bases/search
openapi: 3.1.0
info:
  description: >-
    The agent-first Statisfy API. Authenticate with an API key (`Authorization:
    Bearer stfy_live_…`), then call `GET /v1/meta/capabilities` to discover
    every operation and its schemas.
  title: Statisfy API
  version: 1.0.0
servers:
  - url: https://api.statisfy.com
    description: Production
security: []
paths:
  /v1/knowledge_bases/search:
    post:
      tags:
        - knowledge_bases
      summary: Search knowledge as a worker would
      description: >-
        Finds the passages a digital worker would read for a question: give
        `worker` to search the knowledge bases it searches, or
        `knowledge_base_ids`, and `account` to search as it does when it answers
        that account. Up to 5 passages come from each knowledge base, each at
        least 0.5 similar to the query, best first; only searchable documents
        are found. A worker set to search no knowledge base finds nothing.
      operationId: knowledge_bases_search
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: false
              properties:
                account:
                  anyOf:
                    - minLength: 1
                      type: string
                    - type: 'null'
                  default: null
                  description: >-
                    Search as a worker answering this account does (from GET
                    /v1/objects/account/records): documents filed for another
                    account are left out. Without it, documents filed for every
                    account are searched
                  title: Account
                knowledge_base_ids:
                  anyOf:
                    - items:
                        type: string
                      maxItems: 20
                      minItems: 1
                      type: array
                    - type: 'null'
                  default: null
                  description: Or search these knowledge bases
                  title: Knowledge Base Ids
                query:
                  description: What to look up, in plain words
                  maxLength: 2000
                  minLength: 1
                  title: Query
                  type: string
                worker:
                  anyOf:
                    - type: string
                    - type: 'null'
                  default: null
                  description: >-
                    Search the knowledge bases this digital worker searches
                    (from GET /v1/digital_workers)
                  title: Worker
              required:
                - query
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeSearchResponse'
          description: Successful Response
      security:
        - HTTPBearer: []
components:
  schemas:
    KnowledgeSearchResponse:
      properties:
        data:
          description: Best first
          items:
            $ref: '#/components/schemas/KnowledgePassage'
          title: Data
          type: array
      required:
        - data
      title: KnowledgeSearchResponse
      type: object
    KnowledgePassage:
      properties:
        document_id:
          title: Document Id
          type: string
        knowledge_base_id:
          title: Knowledge Base Id
          type: string
        score:
          description: How close the passage is to the query, from 0 to 1
          title: Score
          type: number
        text:
          description: The passage, as the worker reads it
          title: Text
          type: string
        title:
          title: Title
          type: string
        url:
          anyOf:
            - type: string
            - type: 'null'
          description: The document's link a worker would give; null when it has none
          title: Url
      required:
        - knowledge_base_id
        - document_id
        - title
        - score
        - text
      title: KnowledgePassage
      type: object
  securitySchemes:
    HTTPBearer:
      scheme: bearer
      type: http
      description: >-
        An API key, sent as `Authorization: Bearer stfy_live_…`. See
        [Authentication](/rest-api/authentication) for how to get one and which
        scopes it needs.

````

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