---
title: "Search file contents across knowledge bases"
method: GET
path: "/api-platform/knowledge-bases/files/search"
tags: ["Knowledge Bases"]
---

# Search file contents across knowledge bases

`GET /api-platform/knowledge-bases/files/search`

## Request

- Base URL: `https://api.textcortex.com/v1`
- URL: `https://api.textcortex.com/v1/api-platform/knowledge-bases/files/search`
- Auth: HTTP bearer

Search file contents across knowledge bases visible to the current API key.

Uses the current API key's permissions. Check `GET /capabilities` for availability. Searches indexed content across accessible KBs and collapses matches to one result per file. Pagination starts at page=0. Increase page while pagination.has_more is true; do not infer completion from an estimated total. The q parameter searches content, unlike q on the uploaded-file list, which filters filenames. Returned page is zero-based when present.

## Query parameters

- `q` string, required
- `limit` integer
- `page` integer

## Response `200`

Successful response

- KnowledgeBaseSearchResponse
  - `data` KnowledgeBaseSearchResult[], required
    - `file_id` string, nullable
    - `file_name` string, nullable
    - `is_owner` boolean
    - `knowledge_base_id` string, nullable
    - `knowledge_base_name` string, nullable
    - `mime_type` string, nullable
    - `object` 'knowledge_base_file_search_result'
    - `page` integer, nullable: Zero-based page index when available.
    - `score` number, nullable
    - `snippet` string, nullable
  - `object` 'list', required
  - `pagination` Pagination, required
    - `has_more` boolean, required
    - `limit` integer, required
    - `offset` integer, required
    - `page` integer, required: Zero-based page index.
    - `total` integer, required
    - `total_is_exact` boolean: File lists may return an estimated total; use has_more for pagination.
  - `query` string

## Other responses

- `400`: Invalid request
- `401`: Missing or invalid API key
- `403`: Access denied
- `404`: Resource not found
- `422`: Request validation failed
- `500`: Server error

## Changes

- **2026-10-08** `254204fd17bd`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/textcortex/apis/textcortex-api/changes/api-platform/knowledge-bases/files/search/get.md)

---

[API](https://skmtc.dev/textcortex/apis/textcortex-api.md) - [All operations](https://skmtc.dev/textcortex/apis/textcortex-api/llms.txt) - [OpenAPI document](https://skmtc.dev/textcortex/apis/textcortex-api/revisions/b27459bd3c96?raw)
