---
title: "Text search contexts"
method: GET
path: "/contexts/search"
tags: ["Contexts"]
---

# Text search contexts

`GET /contexts/search`

## Request

- Base URL: `https://apigcp.trynia.ai/v2`
- URL: `https://apigcp.trynia.ai/v2/contexts/search`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/nozomio-labs/apis/nia-ai-api/docs/contexts/search/get.ts> (a function with typed inputs; its response is checked against the schema)

Search contexts by content, title, summary, or tags using MongoDB text search.

## Query parameters

- `q` string, required: Search query
- `limit` integer: Number of contexts to return
- `tags` string, nullable: Comma-separated tags to filter by
- `agent_source` string, nullable: Filter by agent source

## Response `200`

Successful Response

- ContextSearchResponse: Response for text search in contexts.
  - `contexts` object[]: Matching contexts
  - `search_query` string, required: The search query used
  - `total_results` integer: Total number of results

## Other responses

- `422`: Validation Error

## Changes

- **2026-02-28** `7e426dce5dda`: 2 info
  - api tag `Contexts` added
  - api tag `Context Sharing` removed
- **2026-02-19** `c41dcb6ac8f7`: 2 info
  - api tag `Context Sharing` added
  - api tag `Contexts` removed
- **2026-02-14** `5b3db391b9ea`: 3 info
  - api tag `Contexts` added
  - api tag `v2-api` removed
  - api tag `v2-api-contexts` removed

[Operation history](https://skmtc.dev/nozomio-labs/apis/nia-ai-api/changes/contexts/search/get.md)

---

[API](https://skmtc.dev/nozomio-labs/apis/nia-ai-api.md) - [All operations](https://skmtc.dev/nozomio-labs/apis/nia-ai-api/llms.txt) - [OpenAPI document](https://skmtc.dev/nozomio-labs/apis/nia-ai-api/revisions/dbb602a3ef17?raw)
