---
title: "Search context and generate an LLM-powered answer"
method: POST
path: "/api/v1/context/search/steer"
tags: ["context"]
---

# Search context and generate an LLM-powered answer

`POST /api/v1/context/search/steer`

## Request

- Base URL: `https://platform-backend.getalchemystai.com`
- URL: `https://platform-backend.getalchemystai.com/api/v1/context/search/steer`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/alchemyst-ai/apis/alchemyst-ai-api-v1-documentation/docs/api/v1/context/search/steer/post.ts> (a function with typed inputs; its response is checked against the schema)

This endpoint performs a context search using the context processor, joins all
matching context chunks into a single string, then sends that joined context
along with the user's query to an LLM to produce a
natural-language answer grounded in the retrieved context.

By default the response only includes the generated `answer`. Pass
`?context=true` to also receive the joined context string that was used to
ground the answer.

## Query parameters

- `mode` 'fast' | 'standard'
- `context` boolean

## Request body

- object
  - `user_id` string: The ID of the user making the request
  - `steeringPrompt` string: The steering prompt for the query - basically the way in which you want to get your answer as.
  - `query` string, required: The search query and question to be answered using retrieved context
  - `similarity_threshold` number, required: Maximum similarity threshold (must be >= minimum_similarity_threshold)
  - `minimum_similarity_threshold` number, required: Minimum similarity threshold
  - `scope` 'internal' | 'external': Search scope
  - `body_metadata` object: Metadata filters for the underlying context search. Recognized keys: fileName, groupName, lastModifiedAt, modalities. Extra keys are allowed. When body_metadata is present without groupName, the search defaults to the "default" group.
    - `fileName` string: Filter contexts by file name
    - `groupName` string[]: Array of group names to filter contexts by
    - `lastModifiedAt` string, date-time: Filter contexts by last modified timestamp
    - `modalities` string[]: Modalities to search across
  - `magic_key` string, nullable: Magic key (sk_context_share_...) to search within contexts shared with the caller

## Response `200`

Successfully retrieved context and generated an answer.

- object
  - `answer` string, required: The LLM-generated answer based on the retrieved context
  - `context` string: The joined context retrieved from the context processor. Only present when the request was made with `?context=true`.
  - `usage` object, required: Token usage information from the LLM
    - `inputTokens` number
    - `outputTokens` number
    - `totalTokens` number

## Other responses

- `400`: Bad Request - Invalid or missing search parameters
- `401`: Unauthorized - User not authenticated
- `402`: Payment Required - User not allowed to perform action
- `403`: Forbidden - User lacks required scope
- `500`: Internal Server Error

## Changes

- **2026-11-09** `f416d672a956`: 1 breaking, 5 info
  - removed the required property `model` from the response with the `200` status
  - added the new optional request property `body_metadata/fileName`
  - added the new optional request property `body_metadata/groupName`
  - added the new optional request property `body_metadata/lastModifiedAt`
  - …2 more
- **2026-09-05** `364255d907e8`: 1 info
  - added the required property `model` to the response with the `200` status
- **2026-07-02** `056a116e2885`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/alchemyst-ai/apis/alchemyst-ai-api-v1-documentation/changes/api/v1/context/search/steer/post.md)

---

[API](https://skmtc.dev/alchemyst-ai/apis/alchemyst-ai-api-v1-documentation.md) - [All operations](https://skmtc.dev/alchemyst-ai/apis/alchemyst-ai-api-v1-documentation/llms.txt) - [OpenAPI document](https://skmtc.dev/alchemyst-ai/apis/alchemyst-ai-api-v1-documentation/revisions/2650e0435c8b?raw)
