context

Search for context data in the context processor

Changed on

This endpoint sends a search request to the context processor to retrieve relevant context data based on the provided query.

post/api/v1/context/search

Request

Query parameters

metadata'true' | 'false'

Controls whether metadata is included in the response:

  • metadata=true → metadata will be included in each context item in the response.
  • metadata=false (or omitted) → metadata will be excluded from the response for better performance.
mode'fast' | 'standard'

Controls the search mode:

  • mode=fast → prioritizes speed over completeness.
  • mode=standard → performs a comprehensive search (default if omitted).

Request body

user_idstring

The ID of the user making the request

querystring required

The search query used to search for context data

similarity_thresholdnumber required

Maximum similarity threshold (must be >= minimum_similarity_threshold)

minimum_similarity_thresholdnumber required

Minimum similarity threshold

scope'internal' | 'external'

Search scope

magic_keystring nullable

Magic key (sk_context_share_...) to search within contexts shared with the caller

joinedboolean

When true, matching context chunks are returned joined into a single string

Example request

{
  "user_id": "user123",
  "query": "search query for user preferences",
  "similarity_threshold": 0.8,
  "minimum_similarity_threshold": 0.5,
  "body_metadata": {
    "fileName": "support_thread_TCK-1234.txt",
    "lastModifiedAt": "2025-01-10T12:34:56.000Z"
  },
  "magic_key": "sk_context_share_nC0KUEF9T6UGDHYVUiMU"
}

Response

Context search request successfully processed. Response structure varies based on metadata query parameter: if metadata=true, each context includes metadata; if metadata=false or omitted, metadata is excluded from the response.

Changes

    • info

      added the new optional request property /

    • info

      added the new optional request property /

    • info

      added the new optional request property /

    • info

      added the new optional request property /

    • info

      added the new optional request property

    • info

      added the new optional request property

    • warning

      removed the request property

    • info

      api operation id searchUserContext was added

    • info

      added the new optional request property

    • info

      added the media type application/json for the response with the status

    • info

      added the media type application/json for the response with the status

    • info

      added the media type application/json for the response with the status