---
title: "Search Knowledge answers"
method: POST
path: "/api/agent-answers/search"
tags: ["agent_answers"]
---

# Search Knowledge answers

`POST /api/agent-answers/search`

## Request

- Base URL: `https://beta.getsales.io/unibox/v1`
- URL: `https://beta.getsales.io/unibox/v1/api/agent-answers/search`
- Auth: HTTP bearer and API key in header `Team-SID`

The AI SDR's Knowledge as answers: when they ask the question (or one of its phrasings), it answers the text, each read from a document or added by hand. Sorted by use (the replies that read it in 30 days) with counts per source; filter.source_sid for one document, filter.source_kind manual for what was typed; include usage adds each answer's reads and the newest three replies that used it. page_size 0 returns counts alone.

Contract:
- MCP tool `search_agent_answers`, registry package `mcp.unibox/agent_answers`, mount `unibox.knowledge`.
- Operation `search`, response envelope `search`.
- Flags: read only.

## Request body

- SearchAgentAnswersRequest: Request body of `search_agent_answers`.
  - `filter` object: Field filters, ANDed: {field: {eq | ne | in | nin | gte | lte | gt | lt | is_null}}; q inside it is free text. Omit for every row.
    - `q` string: Words in the question or the answer.
    - `sid` object: Answer sid(s), ub_an_ prefix.
      - `eq` string: Answer sid (ub_an_…).
      - `in` string[]
    - `agent_sid` object: The AI SDR the rows belong to (ub_ag_…, block 10, 2026-10-30); left out, the team's default agent.
      - `eq` string
      - `in` string[]
    - `source_kind` object: { eq: "manual" } is what was added by hand.
      - `eq` 'document' | 'manual'
      - `in` string[]
    - `source_sid` object: The answers read from one document (ub_as_…).
      - `eq` string
      - `in` string[]
      - `is_null` boolean
    - `embedding_state` object: { eq: "ready" } is what the pick reads; { eq: "failed" } what the plane refused three times.
      - `eq` 'pending' | 'ready' | 'failed'
      - `in` string[]
    - `created_at` object: ISO 8601 range.
      - `gte` string
      - `lte` string
      - `gt` string
      - `lt` string
  - `include` string[]: Relations to attach to every item; omit for the bare rows.
  - `sort` object: One column and its direction; omit for the default order.
    - `field` 'used' | 'question' | 'created_at', required: The column to order by.
    - `direction` 'asc' | 'desc': asc or desc; default desc.
  - `page_size` integer: 0..500, default 50; 0 = counts only, 1 = the first row.
  - `cursor` string, nullable: pagination.next_cursor of the previous page.

## Response `200`

`search` success envelope.

- SearchAgentAnswersResponse
  - `success` true, required
  - `operation` 'search', required
  - `items` object[], required
    - `item` object, required
      - `sid` string, required: Answer sid (ub_an_…).
      - `team_sid` string, required: Owning team (ts_tm_…, external - gs.service.id).
      - `agent_sid` string, required: The team's agent (ub_ag_…).
      - `question` string, required: When they ask: the question as leads put it, up to 500 chars.
      - `answer` string, required: It answers: the text, up to 1200 chars; the reply states it as a fact.
      - `source` object, required: Where it was read from: a document with its page, its passage and (a website) the page's address, or manual.
        - `kind` 'document' | 'manual', required: document: read from a Knowledge document by the parse; manual: typed by hand (who and when: created_by, created_at).
        - `source_sid` string, nullable, required: The document (ub_as_…) for a document answer; null for manual.
        - `page` integer, nullable, required: The document's page it was read from.
        - `passage_from` integer, nullable, required: The passage's start offset in the document's text.
        - `passage_to` integer, nullable, required: The passage's end offset.
        - `passage` string, nullable, required: The passage it was read from, up to 1200 chars.
        - `url` string, nullable, required: A website page's address, when the document is a website (block AC3, 2026-10-26); null otherwise.
      - `created_by` object, required: Who typed it, or who applied the parse that read it.
        - `actor_type` 'user' | 'support' | 'api_key' | 'system' | 'agent', required
        - `actor_sid` string, nullable, required
        - `team_sid` string, required
        - `actor_name` string, nullable: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
        - `oauth_client_sid` string, nullable: The acting OAuth client (id_oc_*); null off the OAuth path.
        - `reason` string, nullable: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
        - `permissions` object, required: Internal audit context: the grant set the actor held at write time. Not a contract.
        - `cluster_id` integer, nullable: Internal audit context: the cluster that served the write.
        - `trace_id` string, nullable: Internal audit context: the trace id of the request that wrote the row.
      - `phrasings` string[], required: The ways leads put the question, up to twelve, each up to 200 chars; never the question itself. Embedded with it.
      - `attachment` object, nullable, required: The file that goes out with the answer and when; null when none. Attached in the studio.
        - `name` string, required: The file's name as uploaded.
        - `mime` string, required: Its type.
        - `bytes` integer, required: Its size.
        - `when` 'always' | 'on_request', required: always: with every reply that uses the answer; on_request: only when the lead asks for the file.
      - `embedding_state` 'pending' | 'ready' | 'failed', required: ready when the pick reads it; pending right after a write, until the vector is written.
      - `embedding_model` string, nullable, required: provider/model that wrote the vector; null while pending.
      - `created_at` string, required: ISO 8601 UTC.
      - `updated_at` string, required: ISO 8601 UTC.
    - `included` object, required
      - `usage` object: include usage: how many replies read it in 30 days, and the newest three with their leads, what became of each and what the lead did after it.
        - `used` integer, required: The replies that went out in 30 days whose turn read the answer.
        - `uses` object[], required: The newest three of them.
          - `run_sid` string, required: The run that carried the answer (ub_rn_…), a row of search_agent_runs.
          - `conversation_sid` string, required: Its thread (ub_cv_…).
          - `at` string, required: ISO 8601 UTC, when the reply went out.
          - `lead_name` string, nullable, required: The lead of that thread.
          - `outcome` string, nullable, required: What became of the reply: written, edited, unsure, handed (the Analyzer's outcome).
          - `approved_by_user_sid` string, nullable, required: The teammate who approved it when one did.
          - `then` object, nullable, required: What the lead did after the reply (2026-10-27, block AC8): gave_contact, booked, replied, back_on, no_reply and the rest, read from the reply's send; the drawer's words. Null where the thread is gone.
            - `kind` string, required: booked, signed_up, registered (the Playbook's end), their_link, confirmed_time, gave_contact (the lead's own evidence), handed (a person took the thread), replied (the lead wrote again), back_on (the lead named a date and the plan waits until it: at is the date), no_reply.
            - `at` string, nullable, required: ISO 8601 UTC of what happened; null on no_reply.
  - `pagination` object, required
    - `next_cursor` string, nullable, required
    - `has_more` boolean, required
    - `total_count` integer, nullable, required
  - `applied_filters` object, required
  - `includes` string[], required
  - `meta` object, required
    - `trace_id` string, required: UUID v7; same 128-bit value as the X-Trace-Id header.
    - `span_id` string, required: 16 hex chars, root span of this request.
    - `timestamp` string, required: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
    - `duration_ms` integer, required: Server-side wall clock.
    - `team_sid` string, nullable: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
    - `actor_type` string, nullable: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
  - `counts` object
    - `total_count` integer, required: Answers matching the filter (full filter scope, not the page).
    - `groups` object, required
      - `source` union, required: Answers per source over the other filters: `manual`, and each document by its sid (the source filter's menu).
        - object
        - unknown[]
          - unknown

## Other responses

- `4XX`: MCP error envelope. `error.code` is one of validation_failed, nothing_to_update, not_found, relation_not_found, invalid_transition, limit_exceeded, payment_required, duplicate_rejected, conflict, delete_blocked, unauthorized, forbidden, rate_limited, not_implemented.
- `5XX`: MCP error envelope with `error.code` internal_error or service_unavailable.

---

[API](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-unibox.md) - [All operations](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-unibox/llms.txt) - [OpenAPI document](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-unibox/revisions/8f1bc317897f?raw)
