---
title: "Ask the Knowledge answers"
method: POST
path: "/api/agent-answers/ask"
tags: ["agent_answers"]
---

# Ask the Knowledge answers

`POST /api/agent-answers/ask`

## Request

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

Ask the way a lead would: the answers the AI SDR would read for a text, nearest first, each with its similarity and whether it clears the floor a turn reads above (the floor rides the result). Empty when no answer is embedded yet or the vector plane does not answer. Costs one embed.

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

## Request body

- AskAgentAnswersRequest: Request body of `ask_agent_answers`.
  - `agent_sid` string: Whose Knowledge to read (ub_ag_…, block 10, 2026-10-30); left out, the team's default agent's.
  - `q` string, required: The text to read for, as a lead would write it: a question, a request ("send me the price list").
  - `k` integer: How many answers to return, nearest first; default 5, what a turn reads at most.

## Response `200`

`action` success envelope.

- AskAgentAnswersResponse
  - `success` true, required
  - `operation` 'action', required
  - `action` string, required: kebab-case verb; matches the route segment.
  - `item` unknown, required
  - `result` object, required
    - `floor` number, required: The similarity a turn reads above (0.75 on the (1 + cosine) / 2 scale).
    - `answers` object[], required: The nearest answers, best first; empty when no answer is embedded yet or the vector plane does not answer.
      - `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.
      - `similarity` number, required: On the (1 + cosine) / 2 scale.
      - `above_floor` boolean, required: Whether a turn would read it.
  - `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.

## 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)
