---
title: "Update a Knowledge answer"
method: PATCH
path: "/api/agent-answers/{sid}"
tags: ["agent_answers"]
---

# Update a Knowledge answer

`PATCH /api/agent-answers/{sid}`

## Request

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

Write an answer again: the question, the ways leads ask it, the answer (changed words are embedded again within seconds); attachment { when: always | on_request } sets when its file goes out, attachment null takes the file away (409 answer_has_no_file when there is none).

Contract:
- MCP tool `update_agent_answer`, registry package `mcp.unibox/agent_answers`, mount `unibox.knowledge`.
- Operation `update`, response envelope `update`.
- Flags: none.

## Path parameters

- `sid` string, required: Answer sid (ub_an_…).

## Request body

- UpdateAgentAnswerRequest: Request body of `update_agent_answer`.
  - `question` string: A new question; the vector is written again.
  - `phrasings` string[], nullable: The ways leads put the question, up to twelve, each up to 200 chars; the question itself and repeats are dropped.
  - `answer` string: A new answer text.
  - `attachment` object, nullable: { when } sets when the file goes out; null takes the file away. 409 answer_has_no_file when the answer carries none.
    - `when` 'always' | 'on_request', required: always, or on_request.

## Response `200`

`update` success envelope.

- UpdateAgentAnswerResponse
  - `success` true, required
  - `operation` 'update', 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.
  - `updated_fields` string[], required
  - `previous_values` object, required
  - `kept_fields` string[]: The fields this write did not change because the person's own value stands on them (stamped person); read the item for what landed.
  - `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)
