---
title: "Update Knowledge document"
method: PATCH
path: "/api/agent-sources/{sid}"
tags: ["agent_sources"]
---

# Update Knowledge document

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

## Request

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

Rename a Knowledge document, change how it is read (instruction, read by its next parse: read_again_agent_source) or a website's refresh (weekly or daily; a file is read when you ask, 422 on refresh).

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

## Path parameters

- `sid` string, required: Knowledge document sid (ub_as_…).

## Request body

- UpdateAgentSourceRequest: Request body of `update_agent_source`.
  - `title` string: A new name.
  - `instruction` string, nullable: A new instruction, read by the next parse (read_again_agent_source); null clears it.
  - `refresh` 'weekly' | 'daily': A website's refresh (weekly or daily); its next read moves with it. 422 on a file.

## Response `200`

`update` success envelope.

- UpdateAgentSourceResponse
  - `success` true, required
  - `operation` 'update', required
  - `item` object, required
    - `sid` string, required: Knowledge document sid (ub_as_…).
    - `team_sid` string, required: Owning team (ts_tm_…, external - gs.service.id).
    - `agent_sid` string, required: The team's agent (ub_ag_…).
    - `kind` 'file' | 'website', required: file: a file the team uploaded; website: a start address and the pages under it (a help center is a website).
    - `title` string, required: The name the list shows: a file's name until renamed, a website's host and path.
    - `status` 'reading' | 'read' | 'failed', required: reading while a parse runs (progress says page n of m), read once a parse finished (its answers wait for the OK or are in Knowledge), failed with the reason in failure.
    - `instruction` string, nullable, required: How the parse reads it, in the person's words, up to 600 chars: what to read out, what to skip, how exact. Suggested from the first pages (suggest_agent_source_instruction), edited by the person; null until one is written.
    - `file` object, nullable, required: A file's file; null for a website.
      - `name` string, required: The file's name as uploaded.
      - `format` 'pdf' | 'docx' | 'txt' | 'md', required
      - `mime` string, required: Its media type as uploaded.
      - `bytes` integer, required: Its size, 20 MB at most.
      - `pages` integer, nullable, required: Its pages (a PDF's, a Word file's as Word counted them); null for a text file.
    - `website` object, nullable, required: A website's address, scope, refresh and pages; null for a file.
      - `url` string, required: The start address.
      - `scope` string, required: The path under which pages are read; / for the whole site.
      - `refresh` 'weekly' | 'daily', required: How often it is read again by itself.
      - `pages` integer, nullable, required: How many pages the last read took; null until read.
    - `progress` object, required: How far the parse got: page n of m ("Reading, page 9 of 22"); 0 of 0 before the pages are known.
      - `done` integer, required
      - `total` integer, required
    - `failure` object, nullable, required: Why the parse gave up; null unless failed.
      - `reason` 'unreadable' | 'no_text' | 'too_large' | 'website_unreachable' | 'nothing_found' | 'model_failed', required
      - `message` string, required: What to do, in the words the list shows.
    - `read_at` string, nullable, required: ISO 8601 UTC of the last parse that finished; null until then.
    - `next_refresh_at` string, nullable, required: A website: ISO 8601 UTC of its next read by itself; null for a file.
    - `created_by` object, required: Who added 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.
    - `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)
