---
title: "Suggest how to read a document"
method: POST
path: "/api/agent-sources/{sid}/suggest-instruction"
tags: ["agent_sources"]
---

# Suggest how to read a document

`POST /api/agent-sources/{sid}/suggest-instruction`

## Request

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

Suggest how to read a Knowledge document from its first pages (one model call, metered as a draft): the instruction is written on the document and answered in result.instruction, for the person to edit before the parse. 503 composer_unavailable when the model did not answer.

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

## Path parameters

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

## Response `200`

`action` success envelope.

- SuggestAgentSourceInstructionResponse
  - `success` true, required
  - `operation` 'action', required
  - `action` string, required: kebab-case verb; matches the route segment.
  - `item` object, nullable, 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.
  - `result` object, required
    - `instruction` string, required: The instruction suggested, as written on the document.
  - `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)
