mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-21 13:00:04 +08:00
* feat(v2): download run output files by API key
Adds GET /api/v2/workflows/{id}/runs/{runId}/files/{fileId}, closing the
async-run loop for headless callers. A run's output carries UserFile URLs
pointing at /api/files/serve/..., which rejects x-api-key outright, so an
async run that produces a file previously had no byte path out for an API
key at all.
The file is addressed by the id the run reported and resolved against the
run's own recorded execution data, from which the storage key is read. The
request never supplies a storage key, so the endpoint cannot be aimed at
bytes the run did not produce. Resolution deliberately reads the
materialized-but-undisplayed recording, because the display projection
strips exactly the `key`/`context` fields a byte read needs.
Also hardens normalizeStartFile to derive a file's storage key only from a
validated internal serve URL, discarding any caller-supplied `key`/`context`.
A workspace API key has no human subject, so the executor resolves its actor
to the workspace billing owner (preprocessing.ts -> resolveSystemBillingAttribution);
verifyFileAccess then authorizes a workspace-context key as that owner, whose
reach is not bounded by the key's workspace. Accepting an attacker-authorable
key made that substitution exploitable as a confused deputy. Normalization is
all-or-nothing, so a forged file now drops the whole files input.
* feat(workflows): one graph-write door, principal-derived audit source, and v2 authoring endpoints
Extract replaceWorkflowNormalizedState as the single persistence primitive for a
workflow graph replace and route both the internal editor save and the Copilot
edit tool through it, so neither can skip state preparation, the row lock, the
lastSynced stamp, or custom-tool extraction by choosing a different entry point.
Derive the audit source from the acting principal instead of hardcoding
'copilot', then widen workflows.variables.apply_operations and
workflows.bulk.move to every principal kind.
Add GET/PUT /api/v2/workflows/{id}/state, POST /operations, /duplicate,
/restore, PATCH /variables, and POST /api/v2/workflows/move over surface-neutral
application use cases; move the edit engine to lib/workflows/editing.
* test(workflows): cover the graph-write primitive, audit source, and the v2 authoring surface
Pin the two-doors fix (preparation runs, the row is locked, custom-tool
extraction is post-commit and best-effort) and the false-audit fix (a session
principal writes source: 'session', a delegated one writes its service). Both
were verified to fail with the fix reverted.
Add the application matrix for replaceWorkflowState, applyWorkflowOperations,
readWorkflowGraph, and restoreWorkflow — role floor, principal-kind rejection
before canonical load, asserted-scope concealment, lock, validation, atomic
conflict, plan gate, and audit-then-notify ordering — plus route tests for
every new endpoint.
* test(workflows): pin the internal graph-write door and the v2 list scope
Characterize saveWorkflowNormalizedState's statuses, messages, and notification
after the persistence extraction, and cover the new scope filter on
GET /api/v2/workflows including a cursor replayed under a different scope.
* feat(api): add v2 block, tool, connector-type, and enrichment catalogs
Adds six read endpoints under /api/v2 that publish Sim's code-defined
catalogs: GET /blocks, GET /blocks/{blockId}, GET /tools,
GET /tools/{toolId}, GET /connector-types, and GET /enrichments.
These read like static reference data and are not. What a caller may
place is decided per workspace by its permission-group integration
allowlist, per organization by which unreleased blocks have been
revealed, per deployment by ALLOWED_INTEGRATIONS, and per workspace
again by the workflows it has deployed as blocks. So all six are plain
defineWorkspaceOperation reads at minimumRole 'read' with
workspaceApiKey 'allow' — the exact policy of credentials.providers.list
— and every response keeps Cache-Control: private, no-store, because an
unrevealed preview block's existence must not leak across organizations
through a shared cache.
Trigger blocks ride as ?capability=trigger rather than a second
endpoint, and workspace custom blocks ride inside /blocks discriminated
by `source`, so "what may I place?" stays a one-call question.
The block projection is extracted out of the Copilot get_blocks_metadata
tool and rewritten onto @/tools/metadata and @/tools/metadata-outputs.
That cuts the tool's own @/tools/registry edge as a side effect: its
module graph drops from 6,756 to 1,318, and the new routes land at
1,673-1,734, next to the shipped /v2/credentials/providers baseline of
1,668.
Supporting changes:
- scripts/sync-tool-metadata.ts derives hostedApiKey ('always' |
'conditional' | 'none') from each tool's `hosting`. The config itself
stays excluded because it holds closures, but "does Sim host the key"
is a first-order authoring question, so the answer is emitted.
- getCopilotToolDescription takes hostedApiKey as an option instead of
reading `hosting` off the tool, so both an executable ToolConfig and
the generated metadata can answer it through one shared derivation.
- principalUserId / allowedIntegrationTypes move out of
lib/credentials/application/provider-catalog.ts into
lib/integrations/principal-scope.server.ts. Two copies of the
workspace integration gate would diverge first on the workspace-key
path, which has no user for permission groups to key on.
- scripts/check-tool-registry-boundary.ts walked page.tsx/layout.tsx
under app/workspace only, so a route importing the executable registry
passed green. It now walks a list of entry sources, seeded with the
four catalog route subtrees and the shared projection barrel. Routes
are covered per subtree rather than wholesale because 122 of ~1,130
route files legitimately execute tools.
Registry sweeps parse every block, tool, connector type, and enrichment
through its published response schema and compare against the wire
round-trip. They caught a real drift while being written: an operation's
inputs were typed as a union of the tool-param and block-input shapes,
and the union resolved to whichever member matched first, silently
dropping a block input's `schema`.
* docs(api): stop publishing a 413 GET /workflows/{id}/state cannot emit
* feat(v2): read upload-session state
Adds GET /api/v2/files/uploads/{uploadId}. Only DELETE was exported, so a
caller that lost track of a transfer could abort it but could not ask
whether the session was still alive, already finalized, or failed — the
resume story was missing.
Runs on a new files.upload.read operation at minimumRole 'read' rather than
reusing uploadCancel, which is a 'write': asking about a session must not
require permission to destroy it. The GET is a control leg like every other,
so it carries the signed upload token and re-authorizes the caller's present
workspace permission through reauthorizeWorkspaceUploadPurpose instead of
resolving the session on its id alone.
* fix(api): reconcile v2 catalog and workflow-authoring integration
Merging the catalog and workflow-authoring branches surfaced four issues
that neither produced in isolation.
- Route and OpenAPI counters were bumped to the same value on both
branches, so git merged them as one change while the merged tree holds
the sum. Corrects the route ratchet to 1142 and the workflows document
to 29 operations (152 total), then regenerates the OpenAPI documents
and the CLI surface from the reconciled contracts.
- The seven new workflow operations were published in the spec but absent
from the workflow API reference groups, which `check:openapi` rejects.
- `route-policies.ts` reached `WorkflowOperationsNotAppliedError` through
`apply-workflow-operations`, dragging the edit engine — and its diff and
comparison dependencies, which reach a client OAuth hook — into every
route that uses the shared workflow error policies. The class moves to
its own leaf module, mirroring `WorkflowImportError`, and each importer
now takes it from there.
- The operations route test shadowed that class inside its module mock, so
`instanceof` matched a fake and the assertion pinned a message the
production class never emits. It now uses the real class and asserts the
real message.
* feat(v2): extract ZIP archives over the public API
Adds POST /api/v2/files/{fileId}/extract and widens files.extract_archive
from principalKinds ['session'] / workspaceApiKey 'deny' to admit personal
and workspace API keys at the unchanged 'write' role.
The widening is an authorization change, so the justification lives in the
operation's TSDoc: extraction grants no capability an API key lacks, since
every file it writes could be created one at a time through files.create and
files.upload.create, both already 'allow' at the same role. It only collapses
many calls into one. The previous ['session'] restriction read as an artifact
of the UI having been the only caller. Delegated services stay out — no
copilot or executor caller exists and admitting one is a separate decision.
The response is counts plus the destination folderPath, never the extracted
files: a large archive would otherwise materialize thousands of objects into
one body. Callers page GET /api/v2/files?folderPath=... instead. The use case
returns the internal display path and the adapter projects it to a v2 path,
keeping the use case surface-neutral.
* feat(v2): extract file text over the public API
Adds GET /api/v2/files/{fileId}/text. Text extraction previously sat behind
checkInternalAuth on /api/files/parse, a route that also mixes in external-URL
fetching, execution-file upload, and multi-file aggregation, so it could not be
reused. The parse call is lifted into a thin application use case instead.
Runs on the existing files.read_content operation unchanged — it is already
workspaceApiKey 'allow' at the read role, and turning bytes it already
authorizes into text grants no further reach.
`degraded` is a required, non-optional boolean on the response. The legacy doc
and ppt parsers deliberately return best-effort or placeholder content rather
than throwing, so an omittable flag would let a client that never checks it
treat guessed text as extracted text. It is reported honestly rather than
converted into an error, because the parsers' behaviour is deliberate and
characterization-tested.
The read is bounded on its input at 25 MiB before extraction rather than on its
output after, given the parsers' documented DoS history; a caller may lower the
ceiling but never raise it.
* feat(v2): restore archived folders and list the archived set
DELETE /api/v2/files/folders archives recursively, so a recursive delete was
unrecoverable over the API: the archived files stayed visible through
GET /api/v2/files?scope=archived, but nothing could rebuild the folder
structure.
Adds POST /api/v2/files/folders/restore, path-addressed like the rest of the
v2 folder family, and a `scope` selector on the folder list so a caller can
find the archived path to hand it.
`scope` extends the files folder-list query rather than the shared
v2ListFoldersQuerySchema: only workspace files have an archived folder set, so
adding it to the shared schema would give tables, workflows, and knowledge a
parameter they ignore. GET /api/v2/files/folders is a FULL_SET_LIST, not paged,
so no cursor binding changes — list-pagination.test.ts passes unchanged.
Restore resolves the archived folder from its path by scanning the archived
set rather than walking the live tree, which by definition does not contain
the folder being restored. The folder-restored analytics hook now reports the
folder actually restored rather than the requested selector, which carries no
id on a path-addressed surface.
* feat(v2): bulk-download a file selection as a zip
Adds GET /api/v2/files/bulk-download, an adapter over the existing
downloadWorkspaceFileItems use case and its internal binary route.
Path collision: a static segment beside [fileId] permanently shadows a file
whose id equals it, and workspaceFileIdSchema does accept [A-Za-z0-9_-]+.
Rather than invent a new shape, this follows the existing bulk-delete sibling:
the hyphenated form cannot be produced by either minted id shape (UUID v4 or
wf_<shortId>), so the shadowed id is unreachable in practice. Documented on
the contract so the reasoning is not lost.
Folders are addressed by path, matching the rest of the v2 file surface. The
paths resolve against the folder set the selection already loads, so it costs
no extra query, and a path matching no folder is rejected rather than silently
dropped — a misspelled folder must not yield a zip of whatever else was
selected. The empty-selection and folder-count guards now account for
folderPaths, which a path-only selection would otherwise have tripped.
Selections are comma-separated only: v2 rejects a query parameter sent more
than once, so a repeated-parameter form would never reach the schema. Pinned by
a test so the contract cannot advertise a form the boundary rejects.
* feat(v2): expose run output files and optional inline bytes on the runs read
GET /api/v2/workflows/{id}/runs/{runId} now reports the files a run produced,
each with the downloadPath that fetches its bytes, and can inline them as
base64 on request.
Gated by includeOutput, matching `output`'s nullability: a caller that did not
ask for output does not receive a file list it did not request. The async
execute request's rejection of includeFileBase64 is deliberately left alone —
at submit time the run has not happened, so there is nothing to inline; reading
a finished run is the first moment the question means anything.
Inlining is capped per file at the executor's 16 MiB inline ceiling, which a
caller may lower but never raise. A file above it answers 413 naming that
file's downloadPath, so the caller is told exactly how to get the bytes rather
than being left stuck.
The descriptor deliberately omits the storage key — files are addressed by id
and the key is re-derived from the run's recording — and omits an expiry, which
the recording does not carry and which would be fabricated if published.
The route becomes headSafe: false, since inlining reads object storage. The
builder enforces that this requires the use case to expose authorize(), so HEAD
still answers from a real authorization rather than from authentication alone.
* feat(v2): permanently delete an archived file
DELETE /api/v2/files/{fileId} only archives — the OpenAPI says its stored bytes
are never removed — so there was no way to actually destroy a file over the API.
Adds the repository primitive, application use case, operation, and
DELETE /api/v2/files/{fileId}/permanent.
A distinct path rather than a flag on the ordinary delete: a query parameter
that turns a recoverable archive into an irreversible destruction is set by
accident, and the two acts carry different minimum roles, which one route
declaration cannot express. The file must already be archived; a live file
answers 409 naming the archive step, so no single request can turn a live file
into lost bytes.
minimumRole 'admin', which forces workspaceApiKey 'deny' since the workspace-key
ceiling is 'write' — the desired policy anyway: unattended credentials should
not destroy bytes.
Row first, then object. The two legs commit independently, so one can survive a
crash between them: deleting the row first leaves at most an orphaned object for
the storage sweep, while the reverse would leave a live row pointing at bytes
that no longer exist — a file that lists and opens but can never be read. A
failed object delete is therefore reported as objectDeleted: false rather than
thrown, because the request has genuinely succeeded once the row is gone. Both
directions are pinned by failure-injection tests, verified to fail when the
order is reversed.
Audited as a distinct FILE_PERMANENTLY_DELETED action, not a reuse of
FILE_DELETED, which records the recoverable archive step.
* feat(api): v2 log analytics, itemized cost, filters, and sortable query
Adds the aggregate and rich-read halves of the public logs surface, and
fixes three defects the existing reads carry.
Aggregate analytics. `GET /api/v2/logs/stats` returns time-bucketed run
counts, success rate, error count, mean latency, and the window bounds,
per workflow and for the workspace. The first-party route was a raw
handler with inline SQL and inline aggregation, so it is split into a
repository (`lib/logs/stats-queries.ts`), a pure aggregator
(`lib/logs/stats.ts`), and an application use case. That route keeps its
legacy authorization — it answers a caller without workspace access with
a zeroed 200, where v2 conceals the workspace as a 404 — and consumes
only the two surface-neutral halves.
`segmentCount` had no `.int()`, `.min()`, or `.max()`, so `0` divided by
zero and `1e9` allocated two billion-element arrays: both caller-reachable
500s. Bounded on both contracts. `workflows` is capped, with the workspace
totals still computed from every workflow and the cut reported as
`workflowsTruncated`.
Detail reads gain the itemized `cost.items` ledger (`null` and `[]` are
distinct answers and both reachable) and `workflowInput`, restoring a
v1→v2 regression.
The list gains `workflowName` and `status` filters, and `includeJobRuns`,
which unions Chat and Sim-agent job runs into the sequence behind a new
`kind` discriminator — without it a job run is indistinguishable from a
run whose workflow was deleted. A filter no job row can answer drops the
branch outright rather than meaning two things across the union.
`POST /api/v2/logs/query` carries the additional sort columns. `GET /logs`
is untouched: its single `order` param rests on there being exactly one
sortable column, and both escapes from that are ruled out, so the rich
read gets its own endpoint — the split the table surface already ships.
It uses the shared keyset scheme with the two nullable sort columns read
through a sentinel, since a keyset cannot compare against null.
`folderPaths` now covers a folder's whole subtree on the public path, as
it already did everywhere else; it previously omitted every nested run
with no error. The path strings did not change, so a folder-scope version
is stamped into the cursor and in-flight tokens restart rather than
silently skipping rows.
Also fixes `folderName`, which ILIKEd `workflow.name` — a copy of the
clause above it — and so searched workflow names instead of folders.
`buildLogSortCursorCondition`'s `IS NULL` disjunct is documented and
pinned: under `NULLS LAST` the null block is only reachable through it,
so removing it as a duplicate-row fix makes those runs unpageable.
Ratchets: route count 1142 -> 1144; logs OpenAPI operations 2 -> 4; total
operations 152 -> 154.
* feat(api): v2 tables run state, dispatch polling, batch update, bulk, archive
Closes the headless gaps on the v2 tables surface.
- Per-cell run state is now readable through an opt-in `includeRunState` on
`GET /rows`, `POST /query`, and `GET /rows/{rowId}`. The default projection
is byte-identical; a page whose sidecar outgrows its byte budget is a 413
rather than a silent truncation.
- Run dispatches are addressable: `GET /tables/dispatches/{dispatchId}`
publishes the column's full four-state domain so polling a finished run is
not a 500, and `GET /tables/{tableId}/dispatches` lists what is in flight.
- `POST /rows/batch-update` takes one distinct patch per row. Its transaction
moved out of the Copilot-only module into a surface-neutral use case both
surfaces now call.
- `GET .../enrichment/{groupId}` publishes the provider cascade, cost, and
timing behind one enrichment cell.
- `POST /tables/bulk-move` and `/bulk-delete` reach the existing bulk use
cases, which now accept folders by canonical path and resolve them inside
the application layer.
- `DELETE` is recoverable: `scope=archived` on the table list plus
`POST /tables/{tableId}/restore`.
* feat(api): expose knowledge chunks, tag writes, archive/restore on v2
Closes the knowledge cluster's remaining public-surface gaps.
Chunks: list/read/create/update/delete/bulk under
`/api/v2/knowledge/{id}/documents/{documentId}/chunks`. `queryChunks` gains
an `id` tiebreaker on every sort so the list pages on a keyset rather than an
offset — `tokenCount` and `enabled` are both non-unique, so a page boundary
inside a run of equal values used to repeat or drop the tied rows. The
internal offset caller is unchanged; the two positioning schemes share one
read.
Tag definitions: create, update, delete, next-slot, usage, and the
document-scoped save and cleanup. Without them a caller could write a tag
value into a slot with no definition and then had no way to name it, so
tag-filtered retrieval was unbuildable end-to-end. `v2KnowledgeTagSchema`
gains `id`, without which PATCH and DELETE are unaddressable. The
document-scoped DELETE is pinned to `action: 'cleanup'`: the domain's `'all'`
deletes the whole knowledge base's tag vocabulary from a document path.
Archive/restore: `GET /api/v2/knowledge/archived` as a sibling route rather
than a `scope` param — the two reads bind different operations and a v2 route
declares one — plus `POST /api/v2/knowledge/{id}/restore`. `knowledge.restore`
is a new workspace operation carrying `delete`'s policy, since an operation's
inverse must not be harder to reach; the internal session route now delegates
its workspace branch to the shared use case and keeps only the legacy personal
one.
Also: `POST .../documents/from-workspace-files` surfaces `addWorkspaceFiles`,
so a file already in workspace storage no longer has to be re-uploaded
byte-for-byte to be indexed; the `chunkingConfig` write widens to the
first-party five-key schema with its refines and separator bounds, while the
response stays `.catchall` so a legacy JSONB row cannot 500; and
`CONNECTOR_MANAGED_RESOURCE_READ_ONLY` joins `FORBIDDEN_DETAIL_CODES` now that
the bare 403 on connector-managed chunk writes is wire-reachable.
Document upsert is deliberately not included.
* feat(api): add v2 credential rotation and a gate-exempt capabilities endpoint
PATCH /api/v2/credentials/{credentialId} rotates service-account secret
material or renames a credential in place, preserving the credential id so
existing workflow, deployment, paused-run, connector, and webhook references
keep working. Re-posting to POST /api/v2/credentials answers 409, and
delete-and-recreate mints a new id, so rotation previously had no door.
The route is adapter-only: updateWorkspaceCredentialUseCase already owned the
rotation, its audit projection, and credentials.update. It gains one additive
assertedWorkspaceId field for the v2 workspace assertion, and the per-principal
credential-type table that deleteCredentialUseCase already applied is lifted
into requireManageableCredentialType so both operations share it. Without it a
personal API key could rename an env_workspace row and toV2Credential's throw
would surface as a caller-reachable 500.
CredentialProviderOperationError now maps to 503 with Retry-After when the
provider is unreachable, instead of the 400 its OrchestrationError('validation')
base projected. A transient outage rendered as a permanent input error invites a
caller to revoke a working credential.
GET /api/v2/meta reports the calling key's rollout cohort, type, and expiry.
It is the one route declaring the new typed gate: 'exempt' option, because the
rollout gate and the unknown-path catch-all answer byte-identical 404s and a
gated /api/v2/meta could never resolve that ambiguity. Authentication still runs
first, so the only fact disclosed is one about the caller's own credential.
* feat(api): publish deployment lifecycle and workflow-MCP v2 surfaces
Adds the four deployment-lifecycle operations v2 was missing, and the
workflow-as-MCP publishing surface, both as adapters over application use
cases that already existed.
Deployment lifecycle:
- PATCH /api/v2/workflows/{id}/versions/{version} relabels a version.
Deliberately not the internal route's body-shape dispatch between
"rename" and "promote to live".
- POST .../versions/{version}/activate promotes a version. Same use case
as rollback under a different transition, on its own path because the
two mean opposite things to a caller.
- POST .../versions/{version}/revert overwrites the draft. Accepts the
literal `active` alongside a version number.
- PATCH /api/v2/workflows/{id}/deployment toggles unauthenticated public
execution.
`workflows.public_api.update` widens from session-only to session plus
personal API key: it is an admin-role change the same accountable human
may make from a script. Workspace keys stay denied. Its EE refusal now
carries PUBLIC_SHARING_NOT_ALLOWED instead of a bare forbidden.
Workflow MCP servers:
- /api/v2/workflow-mcp-servers list, create, update, delete, plus
publish and unpublish of a workflow as a tool. Named apart from
/api/v2/mcp-servers, which registers the external servers Sim calls.
- The six mcp_servers.workflow_deployments operations widen from
['delegated'] to admit sessions and personal API keys; roles and the
workspace-key denial are unchanged.
- The server list gains keyset pagination, matching its external
sibling, since nothing caps how many a workspace publishes.
- Server, tool, and workflow reads move out of the use case into
lib/mcp/queries.
Route ratchet 1150 -> 1160; OpenAPI operations 161 -> 171.
* feat(api): extract chat deployments and publish the v2 surface
Chat deployment was a shipped module with no public API and two
authorization systems: `lib/workflows/application/chat-deployments.ts`
had deploy/undeploy extracted, but only Copilot used them — the REST
routes reimplemented workflow authorization inline, and `PATCH
/api/chat/manage/[id]` additionally owned password encryption, the
auth-type field-clearing matrix, identifier uniqueness, the
redeploy-gating protocol with two 409s, a raw db.update, and a manual
recordAudit.
New `lib/chat-deployments` domain:
- `chat_deployments.list/read/update/delete`, keyed on the deployment
whose workspace is derived by joining its workflow. Creation stays
`workflows.chat.deploy`, which is keyed on the workflow.
- The PATCH extraction, including the field-clearing matrix and the
asynchronous-cutover invariant the route had hand-mirrored from
`performChatDeploy`.
- One `buildChatDeploymentUrl`, replacing three constructions that had
already drifted onto two different host helpers. There is no chat
subdomain, so nothing publishes a host.
- Repository reads moved out of the use cases into
`lib/chat-deployments/queries`.
Internal routes are now adapters over those use cases. `GET /api/chat`
is deliberately not migrated: it scopes by `chat.userId` while every
other chat operation authorizes by workspace admin, and reconciling the
two is a product decision. `PATCH` keeps its 400 for an identifier
collision through a typed `ChatIdentifierInUseError`; v2 reports the
409 the condition actually is.
v2 surface at `/api/v2/chat-deployments`: list, create, read, update,
delete. Workspace-scoped, keyset-paged, and a stored password is never
readable — reads carry `hasPassword` only, and the session-only reveal
endpoint deliberately has no v2 counterpart.
Also: an email- or SSO-gated chat with an empty allow-list is now
refused in the use case rather than only at the internal boundary, since
it is unenterable; and the doc comment on `processHostedKeyCost`
claiming a `usageLog` write is corrected — no such write exists.
Route ratchet 1160 -> 1165; OpenAPI operations 171 -> 176.
* fix(api): close three review findings, two of them caller-reachable
- Run output files are filtered to keys under the run's own execution
prefix. The recording they came from is not a trustworthy key source:
the start block copies every caller-supplied input field verbatim into
its output and `collectUserFilesById` accepts anything carrying the
`UserFile` shape, so a caller could name any storage key and have the
download and base64 paths — neither of which authorizes per file — serve
it back.
- `getBlock` reads own keys only. `BLOCK_REGISTRY` is an object literal,
so `constructor`, `toString` and friends returned inherited functions
that every consumer then treated as a block, turning a path segment into
a 500. `getToolMetadata` already guarded this way.
- A folder-scoped log page no longer unions in every job run in the
workspace. The guard read `filters.folderIds`, which the public surface
never sets — it carries the folder filter in `folderScope` — so the page
contradicted the contract's promise that job runs are dropped whenever a
filter they cannot answer is set.
Also: the log cursor stamps `includeJobRuns` only when it is on, so its
`.default(false)` no longer puts a constant in every fingerprint and
rejects cursors minted before it existed; and the `folderName` subquery is
scoped to the workspace and to workflow folders instead of scanning the
whole `folder` table.
* fix(api): close two more review findings, one an authorization bypass
- `workflows.operations.apply` no longer admits a workspace API key. The
use case authorizes against three per-user policies — the EE permission
config, block visibility, and credential reachability — and all three
take a human subject. An actorless key has none, and both substitutes
fail open: attributing to the workspace billing owner evaluates the
batch as the least-restricted account in the workspace, and passing no
user makes `getUserPermissionConfig` return `null`, which every caller
reads as unrestricted. Either way a workspace constrained by an
allowlist was edited as though it were not. Personal keys keep the
capability, so headless editing is unaffected for a credential that
names a human.
- `GET /workflows/{id}/state` reads its variables through
`parseWorkflowVariables`, and the stored variable response schema drops
the two assertions the column cannot honour. The column has carried a
JSON string and a legacy array as well as the current record, the
realtime `variable.add` op types `type` as `z.any()`, and the parser
writes `name` through verbatim — so the input bounds on the read turned
a stored workflow into a 500 on the endpoint that opens it. The write
schema keeps them, which is where they can still be honoured.
- `GET /workflows?scope=archived` projects folder paths tolerantly.
Archiving a folder cascades onto the workflows inside it but leaves
their `folderId` dangling — which is why restore has to null it — so the
strict projector threw a bare `Error` and took the whole page down with
no cursor able to step past the row.
* fix(files): bind Start-block file keys to the executing workspace
The Start block derived a file's storage key by parsing the caller's own
`url`, which `isInternalFileUrl` matches on any host and
`extractStorageKey` returns verbatim — so a request body could name any
tenant's bytes. The key is now accepted only when its own layout names
the workspace the execution runs in, and every file is dropped when the
execution carries no workspace.
Also bounds `includeFileBase64` with an aggregate response ceiling and a
worker pool instead of an unbounded `Promise.all`, scopes the bulk
download's authorization resource to the workspace when folder paths are
requested, makes the folder-restore selector mutually exclusive at the
type level, and names the bound in the `maxBytes` validation message.
* fix(api): close v2 log review findings
Cursor scope: `scope` on the workflow and table lists carries
`.default('active')`, so it entered every fingerprint as a constant and
refused every cursor minted before the param existed — with the
"cursor does not match the requested filters" 400, which is actively
misleading for a caller that changed nothing. Both now stamp the
default as absent, so only a caller who asked for `archived` gets a new
sequence.
Dashboard stats: `maxWorkflows` capped the response, not the
allocation. Segment series are now densified after the cut instead of
before, so returning 200 series no longer materializes one
`segmentCount`-length array per workflow in the window. The aggregate
still sums every workflow, now from the sparse per-workflow maps.
Cost keyset: `cost_total` is an unconstrained `numeric`, so its anchor
travelled through `Number()` and was compared back at full precision —
rows differing beyond float64 collapsed onto one anchor. Adds
`decimalKey`, which carries the digit string and binds it `::numeric`.
Run detail: `cost_total` is a backfilled projection, so a run predating
the backfill reported `cost: null` even with a real ledger, making
`items` unreachable for exactly the runs the ledger explains. Falls
back to the ledger total.
Also caps the log folder-path index reads at MAX_FOLDERS_PER_WORKSPACE
like every other reader, publishing the folder-tree 413 on the four log
operations; reverts a dead `status` widening in `v2CommaListSchema`;
drops an unread `executionData` select; corrects the segment-count and
searchLogs prose; and replaces the sort-cursor SQL-text assertions with
a two-page walk over a fixture with a null block.
* fix(api): close knowledge v2 review findings
- widen knowledge.list_archived to the delete/restore policy so a workspace
API key can discover what it may restore
- escape LIKE wildcards on the now-public chunk search
- derive tag slot capacity from TAG_SLOT_CONFIG per field type
- type updateKnowledgeBase's chunkingConfig as ChunkingConfig and project
every declared field explicitly
- attribute a restore to the calling surface instead of a literal 'api'
- gate 'knowledge chunks batch-update' behind --yes, since it can delete
- present the tag-cleanup action from the parsed request rather than
faulting on the domain result after the delete committed
- unbind asserted-scope workspaceId from the nested knowledge cursors,
matching the table-row lists
- add executed-SQL coverage for the chunk keyset
* fix(catalog): close the catalog and registry-boundary review findings
The module-graph ratchet treated an entry with no baseline row as
informational, so the six catalog routes and the projection barrel were
unratcheted while the summary still read "within their module-count
baseline". An unbaselined entry now fails --check, the summary counts only
what was actually compared, and the baseline is re-recorded.
The Copilot block-metadata tool — the reason the shared projection exists,
6,756 modules down to 1,321 — was in no guarded subtree. It is now an entry
source and a catalog boundary root.
Catalog behaviour:
- hostedApiKey is gated on the deployment, so a self-hosted install reports
none instead of promising 127 tools' keys it will never supply
- block detail resolves an unversioned base type to its newest version and
projects through the viewer's visibility, so it can no longer 404 a block
the list contains or name it differently
- offset-cursor ordering compares code units rather than the process locale
- projections copy every array they publish instead of handing out the
registries' own
- an options function returning a thenable throws rather than silently
widening the providers-store substitution across the event loop
- a throwing block projection costs the Copilot tool one block, not all of them
- the trigger-kind log returns to debug: chat/manual/api are entry-point
kinds, not authoring defects
Also sweeps the custom-block detail branch against its response schema,
guards each projection module rather than the dead barrel over them, and
drops a provably dead branch in processHostedKeyCost.
* fix(workflows): close v2 workflow-authoring review findings
- Read a blockless draft back as an empty graph. `PUT /state` of
`{ blocks: {}, edges: [] }` — the contract's own published example —
deletes every block row, and the loader answers `null` for a blockless
workflow, so the following `GET /state` answered 404 while the list
endpoint still showed the workflow. Existence is the workflow row's to
decide; the null is now projected as an empty graph.
- Rewrite the `readWorkflowGraph` authorization test so it can fail. It
called `authorize?.()` and asserted only a negative, so deleting
`authorize` or replacing it with a no-op both passed — the invariant the
head-safe `HEAD` path depends on.
- Route `setWorkflowBlockEnabled` through `replaceWorkflowNormalizedState`,
the same door the other two graph writes use, instead of writing the
normalized tables itself without state preparation or custom-tool
extraction.
- Count applied operations directly. Enablement refusals landed in the same
skipped-item array and were subtracted from the operation count, which
`Math.max(applied, 0)` then masked when it went negative.
- Give a `disabled_ancestor` refusal its own member of the published skip
enum instead of reporting it as `block_locked`.
- Refuse an `atomic` batch whose credential or hosted API key would be
stripped, and carry the dropped inputs in the 409 details.
- Publish the whole lint report — `sources`, `sinks`, `orphanBlocks`,
`emptyOutgoingPorts`, `invalidBranchPorts`, `invalidConnectionTargets`,
`fieldIssues`, and the `kind` discriminator on unresolved references —
rather than only free-text reference prose.
- Stop reporting unresolved lint references as `inputValidationErrors`.
`collectUnresolvedReferences` is read-only, so those values stay
persisted; they were double-reported, and falsely as dropped inputs.
- Replace two unfalsifiable negative-principal tests, which used a
principal kind `Exclude`d from `PrincipalKind`, with a reachable one.
- Nits: drop a stranded TSDoc block; assert the membership predicate in the
selector-validator admin test; make the HEAD test assert a representation;
assert the sanitized graph is what `replaceWorkflowState` writes; add a
route test rejecting `baseGraph` in a v2 body; carry
`principalAuditSource` on restore/duplicate/moveBulk audit; unify the two
`base64MaxBytes` ceilings on `MAX_INLINE_MATERIALIZATION_BYTES`.
* fix(api): close seven v2 review findings, one an authorization bypass
Raise mcp_servers.workflow_deployments.update_server to admin: its body
carries isPublic, and a public server executes with no Sim credential, so a
write member could remove authentication from every workflow it publishes.
create_server already grants the same visibility at admin.
Pin the widened operations in registry tests — the six workflow-MCP ones,
the four workflow widenings, and files.extract_archive.
Reject secret fields on a credential that has no rotatable secret instead of
dropping them behind a 200, classify a non-transient provider 4xx as caller
error rather than a retryable outage, and reconcile a provider outage to 503
with Retry-After on all three surfaces.
Give /v2/meta a declarative principal policy through a new defineOperation
factory, carry the key expiry on the auth context instead of reading the
api_key table from the application layer, and make the impossible principal
branch an invariant error rather than a codeless 403.
Enforce the rollout-gate exemption at definition time, against the one
contract path it is reserved for, and remove the gate parameter from the
exported admission helper so the builder is its only door.
* fix(tables): bound the run-state sidecar, and close six v2 review findings
Enforces the 2 MiB run-state ceiling INSIDE the sidecar drain rather than
over its materialized result, refuses the unbounded query form paired with
it, and normalizes the two stored blobs the v2 surface publishes from bare
`as` casts.
- The run-state budget now travels into `loadExecutionsByRow`, which drains
row ids in bounded chunks and refuses before fetching the next one. The
post-hoc `requireBoundedRunState` walk is gone: it measured a spike that
had already happened, and re-serialized every entry to do it.
- Both row reads that accept `includeRunState` cap the page at
`V2_MAX_RUN_STATE_ROW_LIMIT`, and `POST /tables/{id}/query` additionally
refuses the flag paired with `limit: 0`.
- `runState.status` and the enrichment cascade blob are projected onto the
published shape before presentation; both were caller-reachable 500s on a
well-formed read.
- `sim tables bulk-delete` now gates behind `--yes`, and the CLI sweep that
should have caught it covers destructive non-DELETE forms.
- `POST /tables/{id}/restore` is idempotent (200, no audit) like its
knowledge sibling, and bulk folder selection deduplicates after resolution.
- The batch-update backstop keeps the looser Copilot ceiling and says so in
TSDoc: it is a backstop no surface reaches, because the contracts stop a
v2 caller at 1000 and the Copilot tool stops itself at 5000. Each caller
sees the bound that actually applies to it; neither surface's cap moved.
* fix(chat-deployments): close v2 chat review findings
Fixes the chat-deployments slice of the v2 review, several of which are
regressions the application-operation extraction introduced.
- Stop a `500` on schemaless JSONB: the response now declares a stored
shape without bounds and `toV2ChatDeployment` projects
`customizations`, `outputConfigs`, and `allowedEmails` onto it. The
request schemas keep `.strict()` and their bounds.
- Restore the specific validation message on `POST /api/chat` and
`PATCH /api/chat/manage/[id]`, and the deleted test that pinned it.
- Restore `chat_deployments.read` to workspace `admin`; the detail read
serves the visitor gate.
- Narrow the list projection so `chat_deployments.list` can stay a
`read` operation reachable by a workspace API key: `allowedEmails`,
`hasPassword`, and `customizations` are gone from the list entry and
available only from the admin-gated detail read. Serialized field by
field so a field added to the detail shape cannot reach the list by
default.
- Classify create-path failures: `performChatDeploy` carries an
`errorCode`, so an in-flight deployment is a `409` and an invariant
failure a `500` instead of every refusal being a `400`.
- Delete the callerless `GET /api/chat`, which served the encrypted
password column with no response contract.
- Propagate undeploy infrastructure failures instead of concealing them
as `404`, and return `ChatDeploymentView` from both delete paths.
- Name `CHAT_AUTH_MODE_NOT_PERMITTED` on the create path.
- Guard `getBaseUrl` inside `buildChatDeploymentUrl`, which otherwise
throws on a self-host with no `NEXT_PUBLIC_APP_URL`.
- Correct the published allow-list claim: a replacement `allowedEmails`
is applied after the auth-type clear, so it does survive.
- Assert `workspaceId` on the v2 detail routes and reconcile the
concealment TSDoc with what the error policy actually renders.
- Move `resolveActiveWorkspaceApplicationContext` to the workspaces
domain so chat-deployments no longer imports workflow application code.
* test(credentials): pin the reconciled provider-outage status
The internal route alone answered 502 where the v2 surface, the shared
status helper and `PROVIDER_OUTAGE_CODES`' own TSDoc all say 503. The
test pinned the divergence; it now pins the reconciliation, including the
`Retry-After` a 503 carries. Corrects a stale comment that still named
502 as the value callers see.
* fix(executor): restore cloud-storage Start files, dropped by the key rule
The ownership check accepted a key only when it could be parsed out of an
internal `/api/files/serve/...` URL. But the server-side uploader for run
inputs returns a *presigned cloud* URL whenever object storage is
configured, whose path is the bucket key — so every chat-deployment
attachment, API `files[]` payload and generic-webhook file field resolved
no key, and because normalization is all-or-nothing the entire `files`
input was dropped with no error. It passed locally and under vitest only
because the uploader falls back to an internal URL when no object storage
is configured, which is exactly why no test caught it.
The test is ownership, not provenance: a key is accepted when its own
layout names the executing workspace, whether it arrives directly or is
parsed out of the URL. Neither field has to be trusted, since both are
caller-authored and both are held to the same check. A payload whose key
and URL disagree is refused rather than resolved in the caller's favour —
a genuine uploader writes the two consistently, so only a forged pairing
is turned away.
`context` is now derived from the accepted key rather than read from the
payload or the URL's `?context=`, so an owned key can no longer be
labelled with a bucket its bytes do not live in — the hardening the
previous comment claimed but did not perform.
* fix(api): close four defects the fix pass introduced
- `resolveLatest` built a `RegExp` from the caller's block id and read the
registry with a bare lookup, so the catalog detail route — moved onto it
by the version-alias fix — routed around the `ownBlock` guard added for
exactly this. `GET /api/v2/blocks/%5B` was a `SyntaxError` 500 and
`.../constructor` an inherited function. Matched by string comparison
now, the way `tools/tool-ids.ts` resolves the same convention, and read
through `ownBlock`.
- The run-state byte budget was applied inside `queryRows` rather than at
the callers that publish it, so the first-party table grid — which reads
run state at five times the row limit and publishes no ceiling — turned
a large page into a hard failure, with an error naming a parameter it
does not expose. The budget is now an explicit option the public reads
pass and internal callers omit.
- Three graph-write CLI commands shipped ungated because the sweep meant
to catch them matched only the names already enumerated, so it could
never fail. It now forces every non-`GET` operation into a destructive
or non-destructive list, and the three carry confirmations.
- Unbinding `workspaceId` from the knowledge-documents cursor was right on
the merits and wrong in effect: the value is constant per sequence, so
removing it changed the fingerprint and refused every cursor already in
flight. Restored there; the chunks list is new in the same change and
keeps the cleaner reading.
* fix(api): resolve a detail read to a version the viewer can see
`getLatestBlockForViewer` took the newest version and then hid it, which
inverted the contradiction it was written to close: `slack_v2` and
`table_v2` are preview-gated while their v1 deliberately stays in the
toolbar, so an unrevealed viewer got a `404` on a detail read for a type
`GET /api/v2/blocks` was listing in the same breath. It now walks versions
newest-first and answers with the first one visible to that viewer.
Also:
- The chat password guard ran after `performFullDeploy`, so a request that
could never succeed burned a real workflow deployment version and then
answered 400. Its two sibling gate guards already refuse ahead of the
deploy; this one now does too.
- The Copilot sub-block serializer published the registry's own `options`
and `dependsOn` arrays by reference. Pre-existing, but the catalog
projection this parallels copies every array it publishes precisely
because they are process-global and shared by every request.
* fix(api): restore the locked read-modify-write and the password validator
Two findings verified as real regressions against staging, out of ten
checked — the rest were pre-existing, latent, or false.
`setWorkflowBlockEnabled` read the graph outside the row lock and wrote it
back inside a later transaction. The editor's own save takes that same
lock, so an autosave committing in the window was silently discarded: this
operation writes a whole graph, not a delta. The persistence primitive now
accepts a reader that runs after the lock is taken, and the toggle
re-reads and re-decides there. Its lock predicate is also scoped to the
workspace and to a live row again, so a workflow archived mid-flight is
refused rather than written.
The v2 chat-deployment contracts inlined their own password rule twice
instead of using `chatDeploymentPasswordSchema`, losing the refusal of a
whitespace-only password — which the internal contract rejects precisely
because it strands the deployment behind a password the visitor form will
not submit. Both sites use the canonical validator now.
* fix(api): one folder projection, one dynamic-provider list, honest 413s
- `toV2Folder` existed twice, and the second copy had been written without
the name/path invariant — so a row the list read refuses loudly would
have been served with a mismatched pair by the restore read. One
definition, guard included.
- The catalog projection restated `DYNAMIC_MODEL_PROVIDERS` and had
drifted by one member. Derived from the canonical list instead.
- The tables reads documented a `413` for run state that they cannot emit
— the budget became opt-in, and the row limit is the bound now — so the
claim is removed rather than declared. The workflow run read has the
opposite problem: it genuinely emits one, on a single file *or* the
run's inlined total, and declared neither. Now declared, and the
sentence covers both.
- Reclassifies the operations staging added into the destructive sweep, so
the triage stays exhaustive.
* fix(v2): classify storage and uniqueness failures, drop permanent file delete
- remove the permanent file-delete endpoint; the platform offers no such
action in the UI, and its manager wrote outside a transaction with no
storage accounting
- extract a generated document's text from its compiled artifact rather than
its generation source, matching the download path; a `.pdf` source was a
500 and a `.docx` source returned generator JavaScript as clean content
- report a run file whose object retention has already swept as 404 rather
than 500, on both the inline base64 read and the download stream
- report a knowledge tag that loses at a unique index as 409, naming whether
the slot or the display name is taken
- gate `workflows versions revert` behind a CLI confirm; it overwrites the
draft graph and was classified non-destructive
* feat(v2): report lint from both graph writes and add dry-run previews
- `PUT /workflows/{id}/state` now returns the same `lint` report as
`POST /operations`; an agent authoring a graph from scratch needs the
findings at least as much as one editing incrementally
- extract the report into one shared builder so the two writes cannot drift,
and one shared presenter so the wire shape is identical
- skip the credential/tool reference pass when the caller has no human
subject, rather than resolving it against the workspace billing owner:
that would misreport what the workflow can reach and disclose another
person's grants. `lint.notes` says when it was skipped
- add `?dryRun=true` to both graph writes: validates and lints, persists
nothing, records no audit, notifies nobody. A query param, not a body
field, since the body of a PUT is the resource itself
- CLI: a dry run no longer demands `--yes`; requiring confirmation to preview
a change teaches callers to pass `--yes` reflexively
- CLI: name the graph commands for their verbs — `workflows state get`,
`workflows state replace`, `workflows operations apply` — instead of the
derived `state list` / `state update` / `operations create`
- document when to use `rollback` vs `versions/{version}/activate` on both
* chore(docs): sync generated docs manifest for the new CLI pages
* feat(v2): add the missing workflow-MCP reads and align bulk naming
- add `GET /workflow-mcp-servers/{serverId}` and
`GET /workflow-mcp-servers/{serverId}/tools`. The resource could be
PATCHed and DELETEd but never read, and its tools could be published and
unpublished but never listed — the server list reports tool names only, so
nothing published the `workflowId` that addresses a tool for deletion.
Both mirror `mcp-servers` beside them, and carry that family's
workspace-API-key denial rather than the wider `mcp_servers.read` policy
- rename `POST /tables/bulk-move` to `POST /tables/move`, so tables matches
the shipped `files` resource exactly (`move` + `bulk-delete`)
- name the CLI commands for their operations instead of the derived
`... create`: `tables move`, `workflows move`, `tables bulk-delete`, and
`tables rows update-each` for the per-row batch, which sits beside the
existing filter-based `tables rows batch-update`
`POST /tables/{id}/rows/batch-update` keeps its name: a distinct payload per
resource is precisely AIP-234 BatchUpdate, and `bulk-` would have collided
one word away from the filter form.
* fix(v2): correct documented statuses and a caller-reachable 500
- duplicating a workflow into a locked destination folder answered 500:
`FolderLockedError` is a plain Error carrying `status = 423`, which the v2
error policy does not classify. Converted to OrchestrationError('locked')
at the application boundary, matching the bulk-move path
- restore workflow promised a 413 for an oversized folder tree that its
response list never published; the cap is real, so the status now is too
- move workflows and apply variables documented 409/423 they cannot emit:
every per-item lock and conflict is reported in `failed`, not thrown
- bulk download and delete knowledge tag can both 409 and did not say so;
cleanup tag definitions cannot and did say so
- apply workflow operations denies workspace API keys but never documented it
- the dry-run responses are not byte-identical to a committed write:
`needsRedeployment` describes the pre-write state and persistence warnings
cannot appear. Reworded rather than overclaimed
- read file text and get file upload are head-safe, so the "HEAD skips the
effect" sentence did not apply to them
* fix(v2): guard tag field-type changes and publish the 415 every body route can return
- `PATCH /knowledge/{id}/tags/{tagId}` accepted a `fieldType` incompatible
with the slot the tag already occupies. Slots are enumerated per field
type, so a text tag could be relabelled `number` and every later read
would interpret its values as the wrong type. Create checked this; update
now runs the same two checks
- derive `415` from the contract the way `413` already is: the JSON builder
answers UNSUPPORTED_MEDIA_TYPE for any body under a content type it cannot
read, so all 100 body routes could return a status none of them published
- give version activation its own result component instead of publishing it
as `RollbackResult`; the shipped rollback keeps that name
- correct descriptions that promised behaviour the code does not have: a
`processingStatus` field never returned, a `gmail_send` resolution example
that short-circuits, bucket widths that overflow the window, a bulk tag
save that relocates rather than overwrites, and per-server tool names
actually gathered under a page-wide budget
- drop 409 from three knowledge and upload reads that cannot emit it
* docs(v2): correct the upload transfer contract and 16 other published claims
The upload transfer step was documented as Sim's own data plane on every
deployment: "success is 204" and "a failure is the v2 error envelope". That
holds only when Sim stores objects itself. With object storage configured the
URL is the provider's presigned URL, so S3 and GCS answer 200 and Azure 201,
and a failure is the provider's XML — a client written to the old text reads a
successful cloud upload as a failure. Also states that part ETags do not need
retaining: completion takes no body because Sim lists the parts from the
provider itself.
Other corrections, all to shipped descriptions rather than behaviour:
- DELETE table and bulk-delete files archive rather than erase, and neither
said so; bulk delete also cannot emit the 409 it declared
- complete knowledge upload published a 402 only the create leg can raise
- billing status conceals a foreign workspace id as 404, not the 403 its
TSDoc and description both claimed
- audit entries null a folder's resourceId and strip folder ids from metadata
at every level; neither redaction was documented
- details=full adds the workflow summary to workflow runs only, never to job
runs; GET /logs folderPaths covers a subtree like its two siblings; getLog
now carries the retention sentence
- list secrets returns description too, and the logs and resources documents
described only part of what they serve
* improvement(api): consolidate the v2 surface and close seven defects
Endpoint consolidation:
- Fold POST /logs/query into GET /logs; add sortBy/sortOrder, cap the
comma lists, and move the list onto the shared keyset codec
- Fold GET /knowledge/archived into GET /knowledge?scope=archived,
matching files, tables, and workflows
- Re-home chat deployments as a singleton under the workflow they
belong to; keep the workspace-scoped discovery list
- Move the tag-definition writes off the document path onto
/knowledge/{id}/tags, where they already acted
- Nest the table export and dispatch reads under their parent table
Defects:
- Publish isPublicApi on the deployment read; it was write-only, so a
workflow could be opened to unauthenticated execution unauditably
- Stop publishing raw storage keys and an unusable URL in log files
- Classify a chat-identifier unique violation as 409 rather than 500
- Fall back to the root path instead of throwing when a knowledge
base's folder is archived
- Cap bulk-download at the ceiling it actually enforces
- Normalize variables through one helper on both graph write paths
- Fix a folder-name log filter that matched workflow names
Naming and gaps:
- Rename /files/{id}/extract to /unarchive, /rows/find to /rows/search,
/rows/batch-update to /rows/bulk-update, /columns/run to /dispatches
- Type the last six generic [id] path segments
- Add table folder restore and id-addressed dispatch cancel
* chore(audits): record the v2 catalog routes in the boundary baseline
* fix(api): accept a null chat password and correct three published claims
- performChatDeploy validated `password: null` as a password, so the
replace-shaped chat PUT answered 400 for every mode that owns no
password — public (the default), email, and sso. The declared payload
type has always allowed null, and the stored value is cleared by
authType regardless, so null needs no validation of its own. The route
test could not catch it: it mocks the orchestration module and pinned
the exact null the real guard refused.
- Redirect the two docs slugs this branch retired that were genuinely
published: findTableRows and runTableColumns.
- The table folder restore described an idempotent no-op for an already
active folder; it answers 404. Say so, and say where the path comes
from, since the tables folder list cannot yet report archived folders.
- Name the customizations exception to the chat PUT's replace semantics.
- A cursor-binding case used status=error, which is a level and not a
status, so it failed contract validation and never reached the cursor
check. Use an accepted value and pin the reason, not just the status.
* chore(cli): classify the new v2 chat operation as non-destructive
* feat(cli): expose canonical resource URLs
* fix(api): close three caller-reachable failures found by the final probe
- GET /files/{fileId}/text called parseBuffer unguarded, and parseBuffer
signals every failure as a bare Error that no v2 policy classifies. A
zero-byte upload or a mislabelled archive was an unhandled 500. Empty
bytes now answer empty text — a zero-length file has no text — and
unparseable bytes answer 409, matching the rendered-artifact resolver.
- GET /workflows/{workflowId}/state asserted write-side bounds over
stored data. workflow_blocks.name and .type are bare text() and the
realtime rename op accepts z.string(), so a block renamed past 255
characters made the workflow unreadable, and unrepairable, over v2.
The read shape now takes the same input/stored split the variable
schema already had. Stored subflow conditions are coerced in the
loader beside the existing numeric guards.
- GET /knowledge stamped scope into the cursor fingerprint
unconditionally. scope defaults to active and is new on that list, so
every cursor the deployed build handed out would have been refused
with a message saying the caller changed a filter they never sent.
Its siblings already carry the guard and the comment.
Also: POST /workflow-mcp-servers answers 201 like every other v2 create;
GET /logs/stats reuses the log list's entry ceilings; the execute and
resume routes install the media-type-aware 415 they publish; and a
rationale citing an endpoint that never reached the wire is corrected.
* fix(tables): carry the dispatch terminal timestamps through the stale sweep
Staging's abandoned-dispatch recovery builds its own `DispatchRow`, and
this branch had added `completedAt`/`cancelledAt` to that shape for the
id-addressed dispatch read and cancel. The merge was textually clean and
left the new mapping short two fields.
* fix(workflows): deny workspace API keys on the graph replace
`PUT /workflows/{workflowId}/state` stores blocks and their tool wiring
wholesale, but the policies deciding which of those a member may add —
the EE permission config and block visibility — take a human subject.
A workspace API key has none, and both substitutes fail open: the
billing owner is a different, typically less-constrained person, and
passing no user makes the permission lookup return null, which every
caller reads as unrestricted.
That made the replace a second graph-write door storing what its sibling
`POST /workflows/{workflowId}/operations` refuses, which denies workspace
keys for exactly this reason. Both doors now agree. Personal keys keep
the capability, so headless authoring is unaffected for a credential
that names a human.
* chore(api): drop the enrichment catalog endpoint
GET /api/v2/enrichments listed the code-defined table enrichments. The
per-row enrichment run detail stays; only the catalog read goes.
Removes the route, contract, response and query schemas, the semantic
operation, the use case, the projection module, its registry-boundary
entry, and the CLI command. The "not found" and "blank search" cases it
covered are repointed at the connector-type sibling so the shared
behaviour stays tested rather than deleted with it.
* improvement(api): make the workflow operations endpoint self-describing
Two things stood between this endpoint and a caller who has only the
published spec.
The accepted `params` keys existed only in the edit engine's source. The
spec said "the accepted keys depend on the target block type", so a
caller reading it could create a nameless empty block and nothing more —
while the Copilot tool catalog, over the same engine, has always spelled
out the envelope. That guidance now lives in the contract, shared by the
add, edit, and insert_into_subflow parameter schemas so the two surfaces
cannot describe one engine differently: `inputs` keyed by sub-block id,
`retry`/`triggerMode`/`advancedMode` beside it rather than inside it,
`connections` keyed by source handle, and `removeEdges` for dropping one
edge without restating the rest.
A `block_id` that is not already a UUID is replaced with a minted one,
and the mapping was computed and then dropped. A caller could not
reference the block it had just created except by re-reading the graph
and matching on name. The engine now returns it and the response
publishes it as `mintedBlockIds`, with the in-batch versus cross-request
rule stated in the operation description.
* fix(api): close the pre-merge scan's blocking findings
Docs and public wire, all of it permanent surface once released.
- Two published tag groups, Catalog and Meta, had no sidebar entry in any
locale, so six operations shipped unbrowsable. Added to all six, and a
test now fails when a published tag has no entry.
- deleteWorkflowChatDeployment pointed callers at DELETE on /deployment;
the undeploy verb is on /deploy.
- PUT /state still promised workspace API keys a degraded lint pass after
the operation began rejecting them outright. It also lived in a
single-quoted string, so the shared clause would not have interpolated.
- POST /tables/move took targetFolderPath as nullable-but-required, which
rendered the CLI flag as a required `<json|@file>`: `--to /Archive`
failed to parse and omitting it failed outright, while the docs said
"omit for root". Now optional and a plain string, matching
POST /files/move; the route supplies the null the use case wants.
- Table dispatch status and row run state published `cancelled` beside
imports, exports, and job state publishing `canceled`, and the note
explaining the split was wrong about its own sibling. Both new schemas
now publish `canceled`; the stored column is unchanged and mapped at
the presenter. The shipped `cancelled` count field is left alone.
- applyWorkflowVariables can answer 423 and both workflow-MCP deletes can
answer 409; none declared it. Hand-assembled error lists replaced with
the shared sets.
- /files/{fileId}/unarchive became /unzip. `extract` reads as "extract
text" and `unarchive` reads as the inverse of restore on a resource
where archived means soft-deleted; unzip collides with neither and is
what the implementation calls itself.
* improvement(cli,docs): finish the naming and clear the enrichment leftovers
- Four single-record GETs derived to `list` while returning one thing:
meta, a workflow's chat deployment, log stats, and file text. Renamed to
`meta status`, `workflows chat status`, `logs stats`, `files read`,
matching the `workflows deployment status` correction already in this
branch. None of the old spellings shipped.
- Dropped five `renamedFrom` aliases pointing at spellings that never
existed, each of which built a hidden command and a permanent
deprecation warning for argv nobody could have typed. `tables rows find`
keeps its alias — that one really shipped.
- Removed the enrichment catalog from three prose sites left behind when
the endpoint went: the resources spec description, its Catalog tag, and
the contract and pagination-test comments.
- Documented the six new command groups in the CLI index table. That page
is a guide page, so the docs staleness check cannot flag it.
- Published the `customizations` exception to the chat replace semantics.
It was in the route TSDoc and invisible to every caller reading the
spec, which is where the claim "Replace, not merge" is made.
* improvement(cli): use batch- for the tables bulk delete, matching its siblings
The CLI renames a bulk form only when it would collide with its singular
sibling, and uses AWS's `batch-` prefix when it does — `files
batch-delete`, `tables rows batch-delete`, `knowledge chunks
batch-update`. `tables delete` exists, so `tables bulk-delete` was that
same rename reaching for the other word, and the only `bulk-` command on
the surface. No `bulk-` CLI command has ever shipped, so this costs
nothing now and would be permanent later.
`files bulk-download` keeps its name: there is no `files download` to
collide with, and it is one archive rather than N operations. Its config
block now says why it exists at all, since the command is never built —
the builder skips non-JSON response modes, but the contract sweeps still
read the entry and require the folder-path field to be marked.
* fix(workflows): allow operations on blockless drafts
* feat(workflows): add manual and run-from-block execution
* fix(cli): update workflow run description test
* fix(tests): align fixtures with current contracts
* fix(api): derive chat activity from workflow deployment
---------
Co-authored-by: Theodore Li <theo@sim.ai>
8407 lines
298 KiB
JSON
8407 lines
298 KiB
JSON
{
|
||
"openapi": "3.1.0",
|
||
"info": {
|
||
"title": "Sim API v2 — Knowledge Bases",
|
||
"description": "Version 2 of the Sim REST API for knowledge bases, document ingestion, resumable uploads, folders, and semantic or tag-based search.",
|
||
"version": "2.0.0",
|
||
"contact": {
|
||
"name": "Sim Support",
|
||
"email": "help@sim.ai",
|
||
"url": "https://www.sim.ai"
|
||
},
|
||
"license": {
|
||
"name": "Apache 2.0",
|
||
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
|
||
}
|
||
},
|
||
"servers": [
|
||
{
|
||
"url": "https://www.sim.ai",
|
||
"description": "Production"
|
||
}
|
||
],
|
||
"tags": [
|
||
{
|
||
"name": "Knowledge Bases",
|
||
"description": "Create and organize knowledge bases, ingest documents, and search indexed content."
|
||
}
|
||
],
|
||
"security": [
|
||
{
|
||
"apiKey": []
|
||
}
|
||
],
|
||
"paths": {
|
||
"/api/v2/knowledge": {
|
||
"get": {
|
||
"operationId": "listKnowledgeBases",
|
||
"summary": "List Knowledge Bases",
|
||
"description": "List knowledge bases in a workspace with lifecycle scope, folder filtering, search, sorting, and opaque cursor pagination. `scope` defaults to `active`; pass `archived` to list knowledge bases a `DELETE` archived, each carrying the `deletedAt` instant it was archived, and recover one with `POST /api/v2/knowledge/{knowledgeBaseId}/restore`. A workspace folder tree over 10,000 folders is a `413`.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace whose knowledge bases should be listed.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace whose knowledge bases should be listed."
|
||
}
|
||
},
|
||
{
|
||
"name": "scope",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Which lifecycle set to list: `active` (default) for live knowledge bases, `archived` for knowledge bases a `DELETE` archived and `POST /knowledge/{knowledgeBaseId}/restore` can bring back. `folderPath` resolves against active folders only, so pairing it with `scope=archived` returns an empty page when the containing folder was archived too.",
|
||
"schema": {
|
||
"default": "active",
|
||
"description": "Which lifecycle set to list: `active` (default) for live knowledge bases, `archived` for knowledge bases a `DELETE` archived and `POST /knowledge/{knowledgeBaseId}/restore` can bring back. `folderPath` resolves against active folders only, so pairing it with `scope=archived` returns an empty page when the containing folder was archived too.",
|
||
"type": "string",
|
||
"enum": ["active", "archived"]
|
||
}
|
||
},
|
||
{
|
||
"name": "folderPath",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Restrict results to knowledge bases in this folder. A path that names no folder narrows the result to nothing, so the response is an empty page rather than an error.",
|
||
"schema": {
|
||
"description": "Restrict results to knowledge bases in this folder. A path that names no folder narrows the result to nothing, so the response is an empty page rather than an error.",
|
||
"$ref": "#/components/schemas/FolderPathInput"
|
||
}
|
||
},
|
||
{
|
||
"name": "search",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Case-insensitive substring match against the resource name.",
|
||
"schema": {
|
||
"description": "Case-insensitive substring match against the resource name.",
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 200
|
||
}
|
||
},
|
||
{
|
||
"name": "sortBy",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Field used to sort the result. Sorting by `name` is case-sensitive and follows the storage collation, so do not rely on a case-insensitive order.",
|
||
"schema": {
|
||
"default": "createdAt",
|
||
"description": "Field used to sort the result. Sorting by `name` is case-sensitive and follows the storage collation, so do not rely on a case-insensitive order.",
|
||
"type": "string",
|
||
"enum": ["name", "createdAt", "updatedAt"]
|
||
}
|
||
},
|
||
{
|
||
"name": "sortOrder",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Sort direction.",
|
||
"schema": {
|
||
"default": "asc",
|
||
"description": "Sort direction.",
|
||
"type": "string",
|
||
"enum": ["asc", "desc"]
|
||
}
|
||
},
|
||
{
|
||
"name": "limit",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Maximum knowledge bases to return per page. Must be a whole number from 1 to 100. Defaults to 50.",
|
||
"schema": {
|
||
"default": 50,
|
||
"description": "Maximum knowledge bases to return per page. Must be a whole number from 1 to 100. Defaults to 50.",
|
||
"type": "integer",
|
||
"minimum": 1,
|
||
"maximum": 100
|
||
}
|
||
},
|
||
{
|
||
"name": "cursor",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.",
|
||
"schema": {
|
||
"description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.",
|
||
"type": "string",
|
||
"minLength": 1
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "A page of knowledge bases.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeBaseListResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"operationId": "createKnowledgeBase",
|
||
"summary": "Create Knowledge Base",
|
||
"description": "Create a knowledge base in a workspace with optional folder placement and chunking configuration. An unknown `folderPath` is a `404`. A workspace folder tree over 10,000 folders is a `413`.",
|
||
"tags": ["Knowledge Bases"],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Workspace, name, description, chunking configuration, and folder placement.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/CreateKnowledgeBaseRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"201": {
|
||
"description": "The created knowledge base.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeBaseResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}": {
|
||
"get": {
|
||
"operationId": "getKnowledgeBase",
|
||
"summary": "Get Knowledge Base",
|
||
"description": "Retrieve a knowledge base by identifier. Inaccessible knowledge bases are reported as not found. A workspace folder tree over 10,000 folders is a `413`.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "The requested knowledge base.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeBaseResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"patch": {
|
||
"operationId": "updateKnowledgeBase",
|
||
"summary": "Update Knowledge Base",
|
||
"description": "Update a knowledge base name, description, chunking configuration, or folder placement. A workspace folder tree over 10,000 folders is a `413`.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Workspace scope and fields to update. At least one mutable field is required.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/UpdateKnowledgeBaseRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "The updated knowledge base.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeBaseResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"operationId": "deleteKnowledgeBase",
|
||
"summary": "Delete Knowledge Base",
|
||
"description": "Delete a knowledge base and its documents.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "Knowledge base deletion acknowledgement.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeDeleteResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}/connectors": {
|
||
"get": {
|
||
"operationId": "listKnowledgeConnectors",
|
||
"summary": "List Knowledge Connectors",
|
||
"description": "List external sources connected to a knowledge base with opaque cursor pagination. Stored API keys and encrypted secret material are never returned. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
},
|
||
{
|
||
"name": "sortBy",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Field used to sort the result.",
|
||
"schema": {
|
||
"default": "createdAt",
|
||
"description": "Field used to sort the result.",
|
||
"type": "string",
|
||
"enum": ["connectorType", "createdAt", "updatedAt"]
|
||
}
|
||
},
|
||
{
|
||
"name": "sortOrder",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Sort direction.",
|
||
"schema": {
|
||
"default": "desc",
|
||
"description": "Sort direction.",
|
||
"type": "string",
|
||
"enum": ["asc", "desc"]
|
||
}
|
||
},
|
||
{
|
||
"name": "limit",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Maximum connectors to return per page. Must be a whole number from 1 to 100. Defaults to 50.",
|
||
"schema": {
|
||
"default": 50,
|
||
"description": "Maximum connectors to return per page. Must be a whole number from 1 to 100. Defaults to 50.",
|
||
"type": "integer",
|
||
"minimum": 1,
|
||
"maximum": 100
|
||
}
|
||
},
|
||
{
|
||
"name": "cursor",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.",
|
||
"schema": {
|
||
"description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.",
|
||
"type": "string",
|
||
"minLength": 1
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "A page of knowledge connectors.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeConnectorListResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"operationId": "createKnowledgeConnector",
|
||
"summary": "Create Knowledge Connector",
|
||
"description": "Validate and connect an external source, then queue its initial synchronization. The apiKey field is write-only and is never returned. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Workspace, connector type, authentication reference, source configuration, and sync schedule.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/CreateKnowledgeConnectorRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"201": {
|
||
"description": "The created connector without secret material.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeConnectorResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}/connectors/{connectorId}": {
|
||
"get": {
|
||
"operationId": "getKnowledgeConnector",
|
||
"summary": "Get Knowledge Connector",
|
||
"description": "Retrieve one connector and its ten most recent synchronization attempts. Stored API keys and encrypted secret material are never returned. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "connectorId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Connector selected for the operation.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Connector selected for the operation."
|
||
}
|
||
},
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Knowledge base that owns the connector.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Knowledge base that owns the connector."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "The connector and recent synchronization history.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeConnectorDetailResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"patch": {
|
||
"operationId": "updateKnowledgeConnector",
|
||
"summary": "Update Knowledge Connector",
|
||
"description": "Update connector source configuration, schedule, or active state. Replacing source configuration on a runnable connector queues an immediate synchronization; paused connectors retain the change without synchronizing until resumed. Source configuration cannot be replaced while synchronization is already in progress. Authentication material cannot be changed through this operation. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "connectorId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Connector selected for the operation.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Connector selected for the operation."
|
||
}
|
||
},
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Knowledge base that owns the connector.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Knowledge base that owns the connector."
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Workspace scope and at least one mutable connector field.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/UpdateKnowledgeConnectorRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "The updated connector.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeConnectorResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"operationId": "deleteKnowledgeConnector",
|
||
"summary": "Delete Knowledge Connector",
|
||
"description": "Delete a connector and optionally its synchronized documents. Documents are retained by default. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "connectorId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Connector selected for the operation.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Connector selected for the operation."
|
||
}
|
||
},
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Knowledge base that owns the connector.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Knowledge base that owns the connector."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
},
|
||
{
|
||
"name": "deleteDocuments",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Also permanently delete documents produced by this connector.",
|
||
"schema": {
|
||
"description": "Also permanently delete documents produced by this connector.",
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "Connector deletion acknowledgement and document counts.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeConnectorDeleteResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}/connectors/{connectorId}/sync": {
|
||
"post": {
|
||
"operationId": "syncKnowledgeConnector",
|
||
"summary": "Sync Knowledge Connector",
|
||
"description": "Queue a connector synchronization. Rehydration forces existing documents to be fetched and indexed again. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "connectorId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Connector selected for the operation.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Connector selected for the operation."
|
||
}
|
||
},
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Knowledge base that owns the connector.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Knowledge base that owns the connector."
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Workspace scope and optional full rehydration control.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/SyncKnowledgeConnectorRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "Synchronization was queued.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeConnectorSyncResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}/connectors/{connectorId}/documents": {
|
||
"get": {
|
||
"operationId": "listKnowledgeConnectorDocuments",
|
||
"summary": "List Knowledge Connector Documents",
|
||
"description": "List documents produced by one connector with opaque cursor pagination. Excluded documents are omitted unless explicitly requested. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "connectorId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Connector selected for the operation.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Connector selected for the operation."
|
||
}
|
||
},
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Knowledge base that owns the connector.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Knowledge base that owns the connector."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
},
|
||
{
|
||
"name": "includeExcluded",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Include documents explicitly excluded by a user.",
|
||
"schema": {
|
||
"description": "Include documents explicitly excluded by a user.",
|
||
"type": "boolean"
|
||
}
|
||
},
|
||
{
|
||
"name": "limit",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Maximum connector documents to return per page. Must be a whole number from 1 to 100. Defaults to 50.",
|
||
"schema": {
|
||
"default": 50,
|
||
"description": "Maximum connector documents to return per page. Must be a whole number from 1 to 100. Defaults to 50.",
|
||
"type": "integer",
|
||
"minimum": 1,
|
||
"maximum": 100
|
||
}
|
||
},
|
||
{
|
||
"name": "cursor",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.",
|
||
"schema": {
|
||
"description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.",
|
||
"type": "string",
|
||
"minLength": 1
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "A page of connector documents.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeConnectorDocumentListResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"patch": {
|
||
"operationId": "updateKnowledgeConnectorDocuments",
|
||
"summary": "Update Knowledge Connector Documents",
|
||
"description": "Exclude connector documents from knowledge search or restore previously excluded documents. Only documents produced by the selected connector can change. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "connectorId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Connector selected for the operation.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Connector selected for the operation."
|
||
}
|
||
},
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Knowledge base that owns the connector.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Knowledge base that owns the connector."
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Workspace, restore or exclude operation, and selected document identifiers.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/UpdateKnowledgeConnectorDocumentsRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "The selected connector documents were updated.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeConnectorDocumentsUpdateResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/search": {
|
||
"post": {
|
||
"operationId": "searchKnowledge",
|
||
"summary": "Search Knowledge",
|
||
"description": "Search one or more knowledge bases with semantic vector retrieval, optional hybrid full-text retrieval, and structured tag filters. Every result names the `knowledgeBaseId` it came from. A request body over 2 MiB is a `413`.",
|
||
"tags": ["Knowledge Bases"],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Knowledge bases, query, result limit, retrieval mode, and optional tag filters.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/SearchKnowledgeRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "Matching document chunks ordered by relevance.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeSearchResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"402": {
|
||
"$ref": "#/components/responses/UsageLimitExceeded"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}/tags": {
|
||
"get": {
|
||
"operationId": "listKnowledgeTags",
|
||
"summary": "List Tags",
|
||
"description": "List the knowledge base's tag vocabulary: each tag's display name, the slot it is stored in, and its field type. Filters and document reads use display names; document writes address slots. The bounded set is returned in one page; `nextCursor` is always null.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "The knowledge base tag vocabulary.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeTagListResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"operationId": "createKnowledgeTag",
|
||
"summary": "Create Tag",
|
||
"description": "Define one tag on a knowledge base; use `PUT` on this path to declare several at once. Define a tag here, write its `tagSlot` on a document with `PATCH /api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}`, then filter by its `displayName` on the document list or on search. Omit `tagSlot` to take the next free slot for the field type; a field type with no free slot left is a `400` naming it, since the remedy is a different type or a deleted definition rather than a retry. A `tagSlot` already taken, or a `displayName` already defined on this knowledge base, is a `409` naming which of the two to change. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Workspace scope, display name, field type, and optional slot.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/CreateKnowledgeTagRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"201": {
|
||
"description": "The created tag definition.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeTagResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"operationId": "bulkSaveKnowledgeTagDefinitions",
|
||
"summary": "Bulk Save Tag Definitions",
|
||
"description": "Declare, in one request, several of the knowledge base's tag definitions. `POST` on this path defines exactly one tag; this is the same write over a list, and every slot the body names is written to the declaration it carries while slots it does not name are left alone. Updating an existing definition requires naming its current name in `originalDisplayName`; that is the only form that edits one in place. Without it the entry is a create, and a requested `tagSlot` another name already holds is not overwritten — the definition is created in the next free slot of its `fieldType` instead, so read the returned entry for the slot actually assigned. A create whose `displayName` already exists is refused in `errors`. Per-definition failures are reported in `errors` and still answer `200`. This writes the vocabulary, not one document's tag values — set those with `PATCH /api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}`. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Workspace scope and the tag definitions to create or update.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/BulkSaveKnowledgeTagDefinitionsRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "Definitions created and updated by the save.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2BulkSaveKnowledgeTagDefinitionsResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"operationId": "deleteKnowledgeTagDefinitions",
|
||
"summary": "Delete Tag Definitions",
|
||
"description": "Remove tag definitions from the knowledge base. `unused` defaults to `true`, which removes only the definitions no document still carries a value for — the recoverable half, since a definition with nothing behind it can simply be redefined. Pass `unused=false` to delete every definition on the knowledge base, which also clears its slot on every document and chunk and is not recoverable. Delete one definition at a time with `DELETE /api/v2/knowledge/{knowledgeBaseId}/tags/{tagId}`. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
},
|
||
{
|
||
"name": "unused",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Whether to remove only the tag definitions no document in the knowledge base still carries a value for. Defaults to true. Pass `unused=false` to delete every definition on the knowledge base, which also clears its slot on every document and chunk and is not recoverable.",
|
||
"schema": {
|
||
"description": "Whether to remove only the tag definitions no document in the knowledge base still carries a value for. Defaults to true. Pass `unused=false` to delete every definition on the knowledge base, which also clears its slot on every document and chunk and is not recoverable.",
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "Number of tag definitions removed.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2DeleteKnowledgeTagDefinitionsResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}/documents": {
|
||
"get": {
|
||
"operationId": "listKnowledgeDocuments",
|
||
"summary": "List Documents",
|
||
"description": "List documents in a knowledge base with filename search, state filtering, tag filtering, sorting, and opaque cursor pagination. Tag values are keyed by display name; resolve those to write slots with `GET /api/v2/knowledge/{knowledgeBaseId}/tags`.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
},
|
||
{
|
||
"name": "limit",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Maximum documents to return per page. Must be a whole number from 1 to 100. Defaults to 50.",
|
||
"schema": {
|
||
"default": 50,
|
||
"description": "Maximum documents to return per page. Must be a whole number from 1 to 100. Defaults to 50.",
|
||
"type": "integer",
|
||
"minimum": 1,
|
||
"maximum": 100
|
||
}
|
||
},
|
||
{
|
||
"name": "search",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Case-insensitive substring match against the document filename.",
|
||
"schema": {
|
||
"description": "Case-insensitive substring match against the document filename.",
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 200
|
||
}
|
||
},
|
||
{
|
||
"name": "enabledFilter",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Filter by whether documents are enabled for search.",
|
||
"schema": {
|
||
"default": "all",
|
||
"description": "Filter by whether documents are enabled for search.",
|
||
"type": "string",
|
||
"enum": ["all", "enabled", "disabled"]
|
||
}
|
||
},
|
||
{
|
||
"name": "sortBy",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Field used to sort the result. Sorting by `filename` is case-sensitive and follows the storage collation, so do not rely on a case-insensitive order.",
|
||
"schema": {
|
||
"default": "uploadedAt",
|
||
"description": "Field used to sort the result. Sorting by `filename` is case-sensitive and follows the storage collation, so do not rely on a case-insensitive order.",
|
||
"type": "string",
|
||
"enum": [
|
||
"filename",
|
||
"fileSize",
|
||
"tokenCount",
|
||
"chunkCount",
|
||
"uploadedAt",
|
||
"processingStatus",
|
||
"enabled"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"name": "sortOrder",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Sort direction.",
|
||
"schema": {
|
||
"default": "desc",
|
||
"description": "Sort direction.",
|
||
"type": "string",
|
||
"enum": ["asc", "desc"]
|
||
}
|
||
},
|
||
{
|
||
"name": "cursor",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.",
|
||
"schema": {
|
||
"description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.",
|
||
"type": "string",
|
||
"minLength": 1
|
||
}
|
||
},
|
||
{
|
||
"name": "tagFilters",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "A JSON-encoded array of at most 10 tag filters, using the same display-name shape as knowledge search: `[{\"tagName\":\"category\",\"operator\":\"eq\",\"value\":\"billing\"}]`. Every filter must hold, including two that name the same tag. A name that is not defined in this knowledge base is rejected, never ignored.",
|
||
"schema": {
|
||
"description": "A JSON-encoded array of at most 10 tag filters, using the same display-name shape as knowledge search: `[{\"tagName\":\"category\",\"operator\":\"eq\",\"value\":\"billing\"}]`. Every filter must hold, including two that name the same tag. A name that is not defined in this knowledge base is rejected, never ignored.",
|
||
"examples": [
|
||
"[{\"tagName\":\"category\",\"operator\":\"eq\",\"value\":\"billing\"}]"
|
||
],
|
||
"type": "string"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "A page of knowledge documents.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeDocumentListResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"patch": {
|
||
"operationId": "bulkUpdateKnowledgeDocuments",
|
||
"summary": "Bulk Enable or Disable Documents",
|
||
"description": "Enable or disable many documents in one request, either by identifier or, with `selectAll`, every document in the knowledge base. Bulk delete is not offered; delete documents one at a time with `DELETE /api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}`. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Operation and the documents it applies to.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/BulkUpdateKnowledgeDocumentsRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "The number and identifiers of the documents that changed.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2BulkKnowledgeDocumentsResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"operationId": "uploadKnowledgeDocument",
|
||
"summary": "Upload Document",
|
||
"description": "Upload one document as multipart form data. Processing continues asynchronously after the document is accepted.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Multipart form containing the document file.",
|
||
"content": {
|
||
"multipart/form-data": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/UploadKnowledgeDocumentForm"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"201": {
|
||
"description": "The accepted document queued for processing.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeDocumentSummaryResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"402": {
|
||
"$ref": "#/components/responses/UsageLimitExceeded"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}/documents/uploads": {
|
||
"post": {
|
||
"operationId": "createKnowledgeDocumentUpload",
|
||
"summary": "Create Document Upload",
|
||
"description": "Create a resumable upload session and receive direct PUT or multipart transfer instructions.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Document metadata used to authorize and initialize the upload.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/CreateKnowledgeDocumentUploadRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"201": {
|
||
"description": "The created upload session and transfer instructions.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2CreateKnowledgeDocumentUploadResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"402": {
|
||
"$ref": "#/components/responses/UsageLimitExceeded"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}/documents/uploads/{uploadId}": {
|
||
"delete": {
|
||
"operationId": "abortKnowledgeDocumentUpload",
|
||
"summary": "Abort Document Upload",
|
||
"description": "Abort an incomplete upload and discard provider-side multipart state.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "uploadId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Upload session identifier returned when the upload was created.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Upload session identifier returned when the upload was created."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
},
|
||
{
|
||
"name": "upload-token",
|
||
"in": "header",
|
||
"required": true,
|
||
"description": "Signed upload control token returned when the upload session was created.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Signed upload control token returned when the upload session was created."
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "The aborted upload session.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeDocumentUploadResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}/documents/uploads/{uploadId}/parts": {
|
||
"post": {
|
||
"operationId": "createKnowledgeDocumentUploadPartUrls",
|
||
"summary": "Create Document Upload Part URLs",
|
||
"description": "Issue short-lived signed PUT URLs for up to 100 multipart part numbers.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "uploadId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Upload session identifier returned when the upload was created.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Upload session identifier returned when the upload was created."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
},
|
||
{
|
||
"name": "upload-token",
|
||
"in": "header",
|
||
"required": true,
|
||
"description": "Signed upload control token returned when the upload session was created.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Signed upload control token returned when the upload session was created."
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Multipart part numbers for which signed URLs should be created.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/CreateKnowledgeDocumentUploadPartUrlsRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "Signed URLs for the requested upload parts.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeDocumentUploadPartUrlsResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}/documents/uploads/{uploadId}/complete": {
|
||
"post": {
|
||
"operationId": "completeKnowledgeDocumentUpload",
|
||
"summary": "Complete Document Upload",
|
||
"description": "Verify a direct upload or assemble multipart parts, create the knowledge document, and queue asynchronous processing.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "uploadId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Upload session identifier returned when the upload was created.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Upload session identifier returned when the upload was created."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
},
|
||
{
|
||
"name": "upload-token",
|
||
"in": "header",
|
||
"required": true,
|
||
"description": "Signed upload control token returned when the upload session was created.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Signed upload control token returned when the upload session was created."
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "The completed upload and queued document.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeDocumentUploadResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}": {
|
||
"get": {
|
||
"operationId": "getKnowledgeDocument",
|
||
"summary": "Get Document",
|
||
"description": "Retrieve document detail, processing state, and connector provenance.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "documentId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge document identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge document identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "The requested knowledge document.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeDocumentResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"patch": {
|
||
"operationId": "updateKnowledgeDocument",
|
||
"summary": "Update Document",
|
||
"description": "Rename a document, enable or disable it for search, set any of its 17 tag slots, or requeue it for processing. Absent fields are unchanged, and derived indexing state is read-only. Resolve a tag display name to its slot with `GET /api/v2/knowledge/{knowledgeBaseId}/tags`. The returned document omits the connector provenance the detail read carries. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "documentId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge document identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge document identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Filename, search state, tag slot values, or a processing retry.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/UpdateKnowledgeDocumentRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "The updated document, or the requeue acknowledgement.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2UpdateKnowledgeDocumentResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"operationId": "deleteKnowledgeDocument",
|
||
"summary": "Delete Document",
|
||
"description": "Remove one document from a knowledge base. An uploaded document is deleted outright with its indexed chunks. A connector-backed document is instead excluded — its row and embeddings survive, but it stops being searchable and a later sync does not re-add it. Either way it no longer appears in listings or search results.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "documentId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge document identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge document identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "Knowledge document deletion acknowledgement.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeDeleteResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/folders": {
|
||
"get": {
|
||
"operationId": "listKnowledgeFolders",
|
||
"summary": "List Folders",
|
||
"description": "List folders in the knowledge-base folder tree with filtering and sorting. The bounded set is returned in one page; `nextCursor` is always null. A workspace folder tree over 10,000 folders is a `413`.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace whose folders should be listed.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace whose folders should be listed."
|
||
}
|
||
},
|
||
{
|
||
"name": "parentPath",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Restrict results to direct children of this parent path.",
|
||
"schema": {
|
||
"description": "Restrict results to direct children of this parent path.",
|
||
"$ref": "#/components/schemas/FolderPathInput"
|
||
}
|
||
},
|
||
{
|
||
"name": "search",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Case-insensitive substring match against the folder name.",
|
||
"schema": {
|
||
"description": "Case-insensitive substring match against the folder name.",
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 200
|
||
}
|
||
},
|
||
{
|
||
"name": "sortBy",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Field used to sort the result. Sorting by `name` is case-sensitive and follows the storage collation, so do not rely on a case-insensitive order.",
|
||
"schema": {
|
||
"default": "name",
|
||
"description": "Field used to sort the result. Sorting by `name` is case-sensitive and follows the storage collation, so do not rely on a case-insensitive order.",
|
||
"type": "string",
|
||
"enum": ["name", "createdAt", "updatedAt"]
|
||
}
|
||
},
|
||
{
|
||
"name": "sortOrder",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Sort direction.",
|
||
"schema": {
|
||
"default": "asc",
|
||
"description": "Sort direction.",
|
||
"type": "string",
|
||
"enum": ["asc", "desc"]
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "A page of knowledge-base folders.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeFolderListResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"operationId": "createKnowledgeFolder",
|
||
"summary": "Create Folder",
|
||
"description": "Create a folder in the knowledge-base folder tree. A workspace folder tree over 10,000 folders is a `413`.",
|
||
"tags": ["Knowledge Bases"],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Workspace and canonical path for a new knowledge-base folder.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/CreateKnowledgeFolderRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"201": {
|
||
"description": "The created knowledge-base folder.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeFolderResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"patch": {
|
||
"operationId": "relocateKnowledgeFolder",
|
||
"summary": "Rename or Move Folder",
|
||
"description": "Rename or move a folder and atomically rewrite descendant paths. A workspace folder tree over 10,000 folders is a `413`.",
|
||
"tags": ["Knowledge Bases"],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Current and destination canonical paths for a knowledge-base folder.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/RelocateKnowledgeFolderRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "The relocated knowledge-base folder.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeFolderResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"operationId": "deleteKnowledgeFolder",
|
||
"summary": "Delete Folder",
|
||
"description": "Delete a folder, optionally including nested folders and knowledge bases.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace containing the folder.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace containing the folder."
|
||
}
|
||
},
|
||
{
|
||
"name": "path",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Path of the folder to delete.",
|
||
"schema": {
|
||
"description": "Path of the folder to delete.",
|
||
"$ref": "#/components/schemas/NonRootFolderPathInput"
|
||
}
|
||
},
|
||
{
|
||
"name": "recursive",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Delete the folder's nested files and folders too. An empty folder deletes either way; a non-empty one needs this. The listed spellings are the whole accepted vocabulary and are case-sensitive; any other value is rejected.",
|
||
"schema": {
|
||
"description": "Delete the folder's nested files and folders too. An empty folder deletes either way; a non-empty one needs this. The listed spellings are the whole accepted vocabulary and are case-sensitive; any other value is rejected.",
|
||
"enum": [
|
||
"true",
|
||
"1",
|
||
"yes",
|
||
"on",
|
||
"y",
|
||
"enabled",
|
||
"false",
|
||
"0",
|
||
"no",
|
||
"off",
|
||
"n",
|
||
"disabled"
|
||
],
|
||
"default": "false",
|
||
"type": "string"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "Folder deletion acknowledgement and deleted item counts.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2DeleteKnowledgeFolderResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}/restore": {
|
||
"post": {
|
||
"operationId": "restoreKnowledgeBase",
|
||
"summary": "Restore Knowledge Base",
|
||
"description": "Un-archive a soft-deleted knowledge base along with its documents and connectors. Idempotent: a knowledge base that is already active is returned unchanged with no audit entry recorded. Restoring into an archived workspace is a `409`, and a knowledge base whose folder is still archived is returned to the workspace root. A workspace folder tree over 10,000 folders is a `413`.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Workspace scope for the knowledge base.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/RestoreKnowledgeBaseRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "The restored knowledge base.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeBaseResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}/documents/from-workspace-files": {
|
||
"post": {
|
||
"operationId": "addWorkspaceFilesToKnowledgeBase",
|
||
"summary": "Index Workspace Files",
|
||
"description": "Index files the workspace already stores, without re-uploading their bytes. Each reference is authorized against the file it names, so a reference the caller cannot read, one over the 100 MB document limit, or one whose type is not supported is reported in `failed` while the rest are queued — a partial outcome is a `200`, not a multi-status. A queued document starts in the `pending` processing state; the entries returned here carry only its identity, so read `GET /api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}` for its current state. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Workspace scope and the workspace file references to index.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/AddWorkspaceFilesToKnowledgeBaseRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "Files queued for indexing, with any that could not be.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2AddWorkspaceFilesToKnowledgeBaseResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"402": {
|
||
"$ref": "#/components/responses/UsageLimitExceeded"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}/chunks": {
|
||
"get": {
|
||
"operationId": "listKnowledgeChunks",
|
||
"summary": "List Chunks",
|
||
"description": "List the passages a document was split into, with content search, enabled filtering, sorting, and opaque cursor pagination. Tag values are projected by slot; resolve slots to display names with `GET /api/v2/knowledge/{knowledgeBaseId}/tags`. A document that has not finished processing answers `409`; the message names the status it is in. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "documentId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge document identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge document identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
},
|
||
{
|
||
"name": "search",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Case-insensitive substring match against chunk content.",
|
||
"schema": {
|
||
"description": "Case-insensitive substring match against chunk content.",
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 200
|
||
}
|
||
},
|
||
{
|
||
"name": "enabled",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Restrict to enabled or disabled chunks. `all` returns both.",
|
||
"schema": {
|
||
"default": "all",
|
||
"description": "Restrict to enabled or disabled chunks. `all` returns both.",
|
||
"type": "string",
|
||
"enum": ["true", "false", "all"]
|
||
}
|
||
},
|
||
{
|
||
"name": "sortBy",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Field used to sort the result.",
|
||
"schema": {
|
||
"default": "chunkIndex",
|
||
"description": "Field used to sort the result.",
|
||
"type": "string",
|
||
"enum": ["chunkIndex", "tokenCount", "enabled"]
|
||
}
|
||
},
|
||
{
|
||
"name": "sortOrder",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Sort direction.",
|
||
"schema": {
|
||
"default": "asc",
|
||
"description": "Sort direction.",
|
||
"type": "string",
|
||
"enum": ["asc", "desc"]
|
||
}
|
||
},
|
||
{
|
||
"name": "limit",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Maximum chunks to return per page. Must be a whole number from 1 to 100. Defaults to 50.",
|
||
"schema": {
|
||
"default": 50,
|
||
"description": "Maximum chunks to return per page. Must be a whole number from 1 to 100. Defaults to 50.",
|
||
"type": "integer",
|
||
"minimum": 1,
|
||
"maximum": 100
|
||
}
|
||
},
|
||
{
|
||
"name": "cursor",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.",
|
||
"schema": {
|
||
"description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.",
|
||
"type": "string",
|
||
"minLength": 1
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "A page of document chunks.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeChunkListResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"operationId": "createKnowledgeChunk",
|
||
"summary": "Create Chunk",
|
||
"description": "Append a chunk to a document. The text is embedded before the response returns, so the chunk is searchable immediately, and it inherits the document's tag values and the next `chunkIndex`. Chunks of a connector-synced document are read-only and a write answers `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"` — change the content at the source and re-sync, or exclude the document from the connector. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "documentId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge document identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge document identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Workspace scope and the text to embed.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/CreateKnowledgeChunkRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"201": {
|
||
"description": "The created chunk.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeChunkResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"patch": {
|
||
"operationId": "bulkUpdateKnowledgeChunks",
|
||
"summary": "Bulk Update Chunks",
|
||
"description": "Enable, disable, or delete many chunks of one document in a single request. Best-effort: an identifier naming no chunk in the document is skipped rather than failing the request, so `processed` is the authoritative count. Chunks of a connector-synced document are read-only and a write answers `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"` — change the content at the source and re-sync, or exclude the document from the connector. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "documentId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge document identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge document identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Workspace scope, the operation to apply, and the chunks to apply it to.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/BulkUpdateKnowledgeChunksRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "Outcome of the bulk chunk operation.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2BulkKnowledgeChunksResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}/chunks/{chunkId}": {
|
||
"get": {
|
||
"operationId": "getKnowledgeChunk",
|
||
"summary": "Get Chunk",
|
||
"description": "Retrieve one chunk of a document, including the exact text that was embedded. A document that has not finished processing answers `409`; the message names the status it is in. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "documentId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge document identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge document identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "chunkId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique chunk identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique chunk identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "The requested chunk.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeChunkResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"patch": {
|
||
"operationId": "updateKnowledgeChunk",
|
||
"summary": "Update Chunk",
|
||
"description": "Correct a chunk's text or take it out of search. Changing `content` re-embeds the chunk and re-derives the document's token and character counts, so the correction reaches search immediately; disabling keeps the chunk indexed. Chunks of a connector-synced document are read-only and a write answers `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"` — change the content at the source and re-sync, or exclude the document from the connector. A document that has not finished processing answers `409`; the message names the status it is in. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "documentId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge document identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge document identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "chunkId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique chunk identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique chunk identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Workspace scope and the fields to update. At least one is required.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/UpdateKnowledgeChunkRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "The updated chunk.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeChunkResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"operationId": "deleteKnowledgeChunk",
|
||
"summary": "Delete Chunk",
|
||
"description": "Permanently remove one chunk and subtract it from the document's counts. Deleting does not renumber the remaining chunks, so `chunkIndex` values stay stable but become non-contiguous. Chunks of a connector-synced document are read-only and a write answers `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"` — change the content at the source and re-sync, or exclude the document from the connector. A document that has not finished processing answers `409`; the message names the status it is in. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "documentId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge document identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge document identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "chunkId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique chunk identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique chunk identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "Chunk deletion acknowledgement.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeDeleteResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}/tags/{tagId}": {
|
||
"patch": {
|
||
"operationId": "updateKnowledgeTag",
|
||
"summary": "Update Tag",
|
||
"description": "Rename a tag, or change the value type stored in its slot. Renaming changes the name filters and document reads use; the slot, and every value in it, is untouched. A tag's slot is fixed for its lifetime and each slot holds one kind of value, so `fieldType` can only change to another type valid for the slot the tag already occupies — anything else is a `400`, and the way to get a tag of that type is to create one. A name another tag on this knowledge base already holds is a `409`. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "tagId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique tag definition identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique tag definition identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"description": "Workspace scope and the fields to update. At least one is required.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/UpdateKnowledgeTagRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "The updated tag definition.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeTagResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"413": {
|
||
"$ref": "#/components/responses/PayloadTooLarge"
|
||
},
|
||
"415": {
|
||
"$ref": "#/components/responses/UnsupportedMediaType"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"operationId": "deleteKnowledgeTag",
|
||
"summary": "Delete Tag",
|
||
"description": "Remove a tag definition and clear its slot across every document and chunk in the knowledge base. Without a definition the slot has no meaning, so leaving the values would strand them under a raw slot name — this is not recoverable. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "tagId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique tag definition identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique tag definition identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "Tag deletion acknowledgement.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2DeleteKnowledgeTagResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"409": {
|
||
"$ref": "#/components/responses/Conflict"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}/tags/next-slot": {
|
||
"get": {
|
||
"operationId": "getNextKnowledgeTagSlot",
|
||
"summary": "Get Next Tag Slot",
|
||
"description": "Report which slot a create would take for a field type, and how many are left. Advisory rather than a claim: nothing is reserved, and `POST /api/v2/knowledge/{knowledgeBaseId}/tags` assigns the same slot when `tagSlot` is omitted. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
},
|
||
{
|
||
"name": "fieldType",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Value type stored in the slot; it decides which slots are usable and which filter operators apply. Slot capacity per type: text 7, number 5, date 2, boolean 3.",
|
||
"schema": {
|
||
"type": "string",
|
||
"enum": ["text", "number", "date", "boolean"],
|
||
"description": "Value type stored in the slot; it decides which slots are usable and which filter operators apply. Slot capacity per type: text 7, number 5, date 2, boolean 3.",
|
||
"examples": ["text"]
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "Slot availability for the requested field type.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2NextKnowledgeTagSlotResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v2/knowledge/{knowledgeBaseId}/tags/usage": {
|
||
"get": {
|
||
"operationId": "listKnowledgeTagUsage",
|
||
"summary": "List Tag Usage",
|
||
"description": "Report how many documents and chunks carry a value for each defined tag, so a caller can tell a tag that is actually populated from one that was only declared. The bounded set is returned in one page; `nextCursor` is always null. A workspace API key is rejected with `403`; use a personal API key.",
|
||
"tags": ["Knowledge Bases"],
|
||
"parameters": [
|
||
{
|
||
"name": "knowledgeBaseId",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "Unique knowledge base identifier.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique knowledge base identifier."
|
||
}
|
||
},
|
||
{
|
||
"name": "workspaceId",
|
||
"in": "query",
|
||
"required": true,
|
||
"description": "Workspace that owns the knowledge base.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "Usage counts for every defined tag.",
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"$ref": "#/components/headers/X-RateLimit-Limit"
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"$ref": "#/components/headers/X-RateLimit-Remaining"
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"$ref": "#/components/headers/X-RateLimit-Reset"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2KnowledgeTagUsageListResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"$ref": "#/components/responses/BadRequest"
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/Unauthorized"
|
||
},
|
||
"403": {
|
||
"$ref": "#/components/responses/Forbidden"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFound"
|
||
},
|
||
"429": {
|
||
"$ref": "#/components/responses/RateLimited"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalError"
|
||
},
|
||
"503": {
|
||
"$ref": "#/components/responses/ServiceUnavailable"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"components": {
|
||
"securitySchemes": {
|
||
"apiKey": {
|
||
"type": "apiKey",
|
||
"in": "header",
|
||
"name": "X-API-Key",
|
||
"description": "Your Sim API key, personal or workspace-scoped. Generate one under Settings, then API Keys. Operations that reject workspace keys say so in their own description."
|
||
}
|
||
},
|
||
"headers": {
|
||
"X-RateLimit-Limit": {
|
||
"description": "Maximum requests allowed in the current window.",
|
||
"schema": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"title": "Rate limit",
|
||
"description": "Maximum requests allowed in the current window."
|
||
}
|
||
},
|
||
"X-RateLimit-Remaining": {
|
||
"description": "Requests remaining in the current window.",
|
||
"schema": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"title": "Rate limit remaining",
|
||
"description": "Requests remaining in the current window."
|
||
}
|
||
},
|
||
"X-RateLimit-Reset": {
|
||
"description": "ISO 8601 timestamp when the current rate-limit window resets.",
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
|
||
"title": "Rate limit reset",
|
||
"description": "ISO 8601 timestamp when the current rate-limit window resets."
|
||
}
|
||
},
|
||
"Retry-After": {
|
||
"description": "Seconds to wait before retrying, sent on `429` and `503`. Add jitter rather than retrying at exactly this offset.",
|
||
"schema": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"title": "Retry after",
|
||
"description": "Seconds to wait before retrying, sent on `429` and `503`. Add jitter rather than retrying at exactly this offset."
|
||
}
|
||
},
|
||
"X-Run-Id": {
|
||
"description": "Identifier assigned to the workflow run.",
|
||
"schema": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"title": "Run identifier",
|
||
"description": "Identifier assigned to the workflow run."
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"BadRequest": {
|
||
"description": "The request is invalid. This includes a query parameter sent with no value (`?limit=`, `?search=`), which is rejected rather than read as zero, empty, or the parameter default — omit the parameter instead.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2Error"
|
||
},
|
||
"example": {
|
||
"error": {
|
||
"code": "BAD_REQUEST",
|
||
"message": "Invalid request"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"Unauthorized": {
|
||
"description": "The API key is missing or invalid.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2Error"
|
||
},
|
||
"example": {
|
||
"error": {
|
||
"code": "UNAUTHORIZED",
|
||
"message": "API key required"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"UsageLimitExceeded": {
|
||
"description": "The workspace has exceeded its usage or billing limits.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2Error"
|
||
},
|
||
"example": {
|
||
"error": {
|
||
"code": "USAGE_LIMIT_EXCEEDED",
|
||
"message": "Usage limit exceeded. Please upgrade your plan to continue."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"Forbidden": {
|
||
"description": "The caller lacks the rights this operation requires. When the cause is one a caller can act on, `error.details.code` names it. A resource in a workspace the caller cannot reach at all answers `404` instead, so absence and denial are indistinguishable.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2Error"
|
||
},
|
||
"example": {
|
||
"error": {
|
||
"code": "FORBIDDEN",
|
||
"message": "Insufficient workspace permissions",
|
||
"details": {
|
||
"code": "INSUFFICIENT_WORKSPACE_ROLE"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"NotFound": {
|
||
"description": "The requested resource was not found.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2Error"
|
||
},
|
||
"example": {
|
||
"error": {
|
||
"code": "NOT_FOUND",
|
||
"message": "Not found"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"Conflict": {
|
||
"description": "The request conflicts with current resource state.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2Error"
|
||
},
|
||
"example": {
|
||
"error": {
|
||
"code": "CONFLICT",
|
||
"message": "Upload has already been completed"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"PayloadTooLarge": {
|
||
"description": "The request, or a resource collection it must materialize, exceeds the allowed size: an oversized request body, a generated artifact past the download ceiling, or a workspace folder tree too large to load in full.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2Error"
|
||
},
|
||
"example": {
|
||
"error": {
|
||
"code": "PAYLOAD_TOO_LARGE",
|
||
"message": "Request body is too large"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"UnsupportedMediaType": {
|
||
"description": "The request uses an unsupported media type.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2Error"
|
||
},
|
||
"example": {
|
||
"error": {
|
||
"code": "UNSUPPORTED_MEDIA_TYPE",
|
||
"message": "Request body must be sent as application/json"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"RateLimited": {
|
||
"description": "The caller exceeded the request rate limit.",
|
||
"headers": {
|
||
"Retry-After": {
|
||
"$ref": "#/components/headers/Retry-After"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2Error"
|
||
},
|
||
"example": {
|
||
"error": {
|
||
"code": "RATE_LIMITED",
|
||
"message": "API rate limit exceeded",
|
||
"details": {
|
||
"retryAfter": "2026-01-01T00:00:30.000Z"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"InternalError": {
|
||
"description": "An unexpected server error occurred.",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2Error"
|
||
},
|
||
"example": {
|
||
"error": {
|
||
"code": "INTERNAL_ERROR",
|
||
"message": "Internal server error"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"ServiceUnavailable": {
|
||
"description": "A required service is temporarily unavailable. `Retry-After` carries the seconds to wait; treat it as a floor and add jitter. The header is omitted when `error.details.code` is `ASYNC_ENQUEUE_AMBIGUOUS`, because the run may already have started — reconcile against the returned run id instead of retrying.",
|
||
"headers": {
|
||
"Retry-After": {
|
||
"$ref": "#/components/headers/Retry-After"
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/V2Error"
|
||
},
|
||
"example": {
|
||
"error": {
|
||
"code": "SERVICE_UNAVAILABLE",
|
||
"message": "Service temporarily unavailable"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"schemas": {
|
||
"V2Error": {
|
||
"type": "object",
|
||
"properties": {
|
||
"error": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "string",
|
||
"description": "Stable machine-readable error code."
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"description": "Human-readable explanation of the error."
|
||
},
|
||
"details": {
|
||
"description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector."
|
||
}
|
||
},
|
||
"required": ["code", "message"],
|
||
"additionalProperties": false,
|
||
"description": "Canonical error details."
|
||
}
|
||
},
|
||
"required": ["error"],
|
||
"additionalProperties": false,
|
||
"title": "v2 error response",
|
||
"description": "Canonical error envelope returned by the public v2 API.",
|
||
"examples": [
|
||
{
|
||
"error": {
|
||
"code": "BAD_REQUEST",
|
||
"message": "The request is invalid."
|
||
}
|
||
}
|
||
]
|
||
},
|
||
"FolderPathInput": {
|
||
"title": "Folder path input",
|
||
"description": "Folder path. A missing leading slash is normalized before validation. Segments are percent-encoded, so a folder shown as \"New folder\" is `/New%20folder`: everything outside `A-Z a-z 0-9 - _ . ~` is escaped as uppercase hex, and only that exact encoding is accepted. A trailing slash, an empty segment, and a literal `.` or `..` segment are rejected. At most 64 segments and 4096 encoded bytes.",
|
||
"maxLength": 4096,
|
||
"type": "string"
|
||
},
|
||
"V2KnowledgeBase": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "Unique knowledge base identifier.",
|
||
"examples": ["7c9e6679-7425-40de-944b-e07fc1f90ae7"]
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "Human-readable knowledge base name.",
|
||
"examples": ["Product Documentation"]
|
||
},
|
||
"description": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Knowledge base description, or null when none is set.",
|
||
"examples": ["All product documentation and guides"]
|
||
},
|
||
"tokenCount": {
|
||
"type": "number",
|
||
"description": "Total tokens across indexed documents.",
|
||
"examples": [48213]
|
||
},
|
||
"embeddingModel": {
|
||
"type": "string",
|
||
"description": "Embedding model used to index documents.",
|
||
"examples": ["text-embedding-3-small"]
|
||
},
|
||
"embeddingDimension": {
|
||
"type": "number",
|
||
"description": "Dimensionality of the embedding vectors.",
|
||
"examples": [1536]
|
||
},
|
||
"chunkingConfig": {
|
||
"$ref": "#/components/schemas/V2KnowledgeChunkingConfig"
|
||
},
|
||
"docCount": {
|
||
"description": "Number of documents in the knowledge base.",
|
||
"examples": [12],
|
||
"type": "number"
|
||
},
|
||
"connectorTypes": {
|
||
"description": "External connector types that have synced documents into the knowledge base.",
|
||
"examples": [["notion", "google_drive"]],
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
"createdAt": {
|
||
"type": "string",
|
||
"description": "ISO 8601 timestamp when the knowledge base was created.",
|
||
"format": "date-time",
|
||
"examples": ["2025-01-10T09:00:00Z"]
|
||
},
|
||
"updatedAt": {
|
||
"type": "string",
|
||
"description": "ISO 8601 timestamp when the knowledge base was last modified.",
|
||
"format": "date-time",
|
||
"examples": ["2025-06-18T16:45:00Z"]
|
||
},
|
||
"webUrl": {
|
||
"type": "string",
|
||
"format": "uri",
|
||
"description": "Canonical absolute URL for opening this resource in the Sim web application."
|
||
},
|
||
"ownerEmail": {
|
||
"type": "string",
|
||
"format": "email",
|
||
"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
|
||
"description": "Current email address of the knowledge base owner.",
|
||
"examples": ["owner@example.com"]
|
||
},
|
||
"folderPath": {
|
||
"type": "string",
|
||
"title": "Folder path",
|
||
"description": "Canonical containing-folder path; `/` is the workspace root. Resolved against active folders only, so an archived knowledge base whose containing folder was archived with it reports `/`.",
|
||
"maxLength": 4096,
|
||
"examples": ["/Product"]
|
||
},
|
||
"deletedAt": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "ISO 8601 timestamp when the knowledge base was archived by `DELETE /knowledge/{knowledgeBaseId}`, or null while the knowledge base is active. Only `GET /knowledge?scope=archived` returns knowledge bases with a non-null value.",
|
||
"format": "date-time",
|
||
"examples": ["2026-01-16T09:00:00Z"]
|
||
}
|
||
},
|
||
"required": [
|
||
"id",
|
||
"name",
|
||
"description",
|
||
"tokenCount",
|
||
"embeddingModel",
|
||
"embeddingDimension",
|
||
"chunkingConfig",
|
||
"createdAt",
|
||
"updatedAt",
|
||
"webUrl",
|
||
"ownerEmail",
|
||
"folderPath",
|
||
"deletedAt"
|
||
],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge base",
|
||
"description": "A collection of documents indexed for vector and tag search."
|
||
},
|
||
"V2KnowledgeChunkingConfig": {
|
||
"type": "object",
|
||
"properties": {
|
||
"maxSize": {
|
||
"type": "number",
|
||
"description": "Maximum chunk size in tokens.",
|
||
"examples": [1024]
|
||
},
|
||
"minSize": {
|
||
"type": "number",
|
||
"description": "Minimum chunk size in characters.",
|
||
"examples": [100]
|
||
},
|
||
"overlap": {
|
||
"type": "number",
|
||
"description": "Number of overlapping characters between adjacent chunks.",
|
||
"examples": [200]
|
||
},
|
||
"strategy": {
|
||
"description": "Chunking strategy applied during document processing.",
|
||
"type": "string",
|
||
"enum": ["auto", "text", "regex", "recursive", "sentence", "token"]
|
||
},
|
||
"strategyOptions": {
|
||
"description": "Strategy-specific tuning options.",
|
||
"type": "object",
|
||
"properties": {
|
||
"pattern": {
|
||
"description": "Regular expression used by the regex chunking strategy.",
|
||
"type": "string",
|
||
"maxLength": 500
|
||
},
|
||
"separators": {
|
||
"description": "Ordered separators used to split content into chunks.",
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
"recipe": {
|
||
"description": "Content-aware recipe used by the automatic chunking strategy.",
|
||
"type": "string",
|
||
"enum": ["plain", "markdown", "code"]
|
||
},
|
||
"strictBoundaries": {
|
||
"description": "Whether regex matches must form strict chunk boundaries.",
|
||
"type": "boolean"
|
||
}
|
||
},
|
||
"additionalProperties": false
|
||
}
|
||
},
|
||
"required": ["maxSize", "minSize", "overlap"],
|
||
"additionalProperties": {
|
||
"description": "Additional forward-compatible chunking configuration property."
|
||
},
|
||
"title": "Knowledge chunking configuration",
|
||
"description": "How documents in a knowledge base are split into chunks before embedding."
|
||
},
|
||
"V2KnowledgeBaseListResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/V2KnowledgeBase"
|
||
},
|
||
"description": "Items in the current page."
|
||
},
|
||
"nextCursor": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Opaque cursor for the next page. Send it back as `cursor`; `null` means there is nothing further to fetch. Never construct one yourself."
|
||
}
|
||
},
|
||
"required": ["data", "nextCursor"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge base list response",
|
||
"description": "A cursor-paginated page of knowledge bases."
|
||
},
|
||
"V2KnowledgeBaseResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2KnowledgeBase"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge base response",
|
||
"description": "A single knowledge base."
|
||
},
|
||
"V2KnowledgeChunkingConfigInput": {
|
||
"type": "object",
|
||
"properties": {
|
||
"maxSize": {
|
||
"default": 1024,
|
||
"description": "Maximum chunk size in tokens.",
|
||
"examples": [1024],
|
||
"type": "number",
|
||
"minimum": 100,
|
||
"maximum": 4000
|
||
},
|
||
"minSize": {
|
||
"default": 100,
|
||
"description": "Minimum chunk size in characters.",
|
||
"examples": [100],
|
||
"type": "number",
|
||
"minimum": 1,
|
||
"maximum": 2000
|
||
},
|
||
"overlap": {
|
||
"default": 200,
|
||
"description": "Number of overlapping characters between adjacent chunks.",
|
||
"examples": [200],
|
||
"type": "number",
|
||
"minimum": 0,
|
||
"maximum": 500
|
||
},
|
||
"strategy": {
|
||
"description": "Chunking strategy applied during document processing. `regex` additionally requires `strategyOptions.pattern`.",
|
||
"type": "string",
|
||
"enum": ["auto", "text", "regex", "recursive", "sentence", "token"]
|
||
},
|
||
"strategyOptions": {
|
||
"description": "Strategy-specific tuning options. `strictBoundaries` is accepted only with `strategy: \"regex\"`.",
|
||
"type": "object",
|
||
"properties": {
|
||
"pattern": {
|
||
"description": "Regular expression used by the regex chunking strategy.",
|
||
"type": "string",
|
||
"maxLength": 500
|
||
},
|
||
"separators": {
|
||
"description": "Ordered separators used to split content into chunks.",
|
||
"maxItems": 32,
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string",
|
||
"maxLength": 100
|
||
}
|
||
},
|
||
"recipe": {
|
||
"description": "Content-aware recipe used by the automatic chunking strategy.",
|
||
"type": "string",
|
||
"enum": ["plain", "markdown", "code"]
|
||
},
|
||
"strictBoundaries": {
|
||
"description": "Whether regex matches must form strict chunk boundaries.",
|
||
"type": "boolean"
|
||
}
|
||
},
|
||
"additionalProperties": false
|
||
}
|
||
},
|
||
"additionalProperties": false,
|
||
"title": "Knowledge chunking configuration input",
|
||
"description": "Chunking configuration applied when processing documents. On update this object is replaced wholesale rather than merged, so a caller preserving one key must read, modify, and write the whole object back."
|
||
},
|
||
"CreateKnowledgeBaseRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace in which to create the knowledge base."
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 255,
|
||
"description": "Human-readable knowledge base name.",
|
||
"examples": ["Product Documentation"]
|
||
},
|
||
"description": {
|
||
"description": "Optional knowledge base description.",
|
||
"examples": ["All product documentation and guides"],
|
||
"type": "string",
|
||
"maxLength": 10000
|
||
},
|
||
"chunkingConfig": {
|
||
"default": {
|
||
"maxSize": 1024,
|
||
"minSize": 100,
|
||
"overlap": 200
|
||
},
|
||
"description": "Chunking configuration; defaults are applied when omitted.",
|
||
"$ref": "#/components/schemas/V2KnowledgeChunkingConfigInput"
|
||
},
|
||
"folderPath": {
|
||
"description": "Containing folder path; omission creates the knowledge base at the root.",
|
||
"$ref": "#/components/schemas/FolderPathInput"
|
||
}
|
||
},
|
||
"required": ["workspaceId", "name"],
|
||
"additionalProperties": false,
|
||
"title": "Create knowledge base request",
|
||
"description": "Workspace, name, description, chunking configuration, and folder placement."
|
||
},
|
||
"UpdateKnowledgeBaseRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
},
|
||
"name": {
|
||
"description": "New knowledge base name.",
|
||
"examples": ["Updated Product Documentation"],
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 255
|
||
},
|
||
"description": {
|
||
"description": "New knowledge base description.",
|
||
"examples": ["Refreshed product documentation and guides"],
|
||
"type": "string",
|
||
"maxLength": 10000
|
||
},
|
||
"chunkingConfig": {
|
||
"description": "New document chunking configuration.",
|
||
"$ref": "#/components/schemas/V2KnowledgeChunkingConfigInput"
|
||
},
|
||
"folderPath": {
|
||
"description": "New containing-folder path.",
|
||
"$ref": "#/components/schemas/FolderPathInput"
|
||
}
|
||
},
|
||
"required": ["workspaceId"],
|
||
"additionalProperties": false,
|
||
"title": "Update knowledge base request",
|
||
"description": "Workspace scope and fields to update. At least one mutable field is required."
|
||
},
|
||
"V2KnowledgeDeleteData": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "Identifier of the deleted resource.",
|
||
"examples": ["7c9e6679-7425-40de-944b-e07fc1f90ae7"]
|
||
},
|
||
"deleted": {
|
||
"type": "boolean",
|
||
"const": true,
|
||
"description": "Confirms that the resource was deleted."
|
||
}
|
||
},
|
||
"required": ["id", "deleted"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge deletion data",
|
||
"description": "Acknowledgement for a deleted knowledge base or document."
|
||
},
|
||
"V2KnowledgeDeleteResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2KnowledgeDeleteData"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge deletion response",
|
||
"description": "Deletion acknowledgement containing the removed resource identifier."
|
||
},
|
||
"V2KnowledgeConnector": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique connector identifier."
|
||
},
|
||
"knowledgeBaseId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Knowledge base synced by the connector."
|
||
},
|
||
"connectorType": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Registered external source type."
|
||
},
|
||
"credentialId": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "OAuth credential identifier, or null for API-key and unauthenticated sources."
|
||
},
|
||
"sourceConfig": {
|
||
"type": "object",
|
||
"propertyNames": {
|
||
"type": "string"
|
||
},
|
||
"additionalProperties": {
|
||
"description": "Connector-specific source configuration value."
|
||
},
|
||
"description": "Connector-specific source selection and filtering configuration."
|
||
},
|
||
"syncMode": {
|
||
"type": "string",
|
||
"description": "Synchronization mode used by the connector."
|
||
},
|
||
"syncIntervalMinutes": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Scheduled synchronization interval in minutes; zero disables scheduled syncs."
|
||
},
|
||
"status": {
|
||
"type": "string",
|
||
"enum": ["active", "paused", "pending", "syncing", "error", "disabled"],
|
||
"description": "Current connector state. `pending` means a sync is queued but not yet running."
|
||
},
|
||
"lastSyncAt": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Time of the most recent synchronization, or null before the first sync."
|
||
},
|
||
"lastSyncError": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Most recent synchronization error, or null when none is recorded."
|
||
},
|
||
"lastSyncDocCount": {
|
||
"anyOf": [
|
||
{
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Documents observed by the most recent synchronization."
|
||
},
|
||
"nextSyncAt": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Next scheduled synchronization time, or null when not scheduled."
|
||
},
|
||
"consecutiveFailures": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Number of consecutive synchronization failures."
|
||
},
|
||
"createdAt": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
|
||
"description": "Time the connector was created."
|
||
},
|
||
"updatedAt": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
|
||
"description": "Time the connector was last updated."
|
||
}
|
||
},
|
||
"required": [
|
||
"id",
|
||
"knowledgeBaseId",
|
||
"connectorType",
|
||
"credentialId",
|
||
"sourceConfig",
|
||
"syncMode",
|
||
"syncIntervalMinutes",
|
||
"status",
|
||
"lastSyncAt",
|
||
"lastSyncError",
|
||
"lastSyncDocCount",
|
||
"nextSyncAt",
|
||
"consecutiveFailures",
|
||
"createdAt",
|
||
"updatedAt"
|
||
],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge connector",
|
||
"description": "An external document source linked to a knowledge base, without secret material."
|
||
},
|
||
"V2KnowledgeConnectorListResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/V2KnowledgeConnector"
|
||
},
|
||
"description": "Items in the current page."
|
||
},
|
||
"nextCursor": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Opaque cursor for the next page. Send it back as `cursor`; `null` means there is nothing further to fetch. Never construct one yourself."
|
||
}
|
||
},
|
||
"required": ["data", "nextCursor"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge connector list response",
|
||
"description": "A cursor-paginated page of connectors without secret material.",
|
||
"examples": [
|
||
{
|
||
"data": [
|
||
{
|
||
"id": "kc-9f8e7d6c",
|
||
"knowledgeBaseId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
|
||
"connectorType": "notion",
|
||
"credentialId": "cred-4b3a2c1d",
|
||
"sourceConfig": {
|
||
"pageIds": ["page-123"]
|
||
},
|
||
"syncMode": "full",
|
||
"syncIntervalMinutes": 1440,
|
||
"status": "active",
|
||
"lastSyncAt": "2026-06-20T14:02:11.000Z",
|
||
"lastSyncError": null,
|
||
"lastSyncDocCount": 42,
|
||
"nextSyncAt": "2026-06-21T14:02:11.000Z",
|
||
"consecutiveFailures": 0,
|
||
"createdAt": "2026-06-01T09:14:00.000Z",
|
||
"updatedAt": "2026-06-20T14:02:11.000Z"
|
||
}
|
||
],
|
||
"nextCursor": null
|
||
}
|
||
]
|
||
},
|
||
"V2KnowledgeConnectorResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2KnowledgeConnector"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge connector response",
|
||
"description": "A single connector without secret material.",
|
||
"examples": [
|
||
{
|
||
"data": {
|
||
"id": "kc-9f8e7d6c",
|
||
"knowledgeBaseId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
|
||
"connectorType": "notion",
|
||
"credentialId": "cred-4b3a2c1d",
|
||
"sourceConfig": {
|
||
"pageIds": ["page-123"]
|
||
},
|
||
"syncMode": "full",
|
||
"syncIntervalMinutes": 1440,
|
||
"status": "active",
|
||
"lastSyncAt": "2026-06-20T14:02:11.000Z",
|
||
"lastSyncError": null,
|
||
"lastSyncDocCount": 42,
|
||
"nextSyncAt": "2026-06-21T14:02:11.000Z",
|
||
"consecutiveFailures": 0,
|
||
"createdAt": "2026-06-01T09:14:00.000Z",
|
||
"updatedAt": "2026-06-20T14:02:11.000Z"
|
||
}
|
||
}
|
||
]
|
||
},
|
||
"CreateKnowledgeConnectorRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
},
|
||
"connectorType": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 100,
|
||
"description": "Registered connector type."
|
||
},
|
||
"credentialId": {
|
||
"description": "OAuth credential identifier for connectors that require OAuth.",
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 255
|
||
},
|
||
"apiKey": {
|
||
"description": "Write-only API key for connectors that use API-key authentication.",
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 10000
|
||
},
|
||
"sourceConfig": {
|
||
"type": "object",
|
||
"propertyNames": {
|
||
"type": "string"
|
||
},
|
||
"additionalProperties": {
|
||
"description": "Connector-specific source configuration value."
|
||
},
|
||
"description": "Connector-specific source selection and filtering configuration."
|
||
},
|
||
"syncIntervalMinutes": {
|
||
"default": 1440,
|
||
"description": "Scheduled synchronization interval in minutes; zero disables scheduling.",
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 525600
|
||
}
|
||
},
|
||
"required": ["workspaceId", "connectorType", "sourceConfig"],
|
||
"additionalProperties": false,
|
||
"title": "Create knowledge connector request",
|
||
"description": "Workspace, connector type, authentication reference, source configuration, and sync schedule.",
|
||
"examples": [
|
||
{
|
||
"workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64",
|
||
"connectorType": "notion",
|
||
"credentialId": "cred-4b3a2c1d",
|
||
"sourceConfig": {
|
||
"pageIds": ["page-123"]
|
||
},
|
||
"syncIntervalMinutes": 1440
|
||
}
|
||
]
|
||
},
|
||
"V2KnowledgeConnectorSyncLog": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique synchronization log identifier."
|
||
},
|
||
"connectorId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Connector that produced the log."
|
||
},
|
||
"status": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Synchronization outcome or current state."
|
||
},
|
||
"startedAt": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
|
||
"description": "Time synchronization started."
|
||
},
|
||
"completedAt": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Time synchronization completed, or null while it is running."
|
||
},
|
||
"docsAdded": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Documents added."
|
||
},
|
||
"docsUpdated": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Documents updated."
|
||
},
|
||
"docsDeleted": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Documents deleted."
|
||
},
|
||
"docsUnchanged": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Documents unchanged."
|
||
},
|
||
"docsFailed": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Documents that failed to synchronize."
|
||
},
|
||
"errorMessage": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Synchronization error, or null."
|
||
}
|
||
},
|
||
"required": [
|
||
"id",
|
||
"connectorId",
|
||
"status",
|
||
"startedAt",
|
||
"completedAt",
|
||
"docsAdded",
|
||
"docsUpdated",
|
||
"docsDeleted",
|
||
"docsUnchanged",
|
||
"docsFailed",
|
||
"errorMessage"
|
||
],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge connector sync log",
|
||
"description": "One synchronization attempt for a knowledge connector."
|
||
},
|
||
"V2KnowledgeConnectorDetail": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique connector identifier."
|
||
},
|
||
"knowledgeBaseId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Knowledge base synced by the connector."
|
||
},
|
||
"connectorType": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Registered external source type."
|
||
},
|
||
"credentialId": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "OAuth credential identifier, or null for API-key and unauthenticated sources."
|
||
},
|
||
"sourceConfig": {
|
||
"type": "object",
|
||
"propertyNames": {
|
||
"type": "string"
|
||
},
|
||
"additionalProperties": {
|
||
"description": "Connector-specific source configuration value."
|
||
},
|
||
"description": "Connector-specific source selection and filtering configuration."
|
||
},
|
||
"syncMode": {
|
||
"type": "string",
|
||
"description": "Synchronization mode used by the connector."
|
||
},
|
||
"syncIntervalMinutes": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Scheduled synchronization interval in minutes; zero disables scheduled syncs."
|
||
},
|
||
"status": {
|
||
"type": "string",
|
||
"enum": ["active", "paused", "pending", "syncing", "error", "disabled"],
|
||
"description": "Current connector state. `pending` means a sync is queued but not yet running."
|
||
},
|
||
"lastSyncAt": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Time of the most recent synchronization, or null before the first sync."
|
||
},
|
||
"lastSyncError": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Most recent synchronization error, or null when none is recorded."
|
||
},
|
||
"lastSyncDocCount": {
|
||
"anyOf": [
|
||
{
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Documents observed by the most recent synchronization."
|
||
},
|
||
"nextSyncAt": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Next scheduled synchronization time, or null when not scheduled."
|
||
},
|
||
"consecutiveFailures": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Number of consecutive synchronization failures."
|
||
},
|
||
"createdAt": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
|
||
"description": "Time the connector was created."
|
||
},
|
||
"updatedAt": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
|
||
"description": "Time the connector was last updated."
|
||
},
|
||
"syncLogs": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/V2KnowledgeConnectorSyncLog"
|
||
},
|
||
"description": "The ten most recent synchronization attempts."
|
||
}
|
||
},
|
||
"required": [
|
||
"id",
|
||
"knowledgeBaseId",
|
||
"connectorType",
|
||
"credentialId",
|
||
"sourceConfig",
|
||
"syncMode",
|
||
"syncIntervalMinutes",
|
||
"status",
|
||
"lastSyncAt",
|
||
"lastSyncError",
|
||
"lastSyncDocCount",
|
||
"nextSyncAt",
|
||
"consecutiveFailures",
|
||
"createdAt",
|
||
"updatedAt",
|
||
"syncLogs"
|
||
],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge connector detail",
|
||
"description": "A knowledge connector and its recent synchronization history."
|
||
},
|
||
"V2KnowledgeConnectorDetailResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2KnowledgeConnectorDetail"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge connector detail response",
|
||
"description": "A connector and recent synchronization history without secret material.",
|
||
"examples": [
|
||
{
|
||
"data": {
|
||
"id": "kc-9f8e7d6c",
|
||
"knowledgeBaseId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
|
||
"connectorType": "notion",
|
||
"credentialId": "cred-4b3a2c1d",
|
||
"sourceConfig": {
|
||
"pageIds": ["page-123"]
|
||
},
|
||
"syncMode": "full",
|
||
"syncIntervalMinutes": 1440,
|
||
"status": "active",
|
||
"lastSyncAt": "2026-06-20T14:02:11.000Z",
|
||
"lastSyncError": null,
|
||
"lastSyncDocCount": 42,
|
||
"nextSyncAt": "2026-06-21T14:02:11.000Z",
|
||
"consecutiveFailures": 0,
|
||
"createdAt": "2026-06-01T09:14:00.000Z",
|
||
"updatedAt": "2026-06-20T14:02:11.000Z",
|
||
"syncLogs": []
|
||
}
|
||
}
|
||
]
|
||
},
|
||
"UpdateKnowledgeConnectorRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
},
|
||
"sourceConfig": {
|
||
"description": "Replacement source selection and filtering configuration. Updating a runnable connector queues synchronization; paused connectors remain paused.",
|
||
"type": "object",
|
||
"propertyNames": {
|
||
"type": "string"
|
||
},
|
||
"additionalProperties": {
|
||
"description": "Connector-specific source configuration value."
|
||
}
|
||
},
|
||
"syncIntervalMinutes": {
|
||
"description": "New scheduled synchronization interval in minutes.",
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 525600
|
||
},
|
||
"status": {
|
||
"description": "New connector state.",
|
||
"type": "string",
|
||
"enum": ["active", "paused"]
|
||
}
|
||
},
|
||
"required": ["workspaceId"],
|
||
"additionalProperties": false,
|
||
"title": "Update knowledge connector request",
|
||
"description": "Workspace scope and at least one mutable connector field.",
|
||
"examples": [
|
||
{
|
||
"workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64",
|
||
"status": "paused"
|
||
}
|
||
]
|
||
},
|
||
"V2KnowledgeConnectorDeleteData": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Deleted connector identifier."
|
||
},
|
||
"deleted": {
|
||
"type": "boolean",
|
||
"const": true,
|
||
"description": "Whether the connector was deleted."
|
||
},
|
||
"documentsDeleted": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Connector documents deleted."
|
||
},
|
||
"documentsKept": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Connector documents retained."
|
||
}
|
||
},
|
||
"required": ["id", "deleted", "documentsDeleted", "documentsKept"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge connector deletion data",
|
||
"description": "Connector deletion acknowledgement and affected document counts."
|
||
},
|
||
"V2KnowledgeConnectorDeleteResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2KnowledgeConnectorDeleteData"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge connector delete response",
|
||
"description": "Deletion acknowledgement and affected document counts.",
|
||
"examples": [
|
||
{
|
||
"data": {
|
||
"id": "kc-9f8e7d6c",
|
||
"deleted": true,
|
||
"documentsDeleted": 0,
|
||
"documentsKept": 42
|
||
}
|
||
}
|
||
]
|
||
},
|
||
"V2KnowledgeConnectorSyncData": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Connector queued for synchronization."
|
||
},
|
||
"syncTriggered": {
|
||
"type": "boolean",
|
||
"const": true,
|
||
"description": "Whether synchronization was queued."
|
||
}
|
||
},
|
||
"required": ["id", "syncTriggered"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge connector sync data",
|
||
"description": "Acknowledgement that connector synchronization was queued."
|
||
},
|
||
"V2KnowledgeConnectorSyncResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2KnowledgeConnectorSyncData"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge connector sync response",
|
||
"description": "Acknowledgement that synchronization was queued.",
|
||
"examples": [
|
||
{
|
||
"data": {
|
||
"id": "kc-9f8e7d6c",
|
||
"syncTriggered": true
|
||
}
|
||
}
|
||
]
|
||
},
|
||
"SyncKnowledgeConnectorRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
},
|
||
"rehydrate": {
|
||
"default": false,
|
||
"description": "Re-fetch and re-index every existing connector document.",
|
||
"type": "boolean"
|
||
}
|
||
},
|
||
"required": ["workspaceId"],
|
||
"additionalProperties": false,
|
||
"title": "Sync knowledge connector request",
|
||
"description": "Workspace scope and optional full rehydration control.",
|
||
"examples": [
|
||
{
|
||
"workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64",
|
||
"rehydrate": false
|
||
}
|
||
]
|
||
},
|
||
"V2KnowledgeConnectorDocument": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Unique document identifier."
|
||
},
|
||
"filename": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Document filename."
|
||
},
|
||
"externalId": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Identifier assigned by the external source."
|
||
},
|
||
"sourceUrl": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Original external source URL."
|
||
},
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "Whether the document is enabled for knowledge search."
|
||
},
|
||
"userExcluded": {
|
||
"type": "boolean",
|
||
"description": "Whether a user explicitly excluded the document from connector sync results."
|
||
},
|
||
"createdAt": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
|
||
"description": "Time the document was first synchronized."
|
||
},
|
||
"processingStatus": {
|
||
"type": "string",
|
||
"description": "Current document processing state."
|
||
}
|
||
},
|
||
"required": [
|
||
"id",
|
||
"filename",
|
||
"externalId",
|
||
"sourceUrl",
|
||
"enabled",
|
||
"userExcluded",
|
||
"createdAt",
|
||
"processingStatus"
|
||
],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge connector document",
|
||
"description": "A knowledge document produced by an external connector."
|
||
},
|
||
"V2KnowledgeConnectorDocumentListResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/V2KnowledgeConnectorDocument"
|
||
},
|
||
"description": "Items in the current page."
|
||
},
|
||
"nextCursor": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Opaque cursor for the next page. Send it back as `cursor`; `null` means there is nothing further to fetch. Never construct one yourself."
|
||
}
|
||
},
|
||
"required": ["data", "nextCursor"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge connector document list response",
|
||
"description": "A cursor-paginated page of connector documents.",
|
||
"examples": [
|
||
{
|
||
"data": [
|
||
{
|
||
"id": "doc-8a7b6c5d",
|
||
"filename": "Product requirements",
|
||
"externalId": "page-123",
|
||
"sourceUrl": "https://www.notion.so/page-123",
|
||
"enabled": true,
|
||
"userExcluded": false,
|
||
"createdAt": "2026-06-01T09:15:00.000Z",
|
||
"processingStatus": "completed"
|
||
}
|
||
],
|
||
"nextCursor": null
|
||
}
|
||
]
|
||
},
|
||
"V2KnowledgeConnectorDocumentsUpdateData": {
|
||
"type": "object",
|
||
"properties": {
|
||
"operation": {
|
||
"type": "string",
|
||
"enum": ["restore", "exclude"],
|
||
"description": "Operation that was applied."
|
||
},
|
||
"updatedCount": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Documents changed."
|
||
},
|
||
"documentIds": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"description": "Identifiers of documents changed."
|
||
}
|
||
},
|
||
"required": ["operation", "updatedCount", "documentIds"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge connector documents update data",
|
||
"description": "Outcome of restoring or excluding connector documents."
|
||
},
|
||
"V2KnowledgeConnectorDocumentsUpdateResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2KnowledgeConnectorDocumentsUpdateData"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge connector documents update response",
|
||
"description": "Operation result and identifiers actually changed.",
|
||
"examples": [
|
||
{
|
||
"data": {
|
||
"operation": "exclude",
|
||
"updatedCount": 1,
|
||
"documentIds": ["doc-8a7b6c5d"]
|
||
}
|
||
}
|
||
]
|
||
},
|
||
"UpdateKnowledgeConnectorDocumentsRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
},
|
||
"operation": {
|
||
"type": "string",
|
||
"enum": ["restore", "exclude"],
|
||
"description": "Whether to restore or exclude the selected documents."
|
||
},
|
||
"documentIds": {
|
||
"minItems": 1,
|
||
"maxItems": 100,
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 255
|
||
},
|
||
"description": "Connector document identifiers to update."
|
||
}
|
||
},
|
||
"required": ["workspaceId", "operation", "documentIds"],
|
||
"additionalProperties": false,
|
||
"title": "Update knowledge connector documents request",
|
||
"description": "Workspace, restore or exclude operation, and selected document identifiers.",
|
||
"examples": [
|
||
{
|
||
"workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64",
|
||
"operation": "exclude",
|
||
"documentIds": ["doc-8a7b6c5d"]
|
||
}
|
||
]
|
||
},
|
||
"V2KnowledgeSearchResult": {
|
||
"type": "object",
|
||
"properties": {
|
||
"knowledgeBaseId": {
|
||
"type": "string",
|
||
"description": "Knowledge base the matching chunk came from; a search may span up to 20.",
|
||
"examples": ["7c9e6679-7425-40de-944b-e07fc1f90ae7"]
|
||
},
|
||
"documentId": {
|
||
"type": "string",
|
||
"description": "Identifier of the document containing the matching chunk.",
|
||
"examples": ["b2d4f8a0-1c3e-4a5b-9d7c-2e6f0a8b4c12"]
|
||
},
|
||
"documentName": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Filename of the source document, or null when unavailable.",
|
||
"examples": ["getting-started.pdf"]
|
||
},
|
||
"sourceUrl": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Original source URL, or null for a directly uploaded document."
|
||
},
|
||
"content": {
|
||
"type": "string",
|
||
"description": "Text content of the matching chunk.",
|
||
"examples": ["To reset your password, open Settings and choose Security."]
|
||
},
|
||
"chunkIndex": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Zero-based chunk index within the document.",
|
||
"examples": [3]
|
||
},
|
||
"metadata": {
|
||
"type": "object",
|
||
"propertyNames": {
|
||
"type": "string"
|
||
},
|
||
"additionalProperties": {
|
||
"description": "User-defined string, number, boolean, or date tag value."
|
||
},
|
||
"description": "Document tag values keyed by tag display name.",
|
||
"examples": [
|
||
{
|
||
"category": "billing",
|
||
"priority": 2
|
||
}
|
||
]
|
||
},
|
||
"similarity": {
|
||
"type": "number",
|
||
"description": "Similarity score for vector search; tag-only matches use 1.",
|
||
"examples": [0.8423]
|
||
},
|
||
"rerankerScore": {
|
||
"description": "Relevance score assigned by the reranker, present only on results a reranker ordered. Results are ordered by this score when it is present, which is why it can disagree with `similarity`.",
|
||
"examples": [0.9312],
|
||
"type": "number"
|
||
}
|
||
},
|
||
"required": [
|
||
"knowledgeBaseId",
|
||
"documentId",
|
||
"documentName",
|
||
"sourceUrl",
|
||
"content",
|
||
"chunkIndex",
|
||
"metadata",
|
||
"similarity"
|
||
],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge search result",
|
||
"description": "A matching document chunk returned by knowledge search."
|
||
},
|
||
"V2KnowledgeSearchData": {
|
||
"type": "object",
|
||
"properties": {
|
||
"results": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/V2KnowledgeSearchResult"
|
||
},
|
||
"description": "Matching chunks ordered by relevance."
|
||
},
|
||
"query": {
|
||
"type": "string",
|
||
"description": "Executed query, or an empty string for tag-only search.",
|
||
"examples": ["How do I reset my password?"]
|
||
},
|
||
"knowledgeBaseIds": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"description": "Knowledge base identifiers that were searched.",
|
||
"examples": [["7c9e6679-7425-40de-944b-e07fc1f90ae7"]]
|
||
},
|
||
"topK": {
|
||
"type": "integer",
|
||
"exclusiveMinimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Maximum number of results requested.",
|
||
"examples": [10]
|
||
},
|
||
"totalResults": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Number of results returned.",
|
||
"examples": [4]
|
||
},
|
||
"rerankerStatus": {
|
||
"type": "string",
|
||
"enum": ["not_requested", "skipped", "unavailable", "applied"],
|
||
"description": "What the reranker did on this search. `applied` means it ordered the results, which carry `rerankerScore`. `unavailable` means it was attempted but could not complete, so results are in vector order with no `rerankerScore` — the search still succeeded, and is worth retrying. `skipped` means there was nothing to rank. `not_requested` means `rerankerEnabled` was absent or false.",
|
||
"examples": ["applied"]
|
||
}
|
||
},
|
||
"required": [
|
||
"results",
|
||
"query",
|
||
"knowledgeBaseIds",
|
||
"topK",
|
||
"totalResults",
|
||
"rerankerStatus"
|
||
],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge search data",
|
||
"description": "Results and execution context for a knowledge search."
|
||
},
|
||
"V2KnowledgeSearchResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2KnowledgeSearchData"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge search response",
|
||
"description": "Matching chunks and search execution context."
|
||
},
|
||
"V2KnowledgeSearchTagFilter": {
|
||
"type": "object",
|
||
"properties": {
|
||
"tagName": {
|
||
"type": "string",
|
||
"description": "Display name of the tag to filter.",
|
||
"examples": ["category"]
|
||
},
|
||
"fieldType": {
|
||
"description": "Tag field type.",
|
||
"type": "string",
|
||
"enum": ["text", "number", "date", "boolean"]
|
||
},
|
||
"operator": {
|
||
"default": "eq",
|
||
"description": "Comparison operator; valid operators depend on the field type. Text tags accept eq, neq, contains, not_contains, starts_with, ends_with; number and date tags accept eq, neq, gt, gte, lt, lte, between; boolean tags accept eq, neq. An operator the tag's field type does not implement is rejected, never ignored.",
|
||
"examples": ["eq"],
|
||
"type": "string",
|
||
"enum": [
|
||
"eq",
|
||
"neq",
|
||
"contains",
|
||
"not_contains",
|
||
"starts_with",
|
||
"ends_with",
|
||
"gt",
|
||
"gte",
|
||
"lt",
|
||
"lte",
|
||
"between"
|
||
]
|
||
},
|
||
"value": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "number"
|
||
},
|
||
{
|
||
"type": "boolean"
|
||
}
|
||
],
|
||
"description": "Tag value to compare against.",
|
||
"examples": ["billing"]
|
||
},
|
||
"valueTo": {
|
||
"description": "Upper bound for the `between` operator, and required whenever that operator is used.",
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "number"
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"required": ["tagName", "value"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge search tag filter",
|
||
"description": "A structured tag filter applied to knowledge search."
|
||
},
|
||
"SearchKnowledgeRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge bases."
|
||
},
|
||
"knowledgeBaseIds": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string",
|
||
"minLength": 1
|
||
},
|
||
{
|
||
"minItems": 1,
|
||
"maxItems": 20,
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string",
|
||
"minLength": 1
|
||
}
|
||
}
|
||
],
|
||
"description": "One knowledge base identifier or an array of up to 20 identifiers.",
|
||
"examples": [["7c9e6679-7425-40de-944b-e07fc1f90ae7"]]
|
||
},
|
||
"query": {
|
||
"description": "Natural-language query; required when tag filters are omitted. At most 32768 characters — longer text exceeds the embedding model's per-input token ceiling and would be truncated before the billed search ran.",
|
||
"examples": ["How do I reset my password?"],
|
||
"type": "string",
|
||
"maxLength": 32768
|
||
},
|
||
"topK": {
|
||
"default": 10,
|
||
"description": "Maximum number of search results to return. Must be a whole number between 1 and 100; the boundary schema only bounds the range, so a fractional value is admitted here and then rejected with 400 during search.",
|
||
"type": "number",
|
||
"minimum": 1,
|
||
"maximum": 100
|
||
},
|
||
"tagFilters": {
|
||
"description": "Structured tag filters, at most 10 of them. Every filter must hold, including two that name the same tag: repeating one tag narrows the result rather than widening it, matching `GET /api/v2/knowledge/{knowledgeBaseId}/documents`. To match either of two values for one tag, issue a search per value. Each filtered tag must resolve to the same slot and field type in every knowledge base selected; one missing from any of them, or defined inconsistently across them, is rejected rather than ignored, and those knowledge bases must be searched separately. List the available names with `GET /api/v2/knowledge/{knowledgeBaseId}/tags`.",
|
||
"maxItems": 10,
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/V2KnowledgeSearchTagFilter"
|
||
}
|
||
},
|
||
"searchMode": {
|
||
"description": "Retrieval strategy: vector is semantic-only, while hybrid also runs full-text search.",
|
||
"default": "vector",
|
||
"anyOf": [
|
||
{
|
||
"type": "string",
|
||
"enum": ["vector", "hybrid"]
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
]
|
||
},
|
||
"rerankerEnabled": {
|
||
"description": "Re-order retrieved chunks with a reranking model before truncating to `topK`. Ignored for a tag-only search, and billed as an additional search unit. Reranking is best-effort — a provider failure falls back to vector ordering, so check `rerankerStatus` on the response.",
|
||
"type": "boolean"
|
||
},
|
||
"rerankerModel": {
|
||
"default": "rerank-v4.0-fast",
|
||
"description": "Reranking model to use when `rerankerEnabled` is true. Defaults to `rerank-v4.0-fast`.",
|
||
"type": "string",
|
||
"enum": ["rerank-v4.0-pro", "rerank-v4.0-fast", "rerank-v3.5"]
|
||
},
|
||
"rerankerInputCount": {
|
||
"description": "How many candidate chunks to retrieve before reranking. Defaults to four times `topK`, capped at 100. A larger pool costs more retrieval work but gives the reranker more to choose from.",
|
||
"type": "integer",
|
||
"minimum": 1,
|
||
"maximum": 100
|
||
}
|
||
},
|
||
"required": ["workspaceId", "knowledgeBaseIds"],
|
||
"additionalProperties": false,
|
||
"title": "Search knowledge request",
|
||
"description": "Knowledge bases, query, result limit, retrieval mode, and optional tag filters."
|
||
},
|
||
"V2KnowledgeTag": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "Tag definition identifier. Published because `PATCH` and `DELETE /knowledge/{knowledgeBaseId}/tags/{tagId}` address a definition by it; without it those operations are unreachable from a list read."
|
||
},
|
||
"displayName": {
|
||
"type": "string",
|
||
"description": "Display name used by tag filters and by tag values on document reads.",
|
||
"examples": ["category"]
|
||
},
|
||
"tagSlot": {
|
||
"type": "string",
|
||
"description": "Storage slot the tag occupies. Document writes set tag values by slot (`tag1`..`tag7`).",
|
||
"examples": ["tag1"]
|
||
},
|
||
"fieldType": {
|
||
"type": "string",
|
||
"description": "Value type stored in the slot; it determines the valid filter operators.",
|
||
"examples": ["text"]
|
||
}
|
||
},
|
||
"required": ["id", "displayName", "tagSlot", "fieldType"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge tag",
|
||
"description": "A tag defined on a knowledge base, and the slot it is stored in."
|
||
},
|
||
"V2KnowledgeTagListResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/V2KnowledgeTag"
|
||
},
|
||
"description": "Items in the current page."
|
||
},
|
||
"nextCursor": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Always `null` — this list has no `cursor` or `limit` param and returns its whole bounded set in one page. Present so the list can gain pages later without a shape change."
|
||
}
|
||
},
|
||
"required": ["data", "nextCursor"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge tag list response",
|
||
"description": "The full tag vocabulary of one knowledge base."
|
||
},
|
||
"V2KnowledgeTaggedDocument": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "Unique document identifier.",
|
||
"examples": ["b2d4f8a0-1c3e-4a5b-9d7c-2e6f0a8b4c12"]
|
||
},
|
||
"knowledgeBaseId": {
|
||
"type": "string",
|
||
"description": "Knowledge base to which the document belongs.",
|
||
"examples": ["7c9e6679-7425-40de-944b-e07fc1f90ae7"]
|
||
},
|
||
"filename": {
|
||
"type": "string",
|
||
"description": "Original filename of the uploaded document.",
|
||
"examples": ["getting-started.pdf"]
|
||
},
|
||
"fileSize": {
|
||
"type": "number",
|
||
"description": "File size in bytes.",
|
||
"examples": [248913]
|
||
},
|
||
"mimeType": {
|
||
"type": "string",
|
||
"description": "MIME type of the document file.",
|
||
"examples": ["application/pdf"]
|
||
},
|
||
"processingStatus": {
|
||
"type": "string",
|
||
"enum": ["pending", "processing", "completed", "failed"],
|
||
"description": "Current document processing state.",
|
||
"examples": ["completed"]
|
||
},
|
||
"chunkCount": {
|
||
"type": "number",
|
||
"description": "Number of indexed chunks; zero until processing completes.",
|
||
"examples": [24]
|
||
},
|
||
"tokenCount": {
|
||
"type": "number",
|
||
"description": "Total tokens extracted from the document.",
|
||
"examples": [8123]
|
||
},
|
||
"characterCount": {
|
||
"type": "number",
|
||
"description": "Total characters extracted from the document.",
|
||
"examples": [41205]
|
||
},
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "Whether the document is enabled for search.",
|
||
"examples": [true]
|
||
},
|
||
"createdAt": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "ISO 8601 timestamp when the document was uploaded, or null.",
|
||
"format": "date-time",
|
||
"examples": ["2025-06-18T16:45:00Z"]
|
||
},
|
||
"tags": {
|
||
"type": "object",
|
||
"propertyNames": {
|
||
"type": "string"
|
||
},
|
||
"additionalProperties": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "number"
|
||
},
|
||
{
|
||
"type": "boolean"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Tag value; dates are ISO 8601 strings and an unset tag is null."
|
||
},
|
||
"description": "Document tag values keyed by tag display name. Writes address the same tags by slot (`tag1`..`tag7`); resolve names to slots with GET /api/v2/knowledge/{knowledgeBaseId}/tags.",
|
||
"examples": [
|
||
{
|
||
"category": "billing",
|
||
"priority": 2
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"required": [
|
||
"id",
|
||
"knowledgeBaseId",
|
||
"filename",
|
||
"fileSize",
|
||
"mimeType",
|
||
"processingStatus",
|
||
"chunkCount",
|
||
"tokenCount",
|
||
"characterCount",
|
||
"enabled",
|
||
"createdAt",
|
||
"tags"
|
||
],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge document list item",
|
||
"description": "Document summary with the document tag values keyed by display name."
|
||
},
|
||
"V2KnowledgeDocumentListResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/V2KnowledgeTaggedDocument"
|
||
},
|
||
"description": "Items in the current page."
|
||
},
|
||
"nextCursor": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Opaque cursor for the next page. Send it back as `cursor`; `null` means there is nothing further to fetch. Never construct one yourself."
|
||
}
|
||
},
|
||
"required": ["data", "nextCursor"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge document list response",
|
||
"description": "A cursor-paginated page of knowledge documents."
|
||
},
|
||
"V2BulkKnowledgeDocumentsData": {
|
||
"type": "object",
|
||
"properties": {
|
||
"operation": {
|
||
"type": "string",
|
||
"enum": ["enable", "disable"],
|
||
"description": "Operation that was applied."
|
||
},
|
||
"updatedCount": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Number of documents the operation changed.",
|
||
"examples": [42]
|
||
},
|
||
"documentIds": {
|
||
"description": "Identifiers of the documents the operation changed. Present only for an explicit `documentIds` request, which is bounded to 100 documents; a `selectAll` request omits it because the selection is unbounded, and reports `updatedCount` instead.",
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"required": ["operation", "updatedCount"],
|
||
"additionalProperties": false,
|
||
"title": "Bulk knowledge document update data",
|
||
"description": "Outcome of a bulk enable or disable across knowledge documents."
|
||
},
|
||
"V2BulkKnowledgeDocumentsResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2BulkKnowledgeDocumentsData"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Bulk knowledge document response",
|
||
"description": "Outcome of a bulk enable or disable."
|
||
},
|
||
"BulkUpdateKnowledgeDocumentsRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
},
|
||
"operation": {
|
||
"type": "string",
|
||
"enum": ["enable", "disable"],
|
||
"description": "Whether the selected documents become enabled or disabled for search."
|
||
},
|
||
"documentIds": {
|
||
"description": "Documents to update, by identifier.",
|
||
"minItems": 1,
|
||
"maxItems": 100,
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string",
|
||
"minLength": 1
|
||
}
|
||
},
|
||
"selectAll": {
|
||
"description": "Update every document in the knowledge base instead of an explicit list, narrowed by `enabledFilter`.",
|
||
"type": "boolean",
|
||
"const": true
|
||
},
|
||
"enabledFilter": {
|
||
"description": "With `selectAll`, restrict the update to documents in this state.",
|
||
"type": "string",
|
||
"enum": ["all", "enabled", "disabled"]
|
||
}
|
||
},
|
||
"required": ["workspaceId", "operation"],
|
||
"additionalProperties": false,
|
||
"title": "Bulk knowledge document request",
|
||
"description": "Operation and the documents it applies to.",
|
||
"examples": [
|
||
{
|
||
"workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64",
|
||
"operation": "disable",
|
||
"documentIds": ["b2d4f8a0-1c3e-4a5b-9d7c-2e6f0a8b4c12"]
|
||
}
|
||
]
|
||
},
|
||
"V2KnowledgeDocumentSummary": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "Unique document identifier.",
|
||
"examples": ["b2d4f8a0-1c3e-4a5b-9d7c-2e6f0a8b4c12"]
|
||
},
|
||
"knowledgeBaseId": {
|
||
"type": "string",
|
||
"description": "Knowledge base to which the document belongs.",
|
||
"examples": ["7c9e6679-7425-40de-944b-e07fc1f90ae7"]
|
||
},
|
||
"filename": {
|
||
"type": "string",
|
||
"description": "Original filename of the uploaded document.",
|
||
"examples": ["getting-started.pdf"]
|
||
},
|
||
"fileSize": {
|
||
"type": "number",
|
||
"description": "File size in bytes.",
|
||
"examples": [248913]
|
||
},
|
||
"mimeType": {
|
||
"type": "string",
|
||
"description": "MIME type of the document file.",
|
||
"examples": ["application/pdf"]
|
||
},
|
||
"processingStatus": {
|
||
"type": "string",
|
||
"enum": ["pending", "processing", "completed", "failed"],
|
||
"description": "Current document processing state.",
|
||
"examples": ["completed"]
|
||
},
|
||
"chunkCount": {
|
||
"type": "number",
|
||
"description": "Number of indexed chunks; zero until processing completes.",
|
||
"examples": [24]
|
||
},
|
||
"tokenCount": {
|
||
"type": "number",
|
||
"description": "Total tokens extracted from the document.",
|
||
"examples": [8123]
|
||
},
|
||
"characterCount": {
|
||
"type": "number",
|
||
"description": "Total characters extracted from the document.",
|
||
"examples": [41205]
|
||
},
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "Whether the document is enabled for search.",
|
||
"examples": [true]
|
||
},
|
||
"createdAt": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "ISO 8601 timestamp when the document was uploaded, or null.",
|
||
"format": "date-time",
|
||
"examples": ["2025-06-18T16:45:00Z"]
|
||
}
|
||
},
|
||
"required": [
|
||
"id",
|
||
"knowledgeBaseId",
|
||
"filename",
|
||
"fileSize",
|
||
"mimeType",
|
||
"processingStatus",
|
||
"chunkCount",
|
||
"tokenCount",
|
||
"characterCount",
|
||
"enabled",
|
||
"createdAt"
|
||
],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge document summary",
|
||
"description": "Summary returned by document lists and upload acknowledgements."
|
||
},
|
||
"V2KnowledgeDocumentSummaryResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2KnowledgeDocumentSummary"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge document summary response",
|
||
"description": "An accepted knowledge document summary."
|
||
},
|
||
"UploadKnowledgeDocumentForm": {
|
||
"type": "object",
|
||
"properties": {
|
||
"file": {
|
||
"type": "string",
|
||
"format": "binary",
|
||
"contentEncoding": "binary",
|
||
"maxLength": 104857600,
|
||
"description": "Document file to upload; the maximum size is 100 MB."
|
||
}
|
||
},
|
||
"required": ["file"],
|
||
"additionalProperties": {
|
||
"description": "Additional multipart form fields are ignored."
|
||
},
|
||
"title": "Upload knowledge document form",
|
||
"description": "Multipart form containing the document file."
|
||
},
|
||
"V2KnowledgeDocumentUpload": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "Upload session identifier."
|
||
},
|
||
"knowledgeBaseId": {
|
||
"type": "string",
|
||
"description": "Knowledge base that will own the document."
|
||
},
|
||
"status": {
|
||
"type": "string",
|
||
"enum": [
|
||
"uploading",
|
||
"completing",
|
||
"finalizing",
|
||
"completed",
|
||
"failed",
|
||
"aborting",
|
||
"aborted",
|
||
"expired"
|
||
],
|
||
"description": "Current upload-session state."
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "Filename recorded on the knowledge document."
|
||
},
|
||
"contentType": {
|
||
"type": "string",
|
||
"description": "MIME type declared for the document."
|
||
},
|
||
"size": {
|
||
"type": "integer",
|
||
"exclusiveMinimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Exact file size in bytes."
|
||
},
|
||
"expiresAt": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
|
||
"description": "ISO 8601 upload-session expiration time."
|
||
},
|
||
"error": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Terminal upload error, or null when none occurred."
|
||
},
|
||
"document": {
|
||
"anyOf": [
|
||
{
|
||
"$ref": "#/components/schemas/V2KnowledgeDocumentSummary"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Queued document after completion, or null before completion."
|
||
}
|
||
},
|
||
"required": [
|
||
"id",
|
||
"knowledgeBaseId",
|
||
"status",
|
||
"name",
|
||
"contentType",
|
||
"size",
|
||
"expiresAt",
|
||
"error",
|
||
"document"
|
||
],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge document upload",
|
||
"description": "State of a resumable knowledge-document upload session."
|
||
},
|
||
"V2KnowledgeUploadTransfer": {
|
||
"oneOf": [
|
||
{
|
||
"$ref": "#/components/schemas/V2PutUploadTransfer"
|
||
},
|
||
{
|
||
"$ref": "#/components/schemas/V2MultipartUploadTransfer"
|
||
}
|
||
],
|
||
"description": "Provider transfer strategy for a knowledge document upload.",
|
||
"title": "Knowledge upload transfer"
|
||
},
|
||
"V2PutUploadTransfer": {
|
||
"type": "object",
|
||
"properties": {
|
||
"method": {
|
||
"type": "string",
|
||
"const": "put",
|
||
"description": "Upload strategy discriminator."
|
||
},
|
||
"url": {
|
||
"type": "string",
|
||
"format": "uri",
|
||
"description": "Signed URL to which the file bytes are uploaded. Send the bytes with `PUT` to this URL, including exactly the headers in `headers` and nothing that alters the body. The URL is signed and self-describing — construct it from this field only, never by hand.\n\n**Where this URL points depends on the deployment, and so does what answers you.** When Sim stores objects itself the URL is Sim's own data plane: success is `204` with an empty body, and a failure is the same `{ \"error\": { \"code\", \"message\" } }` envelope as every other v2 response — `400` when the body does not match the size or content type the session was created for, `403` when the token is invalid, expired, or belongs to another session, and `409` when the session is no longer accepting bytes. When object storage is configured — S3, Google Cloud Storage, or Azure Blob — the URL is that provider's own presigned URL, and the provider answers directly: treat **any `2xx` as success** (S3 and GCS answer `200`, Azure `201`), and on failure expect the provider's error document, typically XML, not the v2 envelope. Do not branch on `204` and do not parse a failure as JSON."
|
||
},
|
||
"headers": {
|
||
"type": "object",
|
||
"propertyNames": {
|
||
"type": "string"
|
||
},
|
||
"additionalProperties": {
|
||
"type": "string"
|
||
},
|
||
"description": "Headers that must be included with the upload request."
|
||
},
|
||
"expiresAt": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
|
||
"description": "ISO 8601 expiration time for this signed URL. This is the URL's own expiry and is normally earlier than the upload session's expiresAt: the session stays open for later part, status, completion, and abort requests, but the bytes must be uploaded before this time. Once it passes, the storage provider rejects the upload and a new upload session must be created."
|
||
}
|
||
},
|
||
"required": ["method", "url", "headers", "expiresAt"],
|
||
"additionalProperties": false,
|
||
"title": "Direct upload transfer",
|
||
"description": "Instructions for uploading bytes to one signed URL."
|
||
},
|
||
"V2MultipartUploadTransfer": {
|
||
"type": "object",
|
||
"properties": {
|
||
"method": {
|
||
"type": "string",
|
||
"const": "multipart",
|
||
"description": "Upload strategy discriminator."
|
||
},
|
||
"partSize": {
|
||
"type": "integer",
|
||
"exclusiveMinimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Required size of each non-final part in bytes."
|
||
},
|
||
"partCount": {
|
||
"type": "integer",
|
||
"exclusiveMinimum": 0,
|
||
"maximum": 640,
|
||
"description": "Total number of upload parts."
|
||
}
|
||
},
|
||
"required": ["method", "partSize", "partCount"],
|
||
"additionalProperties": false,
|
||
"title": "Multipart upload transfer",
|
||
"description": "Instructions for splitting bytes into a multipart upload."
|
||
},
|
||
"V2CreateKnowledgeDocumentUploadData": {
|
||
"type": "object",
|
||
"properties": {
|
||
"session": {
|
||
"$ref": "#/components/schemas/V2KnowledgeDocumentUpload"
|
||
},
|
||
"uploadToken": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"description": "Signed control token required by subsequent upload-session requests."
|
||
},
|
||
"transfer": {
|
||
"$ref": "#/components/schemas/V2KnowledgeUploadTransfer"
|
||
}
|
||
},
|
||
"required": ["session", "uploadToken", "transfer"],
|
||
"additionalProperties": false,
|
||
"title": "Create knowledge document upload data",
|
||
"description": "Upload session, signed control token, and transfer instructions."
|
||
},
|
||
"V2CreateKnowledgeDocumentUploadResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2CreateKnowledgeDocumentUploadData"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Create knowledge document upload response",
|
||
"description": "Upload session, signed control token, and transfer instructions."
|
||
},
|
||
"CreateKnowledgeDocumentUploadRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 255,
|
||
"description": "Filename recorded on the knowledge document.",
|
||
"examples": ["getting-started.pdf"]
|
||
},
|
||
"contentType": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 255,
|
||
"description": "Supported MIME type for the document.",
|
||
"examples": ["application/pdf"]
|
||
},
|
||
"size": {
|
||
"type": "integer",
|
||
"minimum": 1,
|
||
"maximum": 104857600,
|
||
"description": "Exact file size in bytes.",
|
||
"examples": [248913]
|
||
},
|
||
"tag1": {
|
||
"description": "Value for tag slot 1.",
|
||
"type": "string",
|
||
"maxLength": 1000
|
||
},
|
||
"tag2": {
|
||
"description": "Value for tag slot 2.",
|
||
"type": "string",
|
||
"maxLength": 1000
|
||
},
|
||
"tag3": {
|
||
"description": "Value for tag slot 3.",
|
||
"type": "string",
|
||
"maxLength": 1000
|
||
},
|
||
"tag4": {
|
||
"description": "Value for tag slot 4.",
|
||
"type": "string",
|
||
"maxLength": 1000
|
||
},
|
||
"tag5": {
|
||
"description": "Value for tag slot 5.",
|
||
"type": "string",
|
||
"maxLength": 1000
|
||
},
|
||
"tag6": {
|
||
"description": "Value for tag slot 6.",
|
||
"type": "string",
|
||
"maxLength": 1000
|
||
},
|
||
"tag7": {
|
||
"description": "Value for tag slot 7.",
|
||
"type": "string",
|
||
"maxLength": 1000
|
||
},
|
||
"processingOptions": {
|
||
"description": "Optional processing recipe and language.",
|
||
"type": "object",
|
||
"properties": {
|
||
"recipe": {
|
||
"description": "Optional document processing recipe.",
|
||
"type": "string",
|
||
"maxLength": 255
|
||
},
|
||
"lang": {
|
||
"description": "Optional document language code.",
|
||
"type": "string",
|
||
"maxLength": 35
|
||
}
|
||
},
|
||
"additionalProperties": false
|
||
}
|
||
},
|
||
"required": ["workspaceId", "name", "contentType", "size"],
|
||
"additionalProperties": false,
|
||
"title": "Create knowledge document upload request",
|
||
"description": "Document metadata used to authorize and initialize the upload.",
|
||
"examples": [
|
||
{
|
||
"workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64",
|
||
"name": "getting-started.pdf",
|
||
"contentType": "application/pdf",
|
||
"size": 248913
|
||
}
|
||
]
|
||
},
|
||
"V2KnowledgeDocumentUploadResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2KnowledgeDocumentUpload"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge document upload response",
|
||
"description": "Current state of a knowledge document upload session."
|
||
},
|
||
"V2UploadPartUrl": {
|
||
"type": "object",
|
||
"properties": {
|
||
"partNumber": {
|
||
"type": "integer",
|
||
"minimum": 1,
|
||
"maximum": 9007199254740991,
|
||
"description": "Multipart part number."
|
||
},
|
||
"url": {
|
||
"type": "string",
|
||
"format": "uri",
|
||
"description": "Signed URL for this upload part. Send the bytes with `PUT` to this URL, including exactly the headers in `headers` and nothing that alters the body. The URL is signed and self-describing — construct it from this field only, never by hand.\n\n**Where this URL points depends on the deployment, and so does what answers you.** When Sim stores objects itself the URL is Sim's own data plane: success is `204` with an empty body, and a failure is the same `{ \"error\": { \"code\", \"message\" } }` envelope as every other v2 response — `400` when the body does not match the size or content type the session was created for, `403` when the token is invalid, expired, or belongs to another session, and `409` when the session is no longer accepting bytes. When object storage is configured — S3, Google Cloud Storage, or Azure Blob — the URL is that provider's own presigned URL, and the provider answers directly: treat **any `2xx` as success** (S3 and GCS answer `200`, Azure `201`), and on failure expect the provider's error document, typically XML, not the v2 envelope. Do not branch on `204` and do not parse a failure as JSON.\n\nYou do not need to retain the `ETag` each part upload returns. Unlike a raw S3 multipart flow, completion takes no request body: Sim lists the uploaded parts from the provider itself and reads their entity tags there, so `POST .../complete` only has to happen after every part has been sent."
|
||
},
|
||
"headers": {
|
||
"type": "object",
|
||
"propertyNames": {
|
||
"type": "string"
|
||
},
|
||
"additionalProperties": {
|
||
"type": "string"
|
||
},
|
||
"description": "Headers that must be included with the part upload."
|
||
},
|
||
"expiresAt": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
|
||
"description": "ISO 8601 expiration time for the signed URL."
|
||
}
|
||
},
|
||
"required": ["partNumber", "url", "headers", "expiresAt"],
|
||
"additionalProperties": false,
|
||
"title": "Upload part URL",
|
||
"description": "A signed URL and required headers for one multipart upload part."
|
||
},
|
||
"V2PartUrlsData": {
|
||
"type": "object",
|
||
"properties": {
|
||
"parts": {
|
||
"maxItems": 100,
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/V2UploadPartUrl"
|
||
},
|
||
"description": "Signed URLs for requested parts."
|
||
}
|
||
},
|
||
"required": ["parts"],
|
||
"additionalProperties": false,
|
||
"title": "Upload part URLs",
|
||
"description": "Signed transfer URLs for the requested multipart upload parts."
|
||
},
|
||
"V2KnowledgeDocumentUploadPartUrlsResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2PartUrlsData"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge document upload part URLs response",
|
||
"description": "Signed provider URLs for requested multipart parts."
|
||
},
|
||
"CreateKnowledgeDocumentUploadPartUrlsRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"partNumbers": {
|
||
"minItems": 1,
|
||
"maxItems": 100,
|
||
"type": "array",
|
||
"items": {
|
||
"type": "integer",
|
||
"minimum": 1,
|
||
"maximum": 9007199254740991
|
||
},
|
||
"description": "Multipart part numbers for which signed URLs should be created."
|
||
}
|
||
},
|
||
"required": ["partNumbers"],
|
||
"additionalProperties": false,
|
||
"title": "Create upload part URLs request",
|
||
"description": "Multipart part numbers for which signed URLs should be created.",
|
||
"examples": [
|
||
{
|
||
"partNumbers": [1, 2, 3]
|
||
}
|
||
]
|
||
},
|
||
"V2KnowledgeDocument": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "Unique document identifier.",
|
||
"examples": ["b2d4f8a0-1c3e-4a5b-9d7c-2e6f0a8b4c12"]
|
||
},
|
||
"knowledgeBaseId": {
|
||
"type": "string",
|
||
"description": "Knowledge base to which the document belongs.",
|
||
"examples": ["7c9e6679-7425-40de-944b-e07fc1f90ae7"]
|
||
},
|
||
"filename": {
|
||
"type": "string",
|
||
"description": "Original filename of the uploaded document.",
|
||
"examples": ["getting-started.pdf"]
|
||
},
|
||
"fileSize": {
|
||
"type": "number",
|
||
"description": "File size in bytes.",
|
||
"examples": [248913]
|
||
},
|
||
"mimeType": {
|
||
"type": "string",
|
||
"description": "MIME type of the document file.",
|
||
"examples": ["application/pdf"]
|
||
},
|
||
"processingStatus": {
|
||
"type": "string",
|
||
"enum": ["pending", "processing", "completed", "failed"],
|
||
"description": "Current document processing state.",
|
||
"examples": ["completed"]
|
||
},
|
||
"chunkCount": {
|
||
"type": "number",
|
||
"description": "Number of indexed chunks; zero until processing completes.",
|
||
"examples": [24]
|
||
},
|
||
"tokenCount": {
|
||
"type": "number",
|
||
"description": "Total tokens extracted from the document.",
|
||
"examples": [8123]
|
||
},
|
||
"characterCount": {
|
||
"type": "number",
|
||
"description": "Total characters extracted from the document.",
|
||
"examples": [41205]
|
||
},
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "Whether the document is enabled for search.",
|
||
"examples": [true]
|
||
},
|
||
"createdAt": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "ISO 8601 timestamp when the document was uploaded, or null.",
|
||
"format": "date-time",
|
||
"examples": ["2025-06-18T16:45:00Z"]
|
||
},
|
||
"tags": {
|
||
"type": "object",
|
||
"propertyNames": {
|
||
"type": "string"
|
||
},
|
||
"additionalProperties": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "number"
|
||
},
|
||
{
|
||
"type": "boolean"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Tag value; dates are ISO 8601 strings and an unset tag is null."
|
||
},
|
||
"description": "Document tag values keyed by tag display name. Writes address the same tags by slot (`tag1`..`tag7`); resolve names to slots with GET /api/v2/knowledge/{knowledgeBaseId}/tags.",
|
||
"examples": [
|
||
{
|
||
"category": "billing",
|
||
"priority": 2
|
||
}
|
||
]
|
||
},
|
||
"processingError": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Processing error message, or null when processing has not failed."
|
||
},
|
||
"processingStartedAt": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "ISO 8601 timestamp when processing started, or null.",
|
||
"format": "date-time",
|
||
"examples": ["2025-06-18T16:45:05Z"]
|
||
},
|
||
"processingCompletedAt": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "ISO 8601 timestamp when processing completed, or null.",
|
||
"format": "date-time",
|
||
"examples": ["2025-06-18T16:45:42Z"]
|
||
},
|
||
"connectorId": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Connector identifier for a synced document, or null for a direct upload."
|
||
},
|
||
"connectorType": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Connector type for a synced document, or null for a direct upload."
|
||
},
|
||
"sourceUrl": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Original source URL for a synced document, or null for a direct upload."
|
||
}
|
||
},
|
||
"required": [
|
||
"id",
|
||
"knowledgeBaseId",
|
||
"filename",
|
||
"fileSize",
|
||
"mimeType",
|
||
"processingStatus",
|
||
"chunkCount",
|
||
"tokenCount",
|
||
"characterCount",
|
||
"enabled",
|
||
"createdAt",
|
||
"tags",
|
||
"processingError",
|
||
"processingStartedAt",
|
||
"processingCompletedAt",
|
||
"connectorId",
|
||
"connectorType",
|
||
"sourceUrl"
|
||
],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge document",
|
||
"description": "Full document detail including processing state and connector provenance."
|
||
},
|
||
"V2KnowledgeDocumentResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2KnowledgeDocument"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge document response",
|
||
"description": "Full knowledge document detail."
|
||
},
|
||
"V2KnowledgeDocumentProcessing": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "Identifier of the requeued document."
|
||
},
|
||
"queued": {
|
||
"type": "boolean",
|
||
"const": true,
|
||
"description": "Confirms that processing was requeued."
|
||
},
|
||
"processingStatus": {
|
||
"type": "string",
|
||
"description": "Processing state the document was moved to.",
|
||
"examples": ["pending"]
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"description": "Human-readable outcome of the requeue."
|
||
}
|
||
},
|
||
"required": ["id", "queued", "processingStatus", "message"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge document processing acknowledgement",
|
||
"description": "Acknowledgement returned when a document is requeued for processing."
|
||
},
|
||
"V2UpdateKnowledgeDocumentResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"anyOf": [
|
||
{
|
||
"$ref": "#/components/schemas/V2KnowledgeTaggedDocument"
|
||
},
|
||
{
|
||
"$ref": "#/components/schemas/V2KnowledgeDocumentProcessing"
|
||
}
|
||
],
|
||
"description": "Response data."
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Update knowledge document response",
|
||
"description": "The updated document, or the processing requeue acknowledgement."
|
||
},
|
||
"UpdateKnowledgeDocumentRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
},
|
||
"filename": {
|
||
"description": "New filename for the document.",
|
||
"examples": ["getting-started-v2.pdf"],
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 255
|
||
},
|
||
"enabled": {
|
||
"description": "Whether the document participates in search. Disabling keeps it indexed.",
|
||
"type": "boolean"
|
||
},
|
||
"tag1": {
|
||
"description": "New value for tag slot 1.",
|
||
"type": "string",
|
||
"maxLength": 1000
|
||
},
|
||
"tag2": {
|
||
"description": "New value for tag slot 2.",
|
||
"type": "string",
|
||
"maxLength": 1000
|
||
},
|
||
"tag3": {
|
||
"description": "New value for tag slot 3.",
|
||
"type": "string",
|
||
"maxLength": 1000
|
||
},
|
||
"tag4": {
|
||
"description": "New value for tag slot 4.",
|
||
"type": "string",
|
||
"maxLength": 1000
|
||
},
|
||
"tag5": {
|
||
"description": "New value for tag slot 5.",
|
||
"type": "string",
|
||
"maxLength": 1000
|
||
},
|
||
"tag6": {
|
||
"description": "New value for tag slot 6.",
|
||
"type": "string",
|
||
"maxLength": 1000
|
||
},
|
||
"tag7": {
|
||
"description": "New value for tag slot 7.",
|
||
"type": "string",
|
||
"maxLength": 1000
|
||
},
|
||
"number1": {
|
||
"description": "New value for number tag slot 1.",
|
||
"type": "number"
|
||
},
|
||
"number2": {
|
||
"description": "New value for number tag slot 2.",
|
||
"type": "number"
|
||
},
|
||
"number3": {
|
||
"description": "New value for number tag slot 3.",
|
||
"type": "number"
|
||
},
|
||
"number4": {
|
||
"description": "New value for number tag slot 4.",
|
||
"type": "number"
|
||
},
|
||
"number5": {
|
||
"description": "New value for number tag slot 5.",
|
||
"type": "number"
|
||
},
|
||
"date1": {
|
||
"description": "New value for date tag slot 1, formatted YYYY-MM-DD.",
|
||
"type": "string",
|
||
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
|
||
},
|
||
"date2": {
|
||
"description": "New value for date tag slot 2, formatted YYYY-MM-DD.",
|
||
"type": "string",
|
||
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
|
||
},
|
||
"boolean1": {
|
||
"description": "New value for boolean tag slot 1.",
|
||
"type": "boolean"
|
||
},
|
||
"boolean2": {
|
||
"description": "New value for boolean tag slot 2.",
|
||
"type": "boolean"
|
||
},
|
||
"boolean3": {
|
||
"description": "New value for boolean tag slot 3.",
|
||
"type": "boolean"
|
||
},
|
||
"retryProcessing": {
|
||
"description": "Requeue a failed or stuck document for processing. Send it alone — no other field may accompany it — and it answers with a queue acknowledgement rather than the document.",
|
||
"type": "boolean",
|
||
"const": true
|
||
}
|
||
},
|
||
"required": ["workspaceId"],
|
||
"additionalProperties": false,
|
||
"title": "Update knowledge document request",
|
||
"description": "Filename, search state, tag slot values, or a processing retry.",
|
||
"examples": [
|
||
{
|
||
"workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64",
|
||
"enabled": false,
|
||
"tag1": "billing"
|
||
}
|
||
]
|
||
},
|
||
"V2Folder": {
|
||
"type": "object",
|
||
"properties": {
|
||
"name": {
|
||
"type": "string",
|
||
"description": "Folder name."
|
||
},
|
||
"path": {
|
||
"type": "string",
|
||
"title": "Non-root folder path",
|
||
"description": "Canonical folder path used as the public folder identifier.",
|
||
"maxLength": 4096
|
||
},
|
||
"parentPath": {
|
||
"type": "string",
|
||
"title": "Folder path",
|
||
"description": "Canonical parent path; `/` is the root.",
|
||
"maxLength": 4096
|
||
},
|
||
"createdAt": {
|
||
"type": "string",
|
||
"description": "ISO 8601 timestamp when the folder was created.",
|
||
"format": "date-time"
|
||
},
|
||
"updatedAt": {
|
||
"type": "string",
|
||
"description": "ISO 8601 timestamp when the folder was last updated.",
|
||
"format": "date-time"
|
||
}
|
||
},
|
||
"required": ["name", "path", "parentPath", "createdAt", "updatedAt"],
|
||
"additionalProperties": false,
|
||
"title": "Folder",
|
||
"description": "A canonical workspace folder."
|
||
},
|
||
"V2KnowledgeFolderListResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/V2Folder"
|
||
},
|
||
"description": "Items in the current page."
|
||
},
|
||
"nextCursor": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Always `null` — this list has no `cursor` or `limit` param and returns its whole bounded set in one page. Present so the list can gain pages later without a shape change."
|
||
}
|
||
},
|
||
"required": ["data", "nextCursor"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge folder list response",
|
||
"description": "The whole bounded set of knowledge-base folders, in one page."
|
||
},
|
||
"V2KnowledgeFolderResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2Folder"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge folder response",
|
||
"description": "A single knowledge-base folder."
|
||
},
|
||
"NonRootFolderPathInput": {
|
||
"title": "Non-root folder path input",
|
||
"description": "Non-root folder path. A missing leading slash is normalized before validation. Segments are percent-encoded, so a folder shown as \"New folder\" is `/New%20folder`: everything outside `A-Z a-z 0-9 - _ . ~` is escaped as uppercase hex, and only that exact encoding is accepted. A trailing slash, an empty segment, and a literal `.` or `..` segment are rejected. At most 64 segments and 4096 encoded bytes.",
|
||
"maxLength": 4096,
|
||
"type": "string"
|
||
},
|
||
"CreateKnowledgeFolderRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace in which to create the folder."
|
||
},
|
||
"path": {
|
||
"description": "Path of the folder to create.",
|
||
"$ref": "#/components/schemas/NonRootFolderPathInput"
|
||
}
|
||
},
|
||
"required": ["workspaceId", "path"],
|
||
"additionalProperties": false,
|
||
"title": "Create knowledge folder request",
|
||
"description": "Workspace and canonical path for a new knowledge-base folder."
|
||
},
|
||
"RelocateKnowledgeFolderRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace containing the folder."
|
||
},
|
||
"path": {
|
||
"description": "Current folder path.",
|
||
"$ref": "#/components/schemas/NonRootFolderPathInput"
|
||
},
|
||
"destinationPath": {
|
||
"description": "New full path for the folder and its descendants.",
|
||
"$ref": "#/components/schemas/NonRootFolderPathInput"
|
||
}
|
||
},
|
||
"required": ["workspaceId", "path", "destinationPath"],
|
||
"additionalProperties": false,
|
||
"title": "Relocate knowledge folder request",
|
||
"description": "Current and destination canonical paths for a knowledge-base folder."
|
||
},
|
||
"V2DeleteKnowledgeFolderData": {
|
||
"type": "object",
|
||
"properties": {
|
||
"path": {
|
||
"type": "string",
|
||
"title": "Folder path",
|
||
"description": "Canonical path of the deleted folder.",
|
||
"maxLength": 4096
|
||
},
|
||
"deleted": {
|
||
"type": "boolean",
|
||
"const": true,
|
||
"description": "Confirms that the folder was deleted."
|
||
},
|
||
"deletedItems": {
|
||
"type": "object",
|
||
"properties": {
|
||
"folders": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Number of deleted folders."
|
||
},
|
||
"knowledgeBases": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Number of deleted knowledge bases."
|
||
}
|
||
},
|
||
"required": ["folders", "knowledgeBases"],
|
||
"additionalProperties": false,
|
||
"description": "Counts of deleted resources."
|
||
}
|
||
},
|
||
"required": ["path", "deleted", "deletedItems"],
|
||
"additionalProperties": false,
|
||
"title": "Delete knowledge folder data",
|
||
"description": "Folder deletion acknowledgement and deleted-resource counts."
|
||
},
|
||
"V2DeleteKnowledgeFolderResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2DeleteKnowledgeFolderData"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Delete knowledge folder response",
|
||
"description": "Folder deletion acknowledgement and deleted-resource counts."
|
||
},
|
||
"RestoreKnowledgeBaseRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
}
|
||
},
|
||
"required": ["workspaceId"],
|
||
"additionalProperties": false,
|
||
"title": "Restore knowledge base request",
|
||
"description": "Workspace scope for the knowledge base.",
|
||
"examples": [
|
||
{
|
||
"workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64"
|
||
}
|
||
]
|
||
},
|
||
"V2AddedWorkspaceFileDocument": {
|
||
"type": "object",
|
||
"properties": {
|
||
"documentId": {
|
||
"type": "string",
|
||
"description": "Identifier of the queued knowledge document."
|
||
},
|
||
"filename": {
|
||
"type": "string",
|
||
"description": "Filename recorded on the knowledge document."
|
||
},
|
||
"mimeType": {
|
||
"type": "string",
|
||
"description": "MIME type of the source workspace file."
|
||
},
|
||
"fileSize": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "File size in bytes."
|
||
}
|
||
},
|
||
"required": ["documentId", "filename", "mimeType", "fileSize"],
|
||
"additionalProperties": false,
|
||
"title": "Indexed workspace file",
|
||
"description": "A workspace file that was queued for indexing into a knowledge base."
|
||
},
|
||
"V2AddWorkspaceFilesToKnowledgeBaseData": {
|
||
"type": "object",
|
||
"properties": {
|
||
"knowledgeBaseId": {
|
||
"type": "string",
|
||
"description": "Knowledge base the files were added to."
|
||
},
|
||
"added": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/V2AddedWorkspaceFileDocument"
|
||
},
|
||
"description": "Files queued for indexing, in request order."
|
||
},
|
||
"failed": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"description": "References that could not be indexed, echoed exactly as they were sent."
|
||
}
|
||
},
|
||
"required": ["knowledgeBaseId", "added", "failed"],
|
||
"additionalProperties": false,
|
||
"title": "Add workspace files data",
|
||
"description": "Outcome of indexing workspace files into a knowledge base."
|
||
},
|
||
"V2AddWorkspaceFilesToKnowledgeBaseResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2AddWorkspaceFilesToKnowledgeBaseData"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Index workspace files response",
|
||
"description": "Documents queued for indexing and references that could not be."
|
||
},
|
||
"AddWorkspaceFilesToKnowledgeBaseRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns both the files and the base."
|
||
},
|
||
"fileReferences": {
|
||
"minItems": 1,
|
||
"maxItems": 100,
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string",
|
||
"minLength": 1
|
||
},
|
||
"description": "Workspace file identifiers or storage keys to index. Duplicates resolving to the same file are indexed once."
|
||
}
|
||
},
|
||
"required": ["workspaceId", "fileReferences"],
|
||
"additionalProperties": false,
|
||
"title": "Index workspace files request",
|
||
"description": "Workspace scope and the workspace file references to index.",
|
||
"examples": [
|
||
{
|
||
"workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64",
|
||
"fileReferences": ["handbook.pdf"]
|
||
}
|
||
]
|
||
},
|
||
"V2KnowledgeChunk": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "Unique chunk identifier.",
|
||
"examples": ["4c1f9e77-2b3a-4f8d-9e10-6a2c8d4b1e05"]
|
||
},
|
||
"chunkIndex": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Zero-based position of the chunk within its document.",
|
||
"examples": [3]
|
||
},
|
||
"content": {
|
||
"type": "string",
|
||
"description": "Text content of the chunk, exactly as it was embedded.",
|
||
"examples": ["To reset your password, open Settings and choose Security."]
|
||
},
|
||
"contentLength": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Character count of `content`.",
|
||
"examples": [58]
|
||
},
|
||
"tokenCount": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Tokens the chunk consumed when embedded.",
|
||
"examples": [14]
|
||
},
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "Whether the chunk participates in search. A disabled chunk stays indexed."
|
||
},
|
||
"startOffset": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Character offset of the chunk within the extracted document text."
|
||
},
|
||
"endOffset": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Character offset just past the end of the chunk."
|
||
},
|
||
"tag1": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Text tag value inherited from the document, or null when the slot is unset."
|
||
},
|
||
"tag2": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Text tag value inherited from the document, or null when the slot is unset."
|
||
},
|
||
"tag3": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Text tag value inherited from the document, or null when the slot is unset."
|
||
},
|
||
"tag4": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Text tag value inherited from the document, or null when the slot is unset."
|
||
},
|
||
"tag5": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Text tag value inherited from the document, or null when the slot is unset."
|
||
},
|
||
"tag6": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Text tag value inherited from the document, or null when the slot is unset."
|
||
},
|
||
"tag7": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Text tag value inherited from the document, or null when the slot is unset."
|
||
},
|
||
"createdAt": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
|
||
"description": "ISO 8601 timestamp when the chunk was created."
|
||
},
|
||
"updatedAt": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
|
||
"description": "ISO 8601 timestamp when the chunk was last modified."
|
||
}
|
||
},
|
||
"required": [
|
||
"id",
|
||
"chunkIndex",
|
||
"content",
|
||
"contentLength",
|
||
"tokenCount",
|
||
"enabled",
|
||
"startOffset",
|
||
"endOffset",
|
||
"tag1",
|
||
"tag2",
|
||
"tag3",
|
||
"tag4",
|
||
"tag5",
|
||
"tag6",
|
||
"tag7",
|
||
"createdAt",
|
||
"updatedAt"
|
||
],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge chunk",
|
||
"description": "One embedded passage of a knowledge document."
|
||
},
|
||
"V2KnowledgeChunkListResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/V2KnowledgeChunk"
|
||
},
|
||
"description": "Items in the current page."
|
||
},
|
||
"nextCursor": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Opaque cursor for the next page. Send it back as `cursor`; `null` means there is nothing further to fetch. Never construct one yourself."
|
||
}
|
||
},
|
||
"required": ["data", "nextCursor"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge chunk list response",
|
||
"description": "A cursor-paginated page of document chunks."
|
||
},
|
||
"V2KnowledgeChunkResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2KnowledgeChunk"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge chunk response",
|
||
"description": "A single document chunk."
|
||
},
|
||
"CreateKnowledgeChunkRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
},
|
||
"content": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 10000,
|
||
"description": "Text to embed. It is embedded on write, so the chunk is searchable immediately."
|
||
},
|
||
"enabled": {
|
||
"default": true,
|
||
"description": "Whether the new chunk participates in search.",
|
||
"type": "boolean"
|
||
}
|
||
},
|
||
"required": ["workspaceId", "content"],
|
||
"additionalProperties": false,
|
||
"title": "Create knowledge chunk request",
|
||
"description": "Workspace scope and the text to embed.",
|
||
"examples": [
|
||
{
|
||
"workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64",
|
||
"content": "To reset your password, open Settings and choose Security."
|
||
}
|
||
]
|
||
},
|
||
"V2BulkKnowledgeChunksData": {
|
||
"type": "object",
|
||
"properties": {
|
||
"operation": {
|
||
"type": "string",
|
||
"enum": ["enable", "disable", "delete"],
|
||
"description": "Operation that was applied."
|
||
},
|
||
"processed": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Number of chunks the operation changed.",
|
||
"examples": [12]
|
||
},
|
||
"errors": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"description": "Per-chunk failures. A populated array still answers 200."
|
||
}
|
||
},
|
||
"required": ["operation", "processed", "errors"],
|
||
"additionalProperties": false,
|
||
"title": "Bulk knowledge chunk update data",
|
||
"description": "Outcome of a bulk enable, disable, or delete across knowledge chunks."
|
||
},
|
||
"V2BulkKnowledgeChunksResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2BulkKnowledgeChunksData"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Bulk knowledge chunk response",
|
||
"description": "Counts and per-chunk failures from a bulk chunk operation."
|
||
},
|
||
"BulkUpdateKnowledgeChunksRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
},
|
||
"operation": {
|
||
"type": "string",
|
||
"enum": ["enable", "disable", "delete"],
|
||
"description": "What to do with the selected chunks."
|
||
},
|
||
"chunkIds": {
|
||
"minItems": 1,
|
||
"maxItems": 100,
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string",
|
||
"minLength": 1
|
||
},
|
||
"description": "Chunks to operate on, by identifier. Ids outside the document are ignored."
|
||
}
|
||
},
|
||
"required": ["workspaceId", "operation", "chunkIds"],
|
||
"additionalProperties": false,
|
||
"title": "Bulk knowledge chunk request",
|
||
"description": "Workspace scope, the operation to apply, and the chunks to apply it to.",
|
||
"examples": [
|
||
{
|
||
"workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64",
|
||
"operation": "disable",
|
||
"chunkIds": ["4c1f9e77-2b3a-4f8d-9e10-6a2c8d4b1e05"]
|
||
}
|
||
]
|
||
},
|
||
"UpdateKnowledgeChunkRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
},
|
||
"content": {
|
||
"description": "Replacement text. Changing it re-embeds the chunk and re-derives its token and character counts.",
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 10000
|
||
},
|
||
"enabled": {
|
||
"description": "Whether the chunk participates in search. Disabling keeps it indexed.",
|
||
"type": "boolean"
|
||
}
|
||
},
|
||
"required": ["workspaceId"],
|
||
"additionalProperties": false,
|
||
"title": "Update knowledge chunk request",
|
||
"description": "Workspace scope and the fields to update. At least one is required.",
|
||
"examples": [
|
||
{
|
||
"workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64",
|
||
"enabled": false
|
||
}
|
||
]
|
||
},
|
||
"V2KnowledgeTagResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2KnowledgeTag"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge tag response",
|
||
"description": "A single tag definition."
|
||
},
|
||
"CreateKnowledgeTagRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
},
|
||
"displayName": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 100,
|
||
"description": "Name tag filters and document reads use for this tag.",
|
||
"examples": ["category"]
|
||
},
|
||
"fieldType": {
|
||
"default": "text",
|
||
"type": "string",
|
||
"enum": ["text", "number", "date", "boolean"],
|
||
"description": "Value type stored in the slot; it decides which slots are usable and which filter operators apply. Slot capacity per type: text 7, number 5, date 2, boolean 3.",
|
||
"examples": ["text"]
|
||
},
|
||
"tagSlot": {
|
||
"description": "Slot to store the tag in. Omit to take the next free slot for the field type; a slot that does not belong to the field type, or one already in use, is rejected.",
|
||
"type": "string",
|
||
"enum": [
|
||
"tag1",
|
||
"tag2",
|
||
"tag3",
|
||
"tag4",
|
||
"tag5",
|
||
"tag6",
|
||
"tag7",
|
||
"number1",
|
||
"number2",
|
||
"number3",
|
||
"number4",
|
||
"number5",
|
||
"date1",
|
||
"date2",
|
||
"boolean1",
|
||
"boolean2",
|
||
"boolean3"
|
||
],
|
||
"examples": ["tag1"]
|
||
}
|
||
},
|
||
"required": ["workspaceId", "displayName"],
|
||
"additionalProperties": false,
|
||
"title": "Create knowledge tag request",
|
||
"description": "Workspace scope, display name, field type, and optional slot.",
|
||
"examples": [
|
||
{
|
||
"workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64",
|
||
"displayName": "category",
|
||
"fieldType": "text"
|
||
}
|
||
]
|
||
},
|
||
"UpdateKnowledgeTagRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
},
|
||
"displayName": {
|
||
"description": "New tag display name.",
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 100,
|
||
"examples": ["category"]
|
||
},
|
||
"fieldType": {
|
||
"description": "New value type for the tag.",
|
||
"type": "string",
|
||
"enum": ["text", "number", "date", "boolean"],
|
||
"examples": ["text"]
|
||
}
|
||
},
|
||
"required": ["workspaceId"],
|
||
"additionalProperties": false,
|
||
"title": "Update knowledge tag request",
|
||
"description": "Workspace scope and the fields to update. At least one is required.",
|
||
"examples": [
|
||
{
|
||
"workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64",
|
||
"displayName": "topic"
|
||
}
|
||
]
|
||
},
|
||
"V2DeleteKnowledgeTagData": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "Identifier of the deleted tag definition."
|
||
},
|
||
"tagSlot": {
|
||
"type": "string",
|
||
"description": "Slot the deleted tag occupied; its values are now cleared."
|
||
},
|
||
"displayName": {
|
||
"type": "string",
|
||
"description": "Display name the deleted tag carried."
|
||
},
|
||
"deleted": {
|
||
"type": "boolean",
|
||
"const": true,
|
||
"description": "Confirms that the tag definition was deleted."
|
||
}
|
||
},
|
||
"required": ["id", "tagSlot", "displayName", "deleted"],
|
||
"additionalProperties": false,
|
||
"title": "Delete knowledge tag data",
|
||
"description": "Acknowledgement for a deleted tag definition."
|
||
},
|
||
"V2DeleteKnowledgeTagResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2DeleteKnowledgeTagData"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Delete knowledge tag response",
|
||
"description": "Acknowledgement naming the deleted definition and the slot it freed."
|
||
},
|
||
"V2NextKnowledgeTagSlotData": {
|
||
"type": "object",
|
||
"properties": {
|
||
"nextAvailableSlot": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "The free slot a create would take, or null when the field type is exhausted.",
|
||
"examples": ["tag3"]
|
||
},
|
||
"fieldType": {
|
||
"type": "string",
|
||
"description": "Field type the slots were counted for."
|
||
},
|
||
"usedSlots": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"description": "Slots of this field type already holding a tag."
|
||
},
|
||
"totalSlots": {
|
||
"type": "integer",
|
||
"exclusiveMinimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Total slots this field type has: 7 for text, 5 for number, 2 for date, 3 for boolean."
|
||
},
|
||
"availableSlots": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Slots of this field type still free, or 0 when the field type is exhausted."
|
||
}
|
||
},
|
||
"required": ["nextAvailableSlot", "fieldType", "usedSlots", "totalSlots", "availableSlots"],
|
||
"additionalProperties": false,
|
||
"title": "Next knowledge tag slot",
|
||
"description": "Slot availability for one tag field type."
|
||
},
|
||
"V2NextKnowledgeTagSlotResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2NextKnowledgeTagSlotData"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Next knowledge tag slot response",
|
||
"description": "Slot availability for one tag field type."
|
||
},
|
||
"V2KnowledgeTagUsage": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "Tag definition identifier. Published for the same reason the vocabulary read publishes it: `PATCH` and `DELETE /knowledge/{knowledgeBaseId}/tags/{tagId}` address a definition by id, so without it a usage row cannot be acted on without a second read and a slot join.",
|
||
"examples": ["7c9e6679-7425-40de-944b-e07fc1f90ae7"]
|
||
},
|
||
"tagSlot": {
|
||
"type": "string",
|
||
"description": "Slot the tag occupies.",
|
||
"examples": ["tag1"]
|
||
},
|
||
"displayName": {
|
||
"type": "string",
|
||
"description": "Tag display name.",
|
||
"examples": ["category"]
|
||
},
|
||
"fieldType": {
|
||
"type": "string",
|
||
"description": "Value type stored in the slot.",
|
||
"examples": ["text"]
|
||
},
|
||
"documentCount": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Documents in the knowledge base carrying a value in this slot."
|
||
},
|
||
"chunkCount": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Indexed chunks carrying a value in this slot."
|
||
}
|
||
},
|
||
"required": ["id", "tagSlot", "displayName", "fieldType", "documentCount", "chunkCount"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge tag usage",
|
||
"description": "How widely one tag is populated across a knowledge base."
|
||
},
|
||
"V2KnowledgeTagUsageListResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/V2KnowledgeTagUsage"
|
||
},
|
||
"description": "Items in the current page."
|
||
},
|
||
"nextCursor": {
|
||
"anyOf": [
|
||
{
|
||
"type": "string"
|
||
},
|
||
{
|
||
"type": "null"
|
||
}
|
||
],
|
||
"description": "Always `null` — this list has no `cursor` or `limit` param and returns its whole bounded set in one page. Present so the list can gain pages later without a shape change."
|
||
}
|
||
},
|
||
"required": ["data", "nextCursor"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge tag usage response",
|
||
"description": "Usage counts for every tag defined on one knowledge base."
|
||
},
|
||
"V2BulkSaveKnowledgeTagDefinitionsData": {
|
||
"type": "object",
|
||
"properties": {
|
||
"created": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/V2KnowledgeTag"
|
||
},
|
||
"description": "Definitions that did not previously exist."
|
||
},
|
||
"updated": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/V2KnowledgeTag"
|
||
},
|
||
"description": "Definitions whose slot was already defined."
|
||
},
|
||
"errors": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"description": "Per-definition failures. A populated array still answers 200."
|
||
}
|
||
},
|
||
"required": ["created", "updated", "errors"],
|
||
"additionalProperties": false,
|
||
"title": "Bulk save knowledge tag definitions data",
|
||
"description": "Definitions created and updated by a bulk tag-definition save."
|
||
},
|
||
"V2BulkSaveKnowledgeTagDefinitionsResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2BulkSaveKnowledgeTagDefinitionsData"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Bulk save tag definitions response",
|
||
"description": "Definitions created and updated, with any per-definition failures."
|
||
},
|
||
"V2BulkSaveKnowledgeTagDefinition": {
|
||
"type": "object",
|
||
"properties": {
|
||
"tagSlot": {
|
||
"type": "string",
|
||
"enum": [
|
||
"tag1",
|
||
"tag2",
|
||
"tag3",
|
||
"tag4",
|
||
"tag5",
|
||
"tag6",
|
||
"tag7",
|
||
"number1",
|
||
"number2",
|
||
"number3",
|
||
"number4",
|
||
"number5",
|
||
"date1",
|
||
"date2",
|
||
"boolean1",
|
||
"boolean2",
|
||
"boolean3"
|
||
],
|
||
"description": "Storage slot the tag occupies. It must belong to the tag’s `fieldType`.",
|
||
"examples": ["tag1"]
|
||
},
|
||
"displayName": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 100,
|
||
"description": "Name tag filters and document reads use for this tag.",
|
||
"examples": ["category"]
|
||
},
|
||
"fieldType": {
|
||
"type": "string",
|
||
"enum": ["text", "number", "date", "boolean"],
|
||
"description": "Value type stored in the slot; it decides which slots are usable and which filter operators apply. Slot capacity per type: text 7, number 5, date 2, boolean 3.",
|
||
"examples": ["text"]
|
||
},
|
||
"originalDisplayName": {
|
||
"description": "Previous display name, when this entry renames an existing definition.",
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 100,
|
||
"examples": ["category"]
|
||
}
|
||
},
|
||
"required": ["tagSlot", "displayName", "fieldType"],
|
||
"additionalProperties": false,
|
||
"title": "Knowledge tag definition input",
|
||
"description": "One tag definition declared in a bulk save."
|
||
},
|
||
"BulkSaveKnowledgeTagDefinitionsRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"workspaceId": {
|
||
"type": "string",
|
||
"minLength": 1,
|
||
"maxLength": 128,
|
||
"description": "Workspace that owns the knowledge base."
|
||
},
|
||
"definitions": {
|
||
"minItems": 1,
|
||
"maxItems": 17,
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/V2BulkSaveKnowledgeTagDefinition"
|
||
},
|
||
"description": "Tag definitions to create or update on the knowledge base."
|
||
}
|
||
},
|
||
"required": ["workspaceId", "definitions"],
|
||
"additionalProperties": false,
|
||
"title": "Bulk save tag definitions request",
|
||
"description": "Workspace scope and the tag definitions to create or update.",
|
||
"examples": [
|
||
{
|
||
"workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64",
|
||
"definitions": [
|
||
{
|
||
"tagSlot": "tag1",
|
||
"displayName": "category",
|
||
"fieldType": "text"
|
||
}
|
||
]
|
||
}
|
||
]
|
||
},
|
||
"V2DeleteKnowledgeTagDefinitionsData": {
|
||
"type": "object",
|
||
"properties": {
|
||
"unused": {
|
||
"type": "boolean",
|
||
"description": "Whether the delete was restricted to definitions no document still uses."
|
||
},
|
||
"count": {
|
||
"type": "integer",
|
||
"minimum": 0,
|
||
"maximum": 9007199254740991,
|
||
"description": "Number of tag definitions removed."
|
||
}
|
||
},
|
||
"required": ["unused", "count"],
|
||
"additionalProperties": false,
|
||
"title": "Delete knowledge tag definitions data",
|
||
"description": "Outcome of a knowledge-base tag-definition delete."
|
||
},
|
||
"V2DeleteKnowledgeTagDefinitionsResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"description": "Response data.",
|
||
"$ref": "#/components/schemas/V2DeleteKnowledgeTagDefinitionsData"
|
||
}
|
||
},
|
||
"required": ["data"],
|
||
"additionalProperties": false,
|
||
"title": "Delete tag definitions response",
|
||
"description": "Number of tag definitions that were removed."
|
||
}
|
||
}
|
||
},
|
||
"x-generated-by": "scripts/generate-openapi.ts"
|
||
}
|