Skip to main content

Data center file commands

The kscli file group — inspect and delete source files in the data center

The data center is the storage layer for Knowledge Base files. Files enter it through doc upload or doc import-oss and are then imported into Knowledge Bases, and one file can be referenced by several Knowledge Bases. This group has 3 commands. Shared conventions for authentication, workspace ID, global flags, output formats, and confirmation prompts are covered in the CLI overview. The examples below assume the workspace ID is already set in the config file.

kscli file list

List files under a data center category.
kscli file list --category-id <id> [flags]
Parameters
ParameterTypeRequiredDescription
--category-id <id>stringYesCategory ID, exact match. Get it from category list
--name <text>stringNoExact filter by file name without its extension. For a.md, pass a
--file-id <id>arrayNoExact filter by file ID, repeatable
--next-token <token>stringNoCursor pagination token, from the previous output
--max-result <n>numberNoItems per page
Output
file-xxx  SUCCESS  intro.md  1024
next: --next-token eyJ...
quiet mode prints one file ID per line. json mode returns the full result.
--category-id must be a real category ID; the literal default is not accepted and returns an empty list. Get the real ID from kscli category list or the category field in kscli file get output.
This command uses cursor pagination — pass the --next-token <token> shown on the last output line into the next call to page forward. --name is an exact match and excludes the file extension, unlike the fuzzy matching in kb list --name. Examples
# List files under a category
kscli file list --category-id cate-xxx

# Look up report.pdf
kscli file list --category-id cate-xxx --name report

# Page forward
kscli file list --category-id cate-xxx --next-token eyJ...

kscli file get

Show details of a data center file.
kscli file get --file-id <id> [flags]
Parameters
ParameterTypeRequiredDescription
--file-id <id>stringYesData center file ID
Output
id: file-xxx
name: intro.md
type: md
size: 1024
status: SUCCESS
parser: AUTO_SELECT
category: cate-xxx
uploaded: 2026-01-01T00:00:00Z
tags: project-a, draft
Both quiet and json modes return the full JSON result. The category field in the output can be used as the --category-id input for file list. Examples
kscli file get --file-id file-xxx

kscli file delete

Permanently delete a file from the data center.
kscli file delete --file-id <id> [flags]
Parameters
ParameterTypeRequiredDescription
--file-id <id>stringYesData center file ID
--yesswitchNoSkip the confirmation prompt
Output
deleted: file-xxx
quiet mode prints nothing. json mode returns the full result.
Deletion cannot be undone and affects every Knowledge Base referencing the file — the corresponding document indexes become invalid. Confirm which Knowledge Bases reference the file before running this.
How it differs from doc delete:
CommandScopeSource file
kscli doc deleteRemoves a document from one Knowledge Base indexKept
kscli file deleteDeletes the data center source fileDeleted, affecting every Knowledge Base referencing it
Examples
# Delete with an interactive confirmation
kscli file delete --file-id file-xxx

# Skip confirmation
kscli file delete --file-id file-xxx --yes