Skip to main content

Data center collections

The kscli collection and category groups — manage data center containers and category hierarchies

A collection is the top-level container in the data center. Categories organize files inside a collection and support multi-level nesting. This group has 5 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 collection create

Create a file data collection.
kscli collection create --name <text> --description <text> [flags]
Parameters
ParameterTypeRequiredDescription
--name <text>stringYesCollection name, 1–20 chars
--description <text>stringYesCollection description
--store-type <type>stringNoStorage type, platform (managed, default) or custom (your own OSS bucket)
--oss-region <id>stringNoOSS region ID, required with --store-type custom
--oss-bucket <name>stringNoOSS bucket name, required with --store-type custom
Output
created: coll-xxx  (my-collection, PLATFORM)
quiet mode prints the collection ID. json mode returns the full result.
The platform does not support deleting data collections, and the CLI has no such command. Confirm the name and purpose before creating one. To isolate data, create a new collection and migrate the files.
Using your own OSS bucket --store-type custom requires the bucket to be authorized for the platform. Beyond the RAM role authorization, the bucket must also carry the tag bailian-connector-access=ReadAndWrite. Without that tag, creation fails and the error message may point at CORS configuration even though the real cause is the missing tag. Examples
# Platform-managed storage
kscli collection create --name my-collection --description "team docs"

# Your own OSS bucket
kscli collection create --name oss-coll --description "own bucket" \
  --store-type custom --oss-region cn-beijing --oss-bucket my-bucket

kscli collection get

Show data collection details.
kscli collection get (--collection-id <id> | --name <text>) [flags]
Parameters
ParameterTypeRequiredDescription
--collection-id <id>stringOne of twoCollection ID; mutually exclusive with --name
--name <text>stringOne of twoCollection name; mutually exclusive with --collection-id
The two are mutually exclusive; exactly one is required. Output
id: coll-xxx
name: my-collection
description: team docs
quiet mode prints the collection ID. json mode returns the full result. Storage settings (storage type, OSS region and bucket) are specified only at creation time and are not returned by queries. Examples
# By ID
kscli collection get --collection-id coll-xxx

# By name
kscli collection get --name my-collection

kscli category list

List data center categories.
kscli category list [flags]
Parameters
ParameterTypeRequiredDescription
--collection-id <id>stringNoFilter by exact collection ID
--parent-id <id>stringNoList sub-categories of this category
--name <text>stringNoExact filter by category name
--next-token <token>stringNoCursor pagination token, from the previous output
--max-result <n>numberNoItems per page, default 20
Output
cate-xxx  product-docs
cate-yyy  system-docs  [default]
next: --next-token eyJ...
The category marked [default] is where files land when no category is specified. quiet mode prints one category ID per line. json mode returns the full result. 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, unlike the fuzzy matching in kb list --name. Examples
# List all categories
kscli category list

# Exact lookup by name
kscli category list --name my-category

# List sub-categories
kscli category list --parent-id cate-xxx

# Page forward
kscli category list --next-token eyJ...

kscli category add

Create a data center category.
kscli category add --name <text> [flags]
Parameters
ParameterTypeRequiredDescription
--name <text>stringYesCategory name, 1–20 chars
--parent-id <id>stringNoCreate as a sub-category of this category
--collection-id <id>stringNoCreate under this collection, defaults to the platform collection
Output
created: cate-xxx  (product-docs)
quiet mode prints the category ID. json mode returns the full result. The new category ID can be used as the input for doc upload --category-id, kb create --category-id, or file list --category-id. Examples
# Create a category
kscli category add --name product-docs

# Create a sub-category
kscli category add --name sub --parent-id cate-xxx

kscli category delete

Delete a data center category.
kscli category delete --category-id <id> [flags]
Parameters
ParameterTypeRequiredDescription
--category-id <id>stringYesCategory ID
--yesswitchNoSkip the confirmation prompt
Output
deleted: cate-xxx
quiet mode prints nothing. json mode returns the full result. Whether a category containing files or sub-categories can be deleted is decided by the server, and its error message is shown verbatim. Confirm the category is empty with kscli file list --category-id first. Examples
# Delete with an interactive confirmation
kscli category delete --category-id cate-xxx

# Skip confirmation
kscli category delete --category-id cate-xxx --yes