Skip to main content

Quickstart

Build your first Knowledge Base in three steps, then try Q&A and retrieve content through the API.

Follow these steps to create a Knowledge Base from scratch, upload documents, and try retrieval and Q&A.

Prerequisites

The first time you sign in to the console, the Knowledge Base service is activated automatically and you get a 720-hour free trial.

Steps

1

Create a Knowledge Base and upload documents

In the console, go to Data Ingestion → Knowledge Management, click Create, and select the Standard edition.
  1. Enter a name and description. Select Document Search as the Knowledge Base type and Basic Document Q&A as the use case, then click Next.
  2. Choose Upload Files as the data source, and drag & drop or click to upload your prepared PDF / Word / Markdown file.
  3. Keep the indexing settings at their defaults and click Complete.
The platform parses the document, splits it into Chunks, embeds them, and builds the Index. Wait until the Knowledge Base status is Ready before retrieving.
2

Try it in the Playground

Click Playground in the left navigation, select your new Knowledge Base, switch to Knowledge Q&A at the top, and enter your prepared question.The platform first retrieves relevant Chunks, then asks the LLM to generate an answer with citations. Switch between models (e.g., qwen3.6-plus / qwen3.7-plus) to compare output. Check the answer and citations against the source document.
3

Call the API from your app

Follow API endpoint to obtain the actual workspace ID (e.g., llm-xxxxxxxxxxxx) from Workspace Management in the console. Replace {workspaceId} in the URL below. The API key and Knowledge Base must belong to this workspace, and the Knowledge Base must be Ready.Configure your API key as an environment variable after replacing the placeholder:
export DASHSCOPE_API_KEY="sk-xxxxxxxxxxxxxxxx"
Copy the index_id from the Knowledge Management page. Replace your-knowledge-base-id with that ID and your question with your prepared question, then make a retrieval call:
curl -X POST https://{workspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/indices/rag/index/retrieve \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "index_id": "your-knowledge-base-id",
    "query": "your question",
    "top_k": 5
  }'
The nodes array in the response contains the matched Chunks, sorted by relevance score in descending order. Check the Chunks against your question and source document. API retrieval returns relevant content, not a model-generated answer; view the answer with citations in the console Q&A in step 2.
You can also retrieve with the Bailian CLI: bl knowledge search --agent-id <retrieval-service-id> --query "your query". First create a service on the Knowledge Retrieval page, bind your Knowledge Base, and publish it. --agent-id takes a retrieval service ID, not a Knowledge Base ID. Since CLI 2.5.0, the direct-by-Knowledge-Base bl knowledge retrieve command is no longer available. The Bailian CLI (bl) and Knowledge Studio CLI (kscli) covered in this site's CLI reference are different tools; use each tool's own installation, configuration, and command instructions.

What's next