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
- An Alibaba Cloud account.
- An API key — create one in the Console API Key page.
- A PDF / Word / Markdown file and a question whose answer can be found in that file.
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.
- 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.
- Choose Upload Files as the data source, and drag & drop or click to upload your prepared PDF / Word / Markdown file.
- Keep the indexing settings at their defaults and click Complete.
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., Copy the The
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: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: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.What's next
- Learn how RAG works: Core Concepts.
- Connect external data sources: Data Connectors.
- Set up Multi-index Retrieval through a Knowledge Search service: Knowledge Retrieval.
- Get streaming Knowledge answers through a Knowledge Q&A service: Knowledge Q&A.
- Browse the full endpoint list: API Reference.