---
title: "Add/Update sources"
method: POST
path: "/assistant_knowledges/{knowledge_id}/add/sources"
tags: ["Knowledge Bases"]
---

# Add/Update sources

`POST /assistant_knowledges/{knowledge_id}/add/sources`

Add new sources or update existing sources in a knowledge base

## Path parameters

- `knowledge_id` string, required

## Request body

- KnowledgeBaseAddSourcesRequest — Request to add sources to a knowledge base
  - `sources` KBSource[], required
    - `_id` string — Unique identifier for the source
    - `type` 'web-site' | 'document' | 'plain-text', required — Type of source
    - `data` string, required — URL for web-site, file URL for document, or text content for plain-text
    - `name` string — Name of the document (for document type)
    - `metadata` string — Additional metadata
    - `url` string — Alternative URL field
    - `pages` KBWebPage[] — Scraped pages (for web-site type)
      - `_id` string
      - `src` string — URL of the page
      - `title` string — Page title
      - `scrapping_status` boolean — Whether scraping was successful

## Response `200`

Sources successfully added/updated

- KnowledgeBaseSourcesResponse — Response after adding/removing sources
  - `message` string
  - `need_training` boolean

## Other responses

- `400` — Invalid request
- `401` — Unauthorized - Invalid or missing authentication
- `404` — Knowledge base not found

---

[API](https://skmtc.net/smartly/apis/smartly-ai-apis.md) · [All operations](https://skmtc.net/smartly/apis/smartly-ai-apis/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/smartly/smartly-ai-apis/revisions/1e26909d86c9/schema)
