---
title: "Add a knowledge source (file as base64, URL, text or FAQ)"
method: POST
path: "/api/v1/chatbots/{id}/knowledge/sources"
---

# Add a knowledge source (file as base64, URL, text or FAQ)

`POST /api/v1/chatbots/{id}/knowledge/sources`

## Request

- Base URL: `https://smartwebchat.eu`
- URL: `https://smartwebchat.eu/api/v1/chatbots/{id}/knowledge/sources`
- Auth: HTTP bearer

Same quota, credit check, URL safety and file checks as the dashboard. Processing runs in the background; the response carries the job to poll at GET /api/v1/jobs/{jobId}.

## Path parameters

- `id` string, required

## Headers

- `Idempotency-Key` string

## Request body

- union: One of four forms, chosen by type. A file travels as base64 so that a retry with the same Idempotency-Key has the same body.
  - object
    - `type` 'url', required
    - `url` string, required
  - object
    - `type` 'text', required
    - `text` string, required
  - object
    - `type` 'faq', required
    - `question` string, required
    - `answer` string, required
  - object
    - `type` 'file', required
    - `filename` string, required
    - `content_base64` string, byte, required

## Response `202`

Source accepted; data.source and data.job

## Other responses

- `400`: Invalid input or URL not allowed
- `402`: Knowledge quota exceeded or credit insufficient
- `404`: Chatbot not found
- `409`: A request with this Idempotency-Key is still being processed. Retry after the seconds given in Retry-After (2).
- `413`: file_too_large: the JSON body may be at most 10223616 bytes, with or without Content-Length (checked before the body is used), so files up to 7618560 bytes always fit as base64, below the plan's file limit where that is smaller.
- `415`: Unsupported file type
- `422`: Idempotency-Key was already used with a different request body. Use a new key for a new request.
- `429`: Rate limit exceeded: 600 requests per minute per account across all /api/v1/ routes. Wait for the seconds given in Retry-After (60) and retry.

---

[API](https://skmtc.dev/smartwebchat/apis/smartwebchat-api.md) · [All operations](https://skmtc.dev/smartwebchat/apis/smartwebchat-api/llms.txt) · [OpenAPI document](https://skmtc.dev/smartwebchat/apis/smartwebchat-api/revisions/1b052502dacb?raw)
