> ## Documentation Index
> Fetch the complete documentation index at: https://guide.beenos-solutions.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Knowledge Base API — Sources and Content Management

> REST API endpoints for managing knowledge base content sources in Beenos Solutions — add, list, and delete sources programmatically.

The Knowledge Base API lets you programmatically manage the content sources that power your AI agents. A source is any piece of content — a URL, a plain-text block, or an uploaded document — that Beenos Solutions indexes and makes available for retrieval. You can use these endpoints to automate content ingestion pipelines, synchronize your documentation with the knowledge base, or build custom admin tools on top of the platform.

***

### POST /v1/knowledge-base/sources

Add a new content source to your knowledge base. After you submit a source, Beenos Solutions begins processing and indexing it asynchronously. Retrieve the source from the `GET /v1/knowledge-base/sources` list endpoint and check its `status` field, or listen for a webhook event, to confirm when indexing is complete.

#### Request Body

<ParamField body="type" type="string" required>
  The type of content source. Must be one of `document`, `url`, or `text`.
</ParamField>

<ParamField body="name" type="string" required>
  A human-readable label for this source. Use a descriptive name that helps you identify the content at a glance.
</ParamField>

<ParamField body="content" type="string">
  The raw text content to index. **Required** when `type` is `text`.
</ParamField>

<ParamField body="url" type="string">
  The URL to fetch and index. Beenos Solutions crawls the page and indexes its text content. **Required** when `type` is `url`.
</ParamField>

<ParamField body="file" type="file">
  The document file to upload. Accepted formats include PDF, DOCX, and TXT. **Required** when `type` is `document`. Use `multipart/form-data` encoding for this request type.
</ParamField>

<ParamField body="tags" type="array">
  An optional list of string tags for organizing and filtering sources. For example, `["docs", "product", "v2"]`.
</ParamField>

#### Example Request

```bash theme={null}
curl -X POST https://api.beenossolutions.com/v1/knowledge-base/sources \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "url",
    "name": "Product Documentation",
    "url": "https://docs.example.com",
    "tags": ["docs", "product"]
  }'
```

#### Response

<ResponseField name="id" type="string">
  The unique identifier for this source (for example, `src_abc123`). Use this ID to retrieve, update, or delete the source.
</ResponseField>

<ResponseField name="type" type="string">
  The source type you specified in the request: `document`, `url`, or `text`.
</ResponseField>

<ResponseField name="name" type="string">
  The human-readable name you assigned to this source.
</ResponseField>

<ResponseField name="status" type="string">
  The current processing status of the source. Possible values:

  * `processing` — the source has been received and is being indexed
  * `indexed` — indexing is complete and the source is available for search and retrieval
  * `failed` — indexing encountered an error; check the `error` field for details
</ResponseField>

<ResponseField name="created_at" type="string">
  ISO 8601 timestamp indicating when the source was created.
</ResponseField>

```json theme={null}
{
  "data": {
    "id": "src_abc123",
    "type": "url",
    "name": "Product Documentation",
    "status": "processing",
    "created_at": "2024-01-15T10:30:00Z"
  },
  "meta": {
    "request_id": "req_abc123",
    "timestamp": "2024-01-15T10:30:00Z"
  }
}
```

***

### GET /v1/knowledge-base/sources

Retrieve a paginated list of all content sources in your knowledge base. Use the query parameters below to filter results or page through large collections.

#### Query Parameters

<ParamField query="limit" type="integer" default="20">
  The number of sources to return per page. Minimum `1`, maximum `100`.
</ParamField>

<ParamField query="cursor" type="string">
  A pagination cursor returned as `next_cursor` in a previous response. Omit this parameter to start from the first page.
</ParamField>

<ParamField query="status" type="string">
  Filter results by processing status. One of `processing`, `indexed`, or `failed`. Omit to return sources of all statuses.
</ParamField>

#### Example Request

```bash theme={null}
curl "https://api.beenossolutions.com/v1/knowledge-base/sources?limit=20&status=indexed" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

#### Example Response

```json theme={null}
{
  "data": [
    {
      "id": "src_abc123",
      "type": "url",
      "name": "Product Documentation",
      "status": "indexed",
      "created_at": "2024-01-15T10:30:00Z"
    },
    {
      "id": "src_def456",
      "type": "text",
      "name": "Return Policy",
      "status": "indexed",
      "created_at": "2024-01-14T08:00:00Z"
    }
  ],
  "meta": {
    "request_id": "req_xyz789",
    "timestamp": "2024-01-15T10:31:00Z",
    "next_cursor": "cur_ghi012"
  }
}
```

***

### DELETE /v1/knowledge-base/sources/:id

Permanently delete a content source and remove all of its indexed content from the knowledge base.

#### Path Parameter

<ParamField path="id" type="string" required>
  The unique ID of the source to delete (for example, `src_abc123`).
</ParamField>

#### Example Request

```bash theme={null}
curl -X DELETE https://api.beenossolutions.com/v1/knowledge-base/sources/src_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY"
```

#### Response

Returns `204 No Content` on success with an empty response body. If the source does not exist, the API returns `404 Not Found`.

<Warning>
  Deleting a source removes its content from the knowledge base immediately and cannot be undone. Agents that relied on this content may return incomplete or less accurate answers until you add replacement content. Review which agents use a source before deleting it.
</Warning>
