Catalog and CatalogContent Management
Overview
This documentation covers the API endpoints for managing Catalogs and CatalogContent in the Brainfish platform. Catalogs are collections of content from various sources (e.g., websites, Zendesk, GitHub) that can be used for knowledge management.
Authentication
All API endpoints require authentication. Admin privileges are required for create, update, and delete operations.
API Key Authentication Example
To authenticate API requests, use the `Authorization` header with a Bearer token:
curl --request POST \
--url https://app.brainfi.sh/api/documents.search.keyword \
--header 'accept: application/json' \
--header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'content-type: application/json' \
--data '{ "query": "What is Generative Language Models?" }'
Generating an API Key
For details on generating an API key via the Admin Panel, refer to the official guide: Generating API Keys
Catalog API
1. Create Catalog
Creates a new catalog for the team.** Endpoint:**
POST https://app.brainfi.sh/api/catalogs.create
```**
Authentication:** Required (Admin only)
### Request Body:
```json
{
"name": "string", // required
"source": "string", // required, one of: "website", "zendesk", "github"
"targets": [
{
"url": "string", // URL to crawl
"crawlEnabled": "boolean" // Whether to enable crawling for this URL
}
],
"configurations": {
"extractImages": "boolean", // Whether to extract images
"extractIframe": "boolean" // Whether to extract iframes
}
}
Response:
{
"id": "string", // UUID of the created catalog
"name": "string",
"source": "string",
"targets": [...],
"configurations": {...}
}
Error Responses:
- 400 Bad Request: No URLs provided for a website source or duplicate URLs detected
- 401 Unauthorized: User lacks authentication or admin privileges
2. Update Catalog
Updates an existing catalog.** Endpoint:**
POST https://app.brainfi.sh/api/catalogs.update
```**
Authentication:** Required (Admin only)
### Request Body:
```json
{
"id": "string", // required UUID
"name": "string", // optional updated name
"source": "string", // optional, one of: "website", "zendesk", "github"
"targets": [...],
"enabled": "boolean", // optional
"configurations": {...}
}
Response:
{
"success": true
}
Error Responses:
- 400 Bad Request: No URLs provided or duplicate URLs detected
- 401 Unauthorized: User lacks authentication or admin privileges
- 404 Not Found: Catalog with the specified ID does not exist
3. List Catalogs
Retrieves a list of all catalogs for the team.** Endpoint:**
POST https://app.brainfi.sh/api/catalogs.list
```**
Authentication:** Required
### Request Body:
```json
{
"status": ["active", "inactive"] // optional filter by status
}
Response:
{
"catalogs": [
{
"id": "string",
"name": "string",
"source": "string"
}
]
}
Error Responses:
- 401 Unauthorized: User lacks authentication
4. Delete Catalog
Deletes an existing catalog.** Endpoint:**
POST https://app.brainfi.sh/api/catalogs.delete
```**
Authentication:** Required (Admin only)
### Request Body:
```json
{
"id": "string" // required UUID
}
Response:
{
"success": true
}
Error Responses:
- 400 Bad Request: If catalog sync is in progress
- 401 Unauthorized: User lacks authentication or admin privileges
- 404 Not Found: Catalog with specified ID does not exist
CatalogContent API
1. Update CatalogContent
Updates an existing catalog content item.** Endpoint:**
POST https://app.brainfi.sh/api/catalogContents.update
```**
Authentication:** Required
### Request Body:
```json
{
"id": "string", // required UUID
"url": "string", // optional updated URL
"enabled": "boolean", // optional
"title": "string", // optional updated title
"content": "string", // optional updated content text
"configurations": {...} // optional
}
Response:
{
"success": true
}
Error Responses:
- 401 Unauthorized: User lacks authentication
- 404 Not Found: Catalog content with specified ID does not exist
2. Bulk Update CatalogContent
Updates multiple catalog content items at once.** Endpoint:**
POST https://app.brainfi.sh/api/catalogContents.bulkUpdate
```**
Authentication:** Required
### Request Body:
```json
{
"ids": ["string"], // required array of UUIDs
"enabled": "boolean" // required
}
Response:
{
"success": true
}
Error Responses:
- 401 Unauthorized: User lacks authentication
3. Delete CatalogContent
Deletes an existing catalog content item.** Endpoint:**
POST https://app.brainfi.sh/api/catalogContents.delete
```**
Authentication:** Required (Admin only)
### Request Body:
```json
{
"id": "string" // required UUID
}
Response:
{
"success": true
}
Error Responses:
- 401 Unauthorized: User lacks authentication or admin privileges
- 404 Not Found: Catalog content with specified ID does not exist
