Knowledge BaseCollections

Collections API

The Collections API allows you to manage collections for organizing your documents. Collections help group related documents together for better organization and access control.

Base URL

https://api.aloochat.ai/api/public

Authentication

All requests require an API key in the x-api-key header:

x-api-key: your_api_key_here

Endpoints

Create Collection

Create a new collection for organizing documents.

Endpoint: POST /collections

Request Body

FieldTypeRequiredDescription
namestringYesName of the collection
descriptionstringNoDescription of the collection
is_privatebooleanNoWhether the collection is private (default: false)
company_idstring (UUID)YesThe ID of the company

Example Requests

curl -X POST "https://api.aloochat.ai/api/public/collections" \
  -H "x-api-key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Technical Documentation",
    "description": "Collection for all technical documents and guides",
    "is_private": false,
    "company_id": "123e4567-e89b-12d3-a456-426614174000"
  }'

Example Response

{
  "id": "456e7890-e89b-12d3-a456-426614174001",
  "name": "Technical Documentation",
  "description": "Collection for all technical documents and guides",
  "is_private": false,
  "company_id": "123e4567-e89b-12d3-a456-426614174000",
  "created_by_id": "789e1234-e89b-12d3-a456-426614174002",
  "vector_namespace": "tech_docs_456e7890",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z",
  "document_count": 0
}

List Collections

Retrieve a paginated list of all collections for your company.

Endpoint: GET /collections

Parameters

ParameterTypeRequiredDescription
skipintegerNoNumber of items to skip (default: 0)
limitintegerNoNumber of items to return (default: 100, max: 1000)

Example Requests

curl -X GET "https://api.aloochat.ai/api/public/collections?limit=20&skip=0" \
  -H "x-api-key: your_api_key_here"

Example Response

[
  {
    "id": "456e7890-e89b-12d3-a456-426614174001",
    "name": "Technical Documentation",
    "description": "Collection for all technical documents and guides",
    "is_private": false,
    "company_id": "123e4567-e89b-12d3-a456-426614174000",
    "created_by_id": "789e1234-e89b-12d3-a456-426614174002",
    "vector_namespace": "tech_docs_456e7890",
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:30:00Z",
    "document_count": 15
  }
]

Get Collection

Retrieve a specific collection by ID.

Endpoint: GET /collections/{collectionId}

Parameters

ParameterTypeRequiredDescription
collectionIdstring (UUID)YesThe ID of the collection

Example Requests

curl -X GET "https://api.aloochat.ai/api/public/collections/456e7890-e89b-12d3-a456-426614174001" \
  -H "x-api-key: your_api_key_here"

Update Collection

Update an existing collection.

Endpoint: PUT /collections/{collectionId}

Parameters

ParameterTypeRequiredDescription
collectionIdstring (UUID)YesThe ID of the collection to update

Request Body

All fields are optional for updates:

FieldTypeRequiredDescription
namestringNoNew name for the collection
descriptionstringNoNew description for the collection
is_privatebooleanNoWhether the collection should be private

Example Requests

curl -X PUT "https://api.aloochat.ai/api/public/collections/456e7890-e89b-12d3-a456-426614174001" \
  -H "x-api-key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Technical Documentation",
    "description": "Updated collection for technical documents and API guides",
    "is_private": true
  }'

Delete Collection

Delete a collection. Note that this will also affect any documents associated with the collection.

Endpoint: DELETE /collections/{collectionId}

Parameters

ParameterTypeRequiredDescription
collectionIdstring (UUID)YesThe ID of the collection to delete

Example Requests

curl -X DELETE "https://api.aloochat.ai/api/public/collections/456e7890-e89b-12d3-a456-426614174001" \
  -H "x-api-key: your_api_key_here"

Example Response

{
  "status": "success"
}

Error Responses

The API uses standard HTTP status codes to indicate success or failure:

  • 200 - Success
  • 201 - Created successfully
  • 400 - Bad request (invalid parameters)
  • 401 - Unauthorized (invalid API key)
  • 403 - Forbidden (insufficient permissions)
  • 404 - Not found
  • 500 - Internal server error

Error responses include a JSON object with error details:

{
  "detail": "Collection not found"
}