Skip to main content
POST
Create New Index

Create Index

Create a new knowledge base index for storing and retrieving documents.

Endpoint

Description

This endpoint allows administrators to create a new knowledge base index. The index can be assigned to specific users or groups. Only administrators can create indexes.

Authentication

Required: API Key with admin privileges

Request Body

Example Request

Success Response

Status Code: 201 Created

Response Fields

Example Usage

JavaScript

Python

cURL

Error Responses

400 Bad Request

Validations and Business Rules

  • Index name normalization (for storage and uniqueness checks):
    • Lowercase, trim whitespace
    • Replace spaces with hyphens
    • Remove any character not in [a-z0-9-]
  • Index name validation: Must match ^[a-z0-9-]{3,50}$; otherwise returns 400.
  • Uniqueness: Normalized name must be unique; duplicates return 409.
  • Assigned user quota: If assignedUser is provided, enforce user index quota via checkUserIndexQuota; exceeded quota returns 403.
  • Region restriction (Essential): For Essential license, indexes can only be created with cloud=aws and region=us-east-1; otherwise 403.
  • Assigned group: When assignedGroup is provided, the group must exist and not be archived (status != 'Archived'); otherwise 400.

Normalization and Storage

  • name is stored normalized.
  • sharedIndexName defaults to the normalized name.
  • namespace defaults to user-{userId}-index-{normalizedName} when assigned to a user.

Typical Error Shapes

400 Invalid Index Name

403 Index Quota Exceeded

403 Region Not Allowed

400 Group Invalid/Inactive

401 Unauthorized

403 Forbidden

409 Conflict

429 Too Many Requests

Index Types

Required Fields

Use Cases

  • User Assignment: Create indexes and assign them to specific users
  • Group Assignment: Create indexes and assign them to groups
  • Knowledge Bases: Build specialized knowledge bases for specific domains
  • Content Organization: Organize content by topic or category
  • Vector Storage: Create indexes for storing and retrieving vector embeddings

Rate Limits

  • Default: 50 requests per minute
  • Daily: 5,000 requests per day
  • Monthly: 150,000 requests per month

Notes

  • This endpoint is only accessible by administrators
  • Required fields: name, region, cloud are all required
  • Assignment: Index can be assigned to a user (assignedUser) or group (assignedGroup)
  • Auto-generation: namespace is auto-generated if not provided
  • Unique Names: Index names must be unique across the system
  • The index is immediately available for use after creation
  • Dimension: Vector dimension is managed internally by the application (currently 4096)
  • Metric: Similarity metric is managed internally by the application

Authorizations

Authorization
string
header
required

API key authentication using Bearer token format. Example: Authorization: Bearer sk-your-api-key-here

Body

application/json
name
string
required

Index name

Example:

"my-knowledge-base"

region
string
required

AWS/GCP region for the vector database (e.g., "us-east-1", "us-west-1")

Example:

"us-east-1"

cloud
enum<string>
required

Cloud provider ("aws" or "gcp")

Available options:
aws,
gcp
Example:

"aws"

assignedUser
string

User ID to assign the index to (MongoDB ObjectId)

Example:

"60a7c8f5e8b4f5001f7a8c24"

assignedGroup
string

Group ID to assign the index to (MongoDB ObjectId)

Example:

"60a7c8f5e8b4f5001f7a8c25"

sharedIndexName
string

Shared index name (optional, defaults to name)

Example:

"my-knowledge-base"

namespace
string

Namespace for the index (optional, auto-generated)

Example:

"user-60a7c8f5e8b4f5001f7a8c24-index-my-knowledge-base"

Response

Index created successfully

success
boolean
Example:

true

message
string
Example:

"Index created successfully"

index
object