Skip to content

AI RAG API

Endpoints for managing vector storage used in Retrieval-Augmented Generation (RAG). These endpoints allow you to create vector stores, upload content for indexing, and manage stored data.

SDK equivalent: sdk.ai.rag

Create Vector Storage

Create a new vector storage instance for a specific scope.

POST /api/ai/sources/{sourceId}/storage

Path Parameters

ParameterTypeDescription
sourceIdstringThe AI source ID

Request Body

json
{
  "integrationId": "integration-id",
  "scope": "thread",
  "subjectId": "thread-id",
  "expirationAfterDays": 30
}
FieldTypeRequiredDescription
integrationIdstringYesThe AI integration ID
scopestringYesStorage scope: thread, user, workspace, or tenant
subjectIdstringNoThe subject ID (e.g., thread ID, user ID)
expirationAfterDaysnumberNoAuto-expire storage after N days

Response

json
{
  "success": true,
  "message": "Vector store created",
  "vectorStore": {
    "_id": "vector-store-id",
    "scope": "thread",
    "subjectId": "thread-id",
    "externalId": "external-id",
    "expirationAfterDays": 30,
    "created": "2025-01-01T00:00:00.000Z"
  }
}

SDK: sdk.ai.rag.createStorage(sourceId, data)


Upload Content

Upload content to be indexed in a vector store for RAG retrieval.

POST /api/ai/sources/{sourceId}/storage/upload

Path Parameters

ParameterTypeDescription
sourceIdstringThe AI source ID

Request Body

json
{
  "integrationId": "integration-id",
  "content": "This is the documentation for our product...",
  "fileName": "product-docs.txt",
  "vectorStoreId": "vector-store-id",
  "metadata": {
    "type": "documentation",
    "version": "1.0"
  }
}
FieldTypeRequiredDescription
integrationIdstringNoThe AI integration ID
contentstring | objectYesText or JSON content to index
fileNamestringNoName for the uploaded content
vectorStoreIdstringNoTarget vector store ID
metadataobjectNoAdditional metadata for the content

Response

json
{
  "success": true,
  "message": "Content uploaded",
  "fileId": "file-id",
  "vectorStoreId": "vector-store-id"
}

SDK: sdk.ai.rag.uploadContent(sourceId, data)


Clear Storage

Remove files from a vector store.

POST /api/ai/sources/{sourceId}/storage/clear

Path Parameters

ParameterTypeDescription
sourceIdstringThe AI source ID

Request Body

json
{
  "integrationId": "integration-id",
  "vectorStoreId": "vector-store-id",
  "fileIds": ["file-id-1", "file-id-2"]
}
FieldTypeRequiredDescription
integrationIdstringNoThe AI integration ID
vectorStoreIdstringNoThe vector store to clear
fileIdsstring[]NoSpecific file IDs to remove. If omitted, clears all files.

Response

json
{
  "success": true,
  "message": "Storage cleared",
  "clearedCount": 2,
  "vectorStoreId": "vector-store-id"
}

SDK: sdk.ai.rag.clearStorage(sourceId, data)

Build SaaS Products Without Limits.