Skip to content

companyRAG API

This documentation describes the API interface for the CompanyRAG Indexer, which is secured via API key authentication.

All endpoints in this specification require authentication via API Key. The API Key must be sent in the Authorization header using the Bearer token format.

API Keys are generated via the admin panel and have the format rag_<64-character-hex-string>.

Example authentication header:

Authorization: Bearer rag_a1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890

Alternative (cookie-based for browser clients): The API also supports an access_token cookie as fallback authentication.

Name: BearerAuth Type: HTTP Schema: bearer Description: API Key authentication using a Bearer token. Format: Bearer rag_<64-character-hex>.


All errors follow this format:

{
"error": "Error message description"
}

Common HTTP status codes:

  • 400 Bad Request: Invalid request parameters
  • 401 Unauthorized: Missing or invalid authentication
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Resource not found
  • 500 Internal Server Error: Server-side error

The API is available via the following server:

https://[COMPANY].company-gpt.com/companygpt/rag/api (Please replace [COMPANY] in the correct place with the actual domain, or copy it accordingly from the browser address bar in the RAG UI under API Key)


Error message object.

PropertyTypeDescription
errorstringError message

Metadata for pagination.

PropertyTypeDescription
totalintegerTotal number of items
pageintegerCurrent page number (1-indexed)
pageSizeintegerNumber of items per page
totalPagesintegerTotal number of pages

Metadata of a file.

PropertyTypeFormatDescription
idstringuuidUnique file ID
namestringOriginal file name
blobPathstringPath in blob storage
sizeBytesintegerint64File size in bytes (optional)
contentTypestringMIME type (optional)
statusstringFile processing status (pending, indexed, failed, deleted)
collectionIdstringuuidAssociated collection ID (optional)
collectionNamestringAssociated collection name (optional)
createdAtstringdate-timeISO 8601 creation timestamp
updatedAtstringdate-timeISO 8601 last update timestamp
lastIndexedAtstringdate-timeISO 8601 last indexing timestamp (optional)

Paginated list of files.

PropertyTypeDescription
filesarray of FileInfo
totalinteger
pageinteger
pageSizeinteger
totalPagesinteger

Request for uploading a file (multipart/form-data).

PropertyTypeFormatDescription
filestringbinaryFile to upload
collectionIdstringuuidTarget collection ID (optional)

Response after successful file upload.

PropertyTypeFormatDescription
idstringuuidFile ID
namestringFile name
statusstringFile status (pending, indexed, failed)
collectionIdstringuuidCollection ID
createdAtstringdate-timeCreation timestamp

Information about an indexing job.

PropertyTypeFormatDescription
idstringuuidUnique job ID
fileIdstringuuidAssociated file ID
fileNamestringName of the processed file (optional)
collectionIdstringuuidAssociated collection ID (optional)
collectionNamestringAssociated collection name (optional)
typestringJob action type (index, delete, reindex)
statusstringCurrent job status (pending, running, completed, failed, cancelled)
retryCountintegerNumber of attempts
maxRetriesintegerMaximum number of allowed attempts
errorstringError message for failed job (optional)
createdAtstringdate-timeISO 8601 creation timestamp
startedAtstringdate-timeISO 8601 start timestamp (optional)
completedAtstringdate-timeISO 8601 completion timestamp (optional)

Paginated list of jobs.

PropertyTypeDescription
jobsarray of JobInfo
totalinteger
pageinteger
pageSizeinteger
totalPagesinteger
statusCountsobjectNumber of jobs per status (pending, running, completed, failed, cancelled)

Metadata of a collection.

PropertyTypeFormatDescription
idstringuuidUnique collection ID
namestringCollection name
descriptionstringCollection description (optional)
createdAtstringdate-time
updatedAtstringdate-time

Paginated list of collections.

PropertyTypeDescription
collectionsarray of CollectionInfo
totalinteger
pageinteger
pageSizeinteger
totalPagesinteger

Request to create a collection.

PropertyTypeDescription
namestringCollection name
descriptionstringCollection description (optional)

Request to update a collection.

PropertyTypeDescription
namestringNew collection name (optional)
descriptionstringNew collection description (optional)

Configuration of a data source.

PropertyTypeFormatDescription
idstringuuid
namestring
typestringType of source (sharepoint, firecrawl, custom)
configobjectSource-specific configuration
createdAtstringdate-time
updatedAtstringdate-time

Paginated list of data sources.

PropertyTypeDescription
sourcesarray of SourceInfo
totalinteger
pageinteger
pageSizeinteger

Request to create a data source.

PropertyTypeDescription
namestring
typestringType of source (sharepoint, firecrawl, custom)
configobjectSource-specific configuration

Information about an API key.

PropertyTypeFormatDescription
idstringuuid
clientNamestringHuman-readable name for the key
permissionsarray of stringArray of permissions (e.g. ["read", "write"])
createdAtstringdate-time
lastUsedAtstringdate-timeLast usage timestamp (can be null)
revokedbooleanIndicates whether the key has been revoked

Paginated list of API keys.

PropertyTypeDescription
keysarray of APIKeyInfo
totalinteger
pageinteger
pageSizeinteger

Request to create an API key.

PropertyTypeDescription
clientNamestringHuman-readable name for this API key
permissionsarray of stringRequested permissions (default: ['read'])

Response after creating an API key.

PropertyTypeFormatDescription
idstringuuid
keystringThe actual API key (displayed only once)
clientNamestring
permissionsarray of string
createdAtstringdate-time

Endpoints for managing files.

Summary: List files Description: Retrieves a paginated list of files accessible to the authenticated user. The results are filtered based on the user’s collection permissions. Operation-ID: listFiles Parameters:

  • page (query, optional): Page number (1-indexed, default 1). Type: integer, Minimum: 1.
  • pageSize (query, optional): Items per page (default 20, max 100). Type: integer, Minimum: 1, Maximum: 100.
  • collectionId (query, optional): Filter by collection ID. Type: string, Format: uuid.
  • status (query, optional): Filter by file status. Type: string, Enum: ['pending', 'indexed', 'failed']. Responses:
  • 200 OK: Successful response. Schema: FileListResponse.
  • 401 Unauthorized: Schema: Error.
  • 500 Internal Server Error: Schema: Error.

Summary: Upload a file Description: Uploads a new file to a collection. The file is queued for indexing. Operation-ID: uploadFile Request body (multipart/form-data):

  • file (required): The file to upload (binary). Type: string, Format: binary.
  • collectionId (optional): Target collection UUID. Type: string, Format: uuid. Responses:
  • 201 Created: File uploaded successfully. Schema: FileUploadResponse.
  • 400 Bad Request: Invalid request. Schema: Error.
  • 401 Unauthorized: Schema: Error.
  • 413 Payload Too Large: File too large. Schema: Error.

Summary: Retrieve file details Description: Retrieves metadata and indexing history for a specific file. Operation-ID: getFile Parameters:

  • fileId (path, required): File UUID. Type: string, Format: uuid. Responses:
  • 200 OK: File details. Schema: FileInfo.
  • 401 Unauthorized: Schema: Error.
  • 403 Forbidden: Access denied. Schema: Error.
  • 404 Not Found: File not found. Schema: Error.

Summary: Delete a file Description: Deletes a file and removes it from all indexes. Operation-ID: deleteFile Parameters:

  • fileId (path, required): File UUID. Type: string, Format: uuid. Responses:
  • 200 OK: File deleted. Content: application/json, Schema: object with property status (string, Example: ‘deleted’).
  • 401 Unauthorized:
  • 403 Forbidden: Access denied.
  • 404 Not Found: File not found.

Summary: Reindex a file Description: Queues a file for reprocessing. Operation-ID: reindexFile Parameters:

  • fileId (path, required): File UUID. Type: string, Format: uuid. Responses:
  • 200 OK: Reindex job queued. Schema: JobInfo.
  • 401 Unauthorized:
  • 403 Forbidden: Access denied.
  • 404 Not Found: File not found.

Endpoints for managing indexing jobs.

Summary: List indexing jobs Description: Retrieves a paginated list of indexing jobs with optional filtering. Operation-ID: listJobs Parameters:

  • page (query, optional): Page number (default 1). Type: integer, Minimum: 1.
  • pageSize (query, optional): Items per page (default 20, max 100). Type: integer, Minimum: 1, Maximum: 100.
  • status (query, optional): Filter by job status. Type: string, Enum: ['pending', 'running', 'completed', 'failed', 'cancelled'].
  • collectionId (query, optional): Filter by collection ID. Type: string, Format: uuid. Responses:
  • 200 OK: List of jobs. Schema: JobListResponse.
  • 401 Unauthorized:

Summary: Retrieve job details Description: Retrieves detailed information about a specific job. Operation-ID: getJob Parameters:

  • jobId (path, required): Job UUID. Type: string, Format: uuid. Responses:
  • 200 OK: Job details. Schema: JobInfo.
  • 401 Unauthorized:
  • 403 Forbidden: Access denied.
  • 404 Not Found: Job not found.

Summary: Delete/cancel a job Description: Cancels a pending job or deletes a completed job. Operation-ID: deleteJob Parameters:

  • jobId (path, required): Job UUID. Type: string, Format: uuid. Responses:
  • 200 OK: Job deleted. Content: application/json, Schema: object with property status (string, Example: ‘deleted’).
  • 401 Unauthorized:
  • 403 Forbidden: Access denied.
  • 404 Not Found: Job not found.

Summary: Retry a failed job Description: Retries a failed indexing job. Operation-ID: retryJob Parameters:

  • jobId (path, required): Job UUID. Type: string, Format: uuid. Responses:
  • 200 OK: Job retried. Schema: JobInfo.
  • 401 Unauthorized:
  • 403 Forbidden: Access denied.
  • 404 Not Found: Job not found.
  • 409 Conflict: Job cannot be retried in its current state.

Summary: Retry all failed jobs Description: Retries all failed jobs for the user’s accessible collections. Operation-ID: retryAllFailedJobs Responses:

  • 200 OK: Retry queued for all failed jobs. Content: application/json, Schema: object with property retried (integer, Description: Number of jobs queued for retry).

Summary: Delete all failed jobs Description: Deletes all failed jobs for the user’s accessible collections. Operation-ID: deleteAllFailedJobs Responses:

  • 200 OK: Failed jobs deleted. Content: application/json, Schema: object with property deleted (integer).

Summary: Reindex all files Description: Queues all files in the user’s accessible collections for reindexing. Operation-ID: reindexAll Responses:

  • 200 OK: Reindex jobs queued. Content: application/json, Schema: object with property queued (integer, Description: Number of files queued for reindexing).

Endpoints for managing collections.

Summary: List collections Description: Retrieves a paginated list of collections accessible to the user. Operation-ID: listCollections Parameters:

  • page (query, optional): Page number (default 1). Type: integer.
  • pageSize (query, optional): Items per page (default 20, max 100). Type: integer. Responses:
  • 200 OK: List of collections. Schema: CollectionListResponse.
  • 401 Unauthorized:

Summary: Create collection Description: Creates a new collection. Operation-ID: createCollection Request body (application/json):

  • Schema: CollectionCreateRequest. Responses:
  • 201 Created: Collection created. Schema: CollectionInfo.
  • 400 Bad Request: Invalid request. Schema: Error.
  • 401 Unauthorized:

Summary: Retrieve collection details Description: Retrieves metadata for a specific collection. Operation-ID: getCollection Parameters:

  • collectionId (path, required): Collection UUID. Type: string, Format: uuid. Responses:
  • 200 OK: Collection details. Schema: CollectionInfo.
  • 401 Unauthorized:
  • 403 Forbidden: Access denied.
  • 404 Not Found: Collection not found.

Summary: Update collection Description: Updates collection metadata. Operation-ID: updateCollection Parameters:

  • collectionId (path, required): Collection UUID. Type: string, Format: uuid. Request body (application/json):
  • Schema: CollectionUpdateRequest. Responses:
  • 200 OK: Collection updated. Schema: CollectionInfo.
  • 401 Unauthorized:
  • 403 Forbidden: Access denied.
  • 404 Not Found: Collection not found.

Summary: Delete collection Description: Deletes a collection and all associated data. Operation-ID: deleteCollection Parameters:

  • collectionId (path, required): Collection UUID. Type: string, Format: uuid. Responses:
  • 200 OK: Collection deleted.
  • 401 Unauthorized:
  • 403 Forbidden: Access denied.
  • 404 Not Found: Collection not found.

Endpoints for managing data sources.

Summary: List data sources Description: Retrieves a paginated list of configured data sources. Operation-ID: listSources Parameters:

  • page (query, optional): Type: integer.
  • pageSize (query, optional): Type: integer. Responses:
  • 200 OK: List of sources. Schema: SourceListResponse.
  • 401 Unauthorized:

Summary: Create data source Description: Configures a new data source (SharePoint, Firecrawl, etc.). Operation-ID: createSource Request body (application/json):

  • Schema: SourceCreateRequest. Responses:
  • 201 Created: Source created. Schema: SourceInfo.
  • 400 Bad Request: Invalid request.
  • 401 Unauthorized:

Summary: Retrieve source details Operation-ID: getSource Parameters:

  • sourceId (path, required): Type: string, Format: uuid. Responses:
  • 200 OK: Source details. Schema: SourceInfo.
  • 401 Unauthorized:
  • 404 Not Found: Source not found.

Summary: Update source Operation-ID: updateSource Parameters:

  • sourceId (path, required): Type: string, Format: uuid. Request body (application/json):
  • Schema: SourceCreateRequest. Responses:
  • 200 OK: Source updated. Schema: SourceInfo.
  • 401 Unauthorized:
  • 404 Not Found: Source not found.

Summary: Delete source Operation-ID: deleteSource Parameters:

  • sourceId (path, required): Type: string, Format: uuid. Responses:
  • 200 OK: Source deleted.
  • 401 Unauthorized:
  • 404 Not Found: Source not found.

Summary: Trigger source synchronization Description: Manually triggers a synchronization of this data source. Operation-ID: syncSource Parameters:

  • sourceId (path, required): Type: string, Format: uuid. Responses:
  • 200 OK: Synchronization triggered. Schema: JobInfo.
  • 401 Unauthorized:
  • 404 Not Found: Source not found.

Endpoints for administrators to manage API keys.

Summary: List API keys (Admin) Description: Lists all API keys (administrators only). Operation-ID: listAPIKeys Parameters:

  • page (query, optional): Type: integer.
  • pageSize (query, optional): Type: integer. Responses:
  • 200 OK: List of API keys. Schema: APIKeyListResponse.
  • 401 Unauthorized:
  • 403 Forbidden: Admin access required.

Summary: Create API key (Admin) Description: Creates a new API key for a user or an application. Operation-ID: createAPIKey Request body (application/json):

  • Schema: APIKeyCreateRequest. Responses:
  • 201 Created: API key created (key is displayed only once). Schema: APIKeyCreateResponse.
  • 400 Bad Request: Invalid request. Schema: Error.
  • 401 Unauthorized:
  • 403 Forbidden: Admin access required.

Summary: Revoke API key (Admin) Description: Revokes an API key, preventing further use. Operation-ID: revokeAPIKey Parameters:

  • keyId (path, required): API key UUID. Type: string, Format: uuid. Responses:
  • 200 OK: API key revoked.
  • 401 Unauthorized:
  • 403 Forbidden: Admin access required.
  • 404 Not Found: API key not found.