companyRAG API
The companyRAG Indexer exposes an HTTP API for managing files, collections, indexing jobs and data sources programmatically. It allows content to be ingested into companyRAG automatically, for example from an existing document management system or through a nightly sync.
This page covers the essentials: authentication, base URL and error handling. The endpoint reference is generated from the OpenAPI specification. It covers the most important endpoints; some newer endpoints and fields are not included yet.
Authentication
Section titled “Authentication”All endpoints require authentication via an API key. The key is sent in the Authorization header as a Bearer token:
Authorization: Bearer rag_a1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890Administrators create API keys in companyRAG under API Keys. They have the format rag_ followed by a 64-character hex string and always act on behalf of the person who created them.
The API also accepts an access_token cookie. That path exists as a fallback for browser clients already signed in to companyRAG; integrations and scripts should use the Bearer token.
Base URL
Section titled “Base URL”The API is available under the domain of your CompanyGPT instance:
https://COMPANY.company-gpt.com/companygpt/rag/apiCOMPANY is a placeholder for the subdomain of your environment. You can read it from the browser address bar while the companyRAG UI is open. If your environment uses a custom domain, append /companygpt/rag/api to that domain.
Error handling
Section titled “Error handling”Errors are mostly returned as a JSON object with an error field:
{ "error": "Error message description"}A few endpoints return a plain-text body instead; these are noted on the respective endpoint in the reference.
| Status | Meaning |
|---|---|
400 Bad Request | Invalid request parameters |
401 Unauthorized | Missing or invalid authentication |
403 Forbidden | Insufficient permissions |
404 Not Found | Resource not found |
409 Conflict | Conflict with the current state of the resource, such as a job that cannot be retried in its current status, or a share change that would leave a collection without an owner |
500 Internal Server Error | Server-side error |
Functional areas
Section titled “Functional areas”The endpoints are grouped by area in the reference:
- Files – upload, list, retrieve, delete and reindex files.
- Jobs – monitor, retry, cancel and clean up indexing jobs.
- Collections – create, update and delete collections and manage their shares.
- Ingest – ingest structured datasets row by row (up to 10,000 rows per call) and truncate tables.
- Sources – configure and synchronize data sources such as SharePoint, Nextcloud, Google Drive, GitHub, WebDAV, FTP or web crawl.
- Admin – API Keys – list, create and revoke API keys (administrators only).
Further resources
Section titled “Further resources”- companyRAG add-on – features and usage of the UI
- Using companyRAG in CompanyGPT – setting it up as a knowledge source for agents
- Agents API – programmatic access to CompanyGPT agents