Developer Guide
API Overview

API Overview

The IntelliRepo API lets you integrate AI-powered document Q&A into your applications. This guide covers the basics of using the API.


Base URL

https://api.intellirepo.ai/api/v1

All API endpoints use this base URL.


Authentication

All API requests require authentication via API key:

curl https://api.intellirepo.ai/api/v1/collections \
  -H "Authorization: Bearer rh_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

See Authentication for details on creating and managing API keys.


Key Endpoints

Collections

MethodEndpointDescription
GET/collectionsList all collections
POST/collectionsCreate a collection
GET/collections/{id}Get collection details
PATCH/collections/{id}Update a collection
DELETE/collections/{id}Delete a collection

Documents

MethodEndpointDescription
GET/collections/{id}/documentsList documents
POST/collections/{id}/documentsUpload a document
GET/collections/{id}/documents/{doc_id}Get document details
PATCH/collections/{id}/documents/{doc_id}Update document metadata
DELETE/collections/{id}/documents/{doc_id}Delete a document

Chat & Search

MethodEndpointDescription
POST/chatChat across all collections
POST/collections/{id}/chatChat within a collection
POST/chat/streamStreaming chat response
POST/searchSearch all collections
POST/collections/{id}/searchSearch within a collection

Request Format

Send JSON in request bodies:

curl -X POST https://api.intellirepo.ai/api/v1/collections \
  -H "Authorization: Bearer rh_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Product Documentation",
    "description": "API guides and references"
  }'

Response Format

All responses are JSON:

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Product Documentation",
  "description": "API guides and references",
  "document_count": 0,
  "created_at": "2024-01-15T10:30:00Z"
}

Error Responses

Errors include a status code and message:

{
  "detail": "Collection not found"
}
StatusMeaning
400Bad request (invalid input)
401Unauthorized (invalid API key)
403Forbidden (insufficient permissions)
404Resource not found
422Validation error
429Rate limit exceeded
500Server error

Chat Example

Ask a question and get an AI-generated answer:

curl -X POST https://api.intellirepo.ai/api/v1/chat \
  -H "Authorization: Bearer rh_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "question": "What is the refund policy?"
  }'

Response:

{
  "question": "What is the refund policy?",
  "answer": "According to the documentation, customers can request a full refund within 30 days of purchase...",
  "sources": [
    {
      "document_name": "Return-Policy.pdf",
      "document_id": "uuid",
      "collection_name": "Policies",
      "page_number": 3,
      "similarity": 0.89,
      "chunk_text": "Customers may request a full refund..."
    }
  ]
}

Streaming Responses

For real-time responses, use the streaming endpoint:

curl -X POST https://api.intellirepo.ai/api/v1/chat/stream \
  -H "Authorization: Bearer rh_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{"question": "Explain the onboarding process"}'

Returns Server-Sent Events (SSE):

event: sources
data: {"sources": [...]}

event: chunk
data: {"text": "The onboarding"}

event: chunk
data: {"text": " process involves"}

event: done
data: {"usage": {"input_tokens": 150, "output_tokens": 200}}

Rate Limits

API requests count toward your plan's query limit:

PlanQueries/Month
Solo500
Pro2,000
Team10,000
Enterprise75,000

When exceeded, requests return HTTP 429. Paid plans support overages at $0.05/query.


SDKs

We provide official SDKs for easier integration:

SDKs handle authentication, error handling, and provide typed interfaces.


Pagination

List endpoints support pagination:

curl "https://api.intellirepo.ai/api/v1/collections?limit=10&offset=0" \
  -H "Authorization: Bearer rh_live_xxx"
ParameterDefaultDescription
limit50Items per page (max 100)
offset0Number of items to skip

Response includes total count:

{
  "collections": [...],
  "total": 25,
  "limit": 10,
  "offset": 0
}

Related Articles


Need Help?

Contact our support team if you have questions about the API.