API Keys
Use an API key to integrate FAQSure directly into your own application — send chat messages, upload documents, search your knowledge base, or pull analytics.
Create an API Key
- Go to Settings → API Keys
- Click Create API Key
- Give it a name (e.g. “Production”) and optionally set:
- Rate limit per minute (default: 60)
- Rate limit per hour (default: 1,000)
- Expiry date
- Copy the key immediately — it is only shown once
⚠️
Store your API key securely. Do not expose it in client-side code, public repositories, or browser console logs.
Authentication
Include your API key in the X-API-Key header of every request:
curl https://api.faqsure.io/api/v1/chat \
-H "X-API-Key: faqsure_sk_..." \
-H "Content-Type: application/json" \
-d '{"message": "What is your return policy?"}'Send a Chat Message
POST /api/v1/chat
X-API-Key: faqsure_sk_...
Content-Type: application/jsonRequest:
{
"message": "What is your return policy?",
"conversation_id": "uuid (optional — omit to start a new conversation)",
"agent_id": "uuid (optional — uses default agent if omitted)",
"use_rag": true,
"top_k": 5,
"similarity_threshold": 0.7
}Response:
{
"conversation_id": "550e8400-e29b-41d4-a716-446655440000",
"message": "Our return policy allows returns within 30 days of purchase...",
"sources": [
{
"chunk_id": "uuid",
"text": "Returns within 30 days...",
"similarity_score": 0.92,
"document_filename": "return-policy.pdf"
}
],
"confidence": 0.92,
"fallback_triggered": false,
"tokens_used": {
"prompt": 150,
"completion": 200,
"total": 350
},
"processing_time_ms": 1245
}Search Your Knowledge Base
POST /api/v1/search
X-API-Key: faqsure_sk_...
Content-Type: application/jsonRequest:
{
"query": "How do I reset my password?",
"top_k": 5,
"similarity_threshold": 0.7,
"use_hybrid": false
}Response:
{
"results": [
{
"chunk_id": "uuid",
"text": "To reset your password: 1. Click Forgot Password...",
"similarity_score": 0.95,
"document_filename": "help.pdf",
"metadata": {"section": "Account Settings"}
}
],
"count": 1,
"processing_time_ms": 234
}Upload a Document
POST /api/v1/documents/upload
X-API-Key: faqsure_sk_...
Content-Type: multipart/form-datacurl https://api.faqsure.io/api/v1/documents/upload \
-H "X-API-Key: faqsure_sk_..." \
-F "file=@policies.pdf"Response:
{
"id": "uuid",
"filename": "policies.pdf",
"status": "processing"
}Error Responses
| Status | Error | Meaning |
|---|---|---|
401 | invalid_api_key | Key is missing or invalid |
402 | insufficient_balance | Token balance depleted |
429 | rate_limit_exceeded | Too many requests |
Rate limit exceeded (429):
{
"error": "rate_limit_exceeded",
"message": "60 requests per minute limit exceeded",
"limit_per_minute": 60,
"limit_per_hour": 1000
}Key Endpoints
| Method | Endpoint | Description |
|---|---|---|
POST | /api/v1/chat | Send a chat message |
POST | /api/v1/search | Search the knowledge base |
POST | /api/v1/documents/upload | Upload a document |
GET | /api/v1/documents | List all documents |
GET | /api/v1/chat/conversations | List conversations |
GET | /api/v1/analytics/dashboard | Dashboard stats |