For Developers
Embed AI-powered answers directly in your website, app, or internal tool. Simple REST API. API key authentication. JSON in, JSON out.
Include the X-API-Key header in every request.
POST a question, receive an AI-powered answer grounded in your corpus.
curl -X POST https://ai.bluenotelogic.com/api/v2/chat.php \
-H "Content-Type: application/json" \
-H "X-API-Key: bnl_your_api_key" \
-d '{"message": "What is our return policy?"}'
All API requests require an X-API-Key header. Keys are unique to your account and scoped to your corpus.
Prefixed for Identification
All keys start with bnl_ so you can easily identify them in your code and config files.
Hashed on Our Servers
Keys are hashed (SHA-256) at rest. We never store them in plaintext. If you lose your key, generate a new one.
Generate & Revoke from Dashboard
Manage your keys from the platform dashboard. Revoke compromised keys instantly.
X-API-Key: bnl_sk_abc123def456...
Base URL: https://ai.bluenotelogic.com
/api/v2/chat.php
AI Chat
Ask a question and get an AI-powered answer from your document corpus. The response includes the generated answer, source citations, model information, and performance metrics.
message
The question to ask your AI assistant.
use_corpus
Whether to search your document corpus for context. Set to false for general AI chat.
model
Specific model to use for generation. Defaults to the best available model.
answer
The AI-generated answer grounded in your documents.
model
The model used for generation (e.g. "qwen2.5:72b").
sources
Source documents referenced in the answer, with title and relevance score.
response_time_ms
Total processing time in milliseconds.
tokens_used
Number of tokens consumed by the request.
# Request
curl -X POST https://ai.bluenotelogic.com/api/v2/chat.php \
-H "Content-Type: application/json" \
-H "X-API-Key: bnl_sk_abc123def456" \
-d '{
"message": "What is our return policy?",
"use_corpus": true
}'
# Response
{
"answer": "According to your Terms of Service (Section 7.1), customers may request a full refund within 14 days of purchase, provided the product has not been downloaded or activated. Refund requests should be submitted through the customer portal.",
"model": "qwen2.5:72b",
"sources": [
{
"title": "terms-of-service-v3.2.pdf",
"score": 0.94,
"excerpt": "Section 7.1 — Refund Policy: Customers are entitled to..."
}
],
"response_time_ms": 2340,
"tokens_used": 847
}
$ch = curl_init('https://ai.bluenotelogic.com/api/v2/chat.php');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-API-Key: bnl_your_api_key',
],
CURLOPT_POSTFIELDS => json_encode([
'message' => 'What is our return policy?',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
echo $response['answer'];
/api/v2/search.php
Semantic Search
Search your document corpus for relevant chunks using semantic vector search. Returns ranked results with relevance scores, document titles, and text excerpts. Useful for building custom search interfaces or pre-filtering before chat.
query
The search query in natural language.
top_k
Number of results to return.
results
Matching document chunks, each with title, score, excerpt, and document_id.
query_time_ms
Vector search time in milliseconds.
# Request
curl -X POST https://ai.bluenotelogic.com/api/v2/search.php \
-H "Content-Type: application/json" \
-H "X-API-Key: bnl_sk_abc123def456" \
-d '{
"query": "employee onboarding process",
"top_k": 3
}'
# Response
{
"results": [
{
"title": "hr-onboarding-guide.pdf",
"score": 0.92,
"excerpt": "New employees must complete the following steps within their first week: security badge activation, IT setup request, and mandatory compliance training...",
"document_id": 142
},
{
"title": "employee-handbook-2025.pdf",
"score": 0.87,
"excerpt": "The onboarding period spans 90 days. During this time, the new hire will be assigned a mentor from their department...",
"document_id": 98
},
{
"title": "it-setup-checklist.docx",
"score": 0.81,
"excerpt": "IT provisioning for new employees includes: email account, VPN access, development environment setup, and Slack workspace invitation...",
"document_id": 205
}
],
"query_time_ms": 45
}
/api/v2/documents.php
Document Management
Upload, list, and delete documents in your corpus programmatically. Use this endpoint to integrate document management into your own workflows and automation pipelines.
Returns all documents in your corpus with metadata including title, upload date, chunk count, and status.
{"action": "list"}
Upload a new document to your corpus. Uses multipart/form-data. Supported formats: PDF, DOCX, TXT, HTML.
multipart/form-data
Remove a document and all its chunks from your corpus. This action is irreversible.
{"action": "delete", "document_id": 142}
curl -X POST https://ai.bluenotelogic.com/api/v2/documents.php \
-H "Content-Type: application/json" \
-H "X-API-Key: bnl_sk_abc123def456" \
-d '{"action": "list"}'
# Response
{
"documents": [
{
"id": 142,
"title": "hr-onboarding-guide.pdf",
"chunks": 24,
"uploaded_at": "2026-03-01T10:30:00Z",
"status": "ready"
},
{
"id": 98,
"title": "employee-handbook-2025.pdf",
"chunks": 87,
"uploaded_at": "2026-02-15T14:22:00Z",
"status": "ready"
}
],
"total": 2
}
curl -X POST https://ai.bluenotelogic.com/api/v2/documents.php \
-H "X-API-Key: bnl_sk_abc123def456" \
-F "action=upload" \
-F "file=@/path/to/document.pdf"
# Response
{
"success": true,
"document_id": 210,
"title": "document.pdf",
"chunks": 15,
"message": "Document uploaded and processed successfully."
}
The API uses standard HTTP status codes. Errors return a JSON object with a human-readable message and a machine-readable code.
{
"error": "Rate limit exceeded",
"code": "RATE_LIMIT",
"retry_after": 3600
}
{
"error": "Invalid or missing API key",
"code": "UNAUTHORIZED"
}
{
"error": "The 'message' field is required",
"code": "VALIDATION_ERROR"
}
Rate limits are enforced per API key on a monthly billing cycle. Every API response includes headers so you can track your usage in real time.
X-RateLimit-Limit
Total requests allowed in the current billing period.
X-RateLimit-Remaining
Requests remaining in the current billing period.
X-RateLimit-Reset
Unix timestamp when the rate limit resets (start of next billing period).
HTTP/1.1 200 OK
Content-Type: application/json
X-RateLimit-Limit: 2000
X-RateLimit-Remaining: 1847
X-RateLimit-Reset: 1743465600
Chat requests
Each call to /api/v2/chat.php counts as 1 request.
Search requests
Each call to /api/v2/search.php counts as 1 request.
Document management
List, upload, and delete operations are free and do not count against your limit.
Failed requests
Requests that return 4xx/5xx errors are not counted against your limit.
Get your API key and start building. Three lines of code to AI-powered answers from your own documents.