Complete guide for using the CrawlLama REST API.
Windows:
run_api.bat
Linux/macOS:
./run_api.sh
Or manually:
uvicorn app:app --host 0.0.0.0 --port 8000
Set your API key in .env:
CRAWLLAMA_API_KEY=your-secret-key-here
Include the API key in requests:
curl -H "X-API-Key: your-secret-key-here" http://localhost:8000/query
For testing without API key:
CRAWLLAMA_DEV_MODE=true
⚠️ Never use DEV_MODE in production!
http://localhost:8000
For production, use your deployed URL with HTTPS.
RATE_LIMIT in .envGET / - API Informationcurl http://localhost:8000/
Response:
{
"name": "CrawlLama API",
"version": "1.4.2",
"description": "AI-powered web research agent",
"docs": "/docs",
"health": "/health"
}
GET /health - Health Checkcurl http://localhost:8000/health
Response:
{
"status": "healthy",
"timestamp": "2025-10-26T15:30:00",
"version": "1.4.2",
"components": {
"agent": "healthy",
"multihop_agent": "healthy",
"memory_store": "healthy"
}
}
GET /stats - System Statisticscurl -H "X-API-Key: your-key" http://localhost:8000/stats
GET /security-info - Security Configurationcurl http://localhost:8000/security-info
POST /query - Submit QuerySimple Query:
curl -X POST http://localhost:8000/query \
-H "X-API-Key: your-key" \
-H "Content-Type: application/json" \
-d '{
"query": "What is Python?",
"use_tools": false
}'
With Web Search:
curl -X POST http://localhost:8000/query \
-H "X-API-Key: your-key" \
-H "Content-Type: application/json" \
-d '{
"query": "Latest AI developments 2025",
"use_tools": true
}'
Multi-Hop Reasoning:
curl -X POST http://localhost:8000/query \
-H "X-API-Key: your-key" \
-H "Content-Type: application/json" \
-d '{
"query": "Compare Python vs JavaScript for web development",
"use_multihop": true,
"max_hops": 3
}'
Request Parameters:
query (string, required): Search queryuse_tools (boolean): Enable web search (default: true)use_multihop (boolean): Use multi-hop reasoning (default: false)max_hops (integer): Maximum reasoning hops, 1-5 (default: 3)Response:
{
"answer": "Python is a high-level programming language...",
"confidence": 0.92,
"steps": 3,
"search_queries": ["python programming", "python features"],
"reasoning_path": ["Define Python", "List features", "Conclude"],
"elapsed_time": 2.45,
"cached": false
}
Store and retrieve OSINT findings persistently.
POST /memory/remember - Store Datacurl -X POST http://localhost:8000/memory/remember \
-H "X-API-Key: your-key" \
-H "Content-Type: application/json" \
-d '{
"category": "email",
"value": "contact@example.com"
}'
Supported Categories:
email / emailsphone / phonesip / ipsusername / usernamesdomain / domainsnote / notesGET /memory/recall/{category} - Retrieve Datacurl -H "X-API-Key: your-key" \
http://localhost:8000/memory/recall/emails
Response:
{
"status": "success",
"category": "emails",
"count": 3,
"results": [
{
"value": "contact@example.com",
"added_at": "2025-10-26T15:30:00",
"metadata": {}
}
]
}
GET /memory/stats - Memory Statisticscurl -H "X-API-Key: your-key" \
http://localhost:8000/memory/stats
DELETE /memory/forget - Delete DataDelete specific value:
curl -X DELETE http://localhost:8000/memory/forget \
-H "X-API-Key: your-key" \
-H "Content-Type: application/json" \
-d '{
"category": "email",
"value": "contact@example.com"
}'
Clear entire category:
curl -X DELETE http://localhost:8000/memory/forget \
-H "X-API-Key: your-key" \
-H "Content-Type: application/json" \
-d '{
"category": "emails"
}'
Clear all memory:
curl -X DELETE http://localhost:8000/memory/forget \
-H "X-API-Key: your-key" \
-H "Content-Type: application/json" \
-d '{
"category": "all"
}'
GET /cache/stats - Cache Statisticscurl -H "X-API-Key: your-key" \
http://localhost:8000/cache/stats
POST /cache/clear - Clear Cachecurl -X POST http://localhost:8000/cache/clear \
-H "X-API-Key: your-key"
POST /session/save - Save Sessioncurl -X POST http://localhost:8000/session/save \
-H "X-API-Key: your-key"
POST /session/load - Load Sessioncurl -X POST http://localhost:8000/session/load \
-H "X-API-Key: your-key"
POST /session/clear - Clear Sessioncurl -X POST http://localhost:8000/session/clear \
-H "X-API-Key: your-key"
GET /config - Get Configurationcurl -H "X-API-Key: your-key" \
http://localhost:8000/config
Response: (Sensitive values redacted)
{
"status": "success",
"data": {
"llm": {
"model": "qwen3:4b",
"temperature": 0.7
},
"search": {
"brave_api_key": "***REDACTED***"
}
},
"note": "Sensitive values are redacted for security"
}
PATCH /config - Update Configurationcurl -X PATCH http://localhost:8000/config \
-H "X-API-Key: your-key" \
-H "Content-Type: application/json" \
-d '{
"category": "llm",
"key": "temperature",
"value": 0.8
}'
⚠️ Note: API restart required for changes to take effect.
GET /context/status - Context Manager Statuscurl -H "X-API-Key: your-key" \
http://localhost:8000/context/status
GET /plugins - List Pluginscurl -H "X-API-Key: your-key" \
http://localhost:8000/plugins
Response:
{
"available": ["example_plugin"],
"loaded": ["example_plugin"],
"count": {
"available": 1,
"loaded": 1
}
}
POST /plugins/{plugin_name}/load - Load Plugincurl -X POST http://localhost:8000/plugins/example_plugin/load \
-H "X-API-Key: your-key"
POST /plugins/{plugin_name}/unload - Unload Plugincurl -X POST http://localhost:8000/plugins/example_plugin/unload \
-H "X-API-Key: your-key"
GET /tools - List Toolscurl -H "X-API-Key: your-key" \
http://localhost:8000/tools
POST /osint/query - OSINT Query with OperatorsEmail Search:
curl -X POST http://localhost:8000/osint/query \
-H "X-API-Key: your-key" \
-H "Content-Type: application/json" \
-d '{
"query": "email:contact@example.com"
}'
Phone Search:
curl -X POST http://localhost:8000/osint/query \
-H "X-API-Key: your-key" \
-H "Content-Type: application/json" \
-d '{
"query": "phone:+1234567890"
}'
IP Lookup:
curl -X POST http://localhost:8000/osint/query \
-H "X-API-Key: your-key" \
-H "Content-Type: application/json" \
-d '{
"query": "ip:192.168.1.1"
}'
Supported Operators:
email: - Email address lookupphone: - Phone number lookupip: - IP address lookupdomain: - Domain informationusername: - Username search{
"detail": "Invalid or missing API key",
"type": "HTTPException"
}
import requests
API_URL = "http://localhost:8000"
API_KEY = "your-secret-key"
headers = {
"X-API-Key": API_KEY,
"Content-Type": "application/json"
}
# Simple query
response = requests.post(
f"{API_URL}/query",
headers=headers,
json={
"query": "What is machine learning?",
"use_tools": True
}
)
result = response.json()
print(f"Answer: {result['answer']}")
print(f"Time: {result['elapsed_time']}s")
# Remember email
requests.post(
f"{API_URL}/memory/remember",
headers=headers,
json={
"category": "email",
"value": "test@example.com"
}
)
# Recall emails
response = requests.get(
f"{API_URL}/memory/recall/emails",
headers=headers
)
emails = response.json()
print(f"Found {emails['count']} emails")
const axios = require('axios');
const API_URL = 'http://localhost:8000';
const API_KEY = 'your-secret-key';
const headers = {
'X-API-Key': API_KEY,
'Content-Type': 'application/json'
};
// Query with multi-hop reasoning
async function query() {
const response = await axios.post(`${API_URL}/query`, {
query: "Compare Python vs JavaScript",
use_multihop: true,
max_hops: 3
}, { headers });
console.log('Answer:', response.data.answer);
console.log('Steps:', response.data.steps);
console.log('Confidence:', response.data.confidence);
}
// Get cache stats
async function getCacheStats() {
const response = await axios.get(`${API_URL}/cache/stats`, { headers });
console.log('Cache Stats:', response.data);
}
query();
getCacheStats();
Health check (no auth):
curl http://localhost:8000/health
Query with web search:
curl -X POST http://localhost:8000/query \
-H "X-API-Key: your-key" \
-H "Content-Type: application/json" \
-d '{"query": "Latest Python news", "use_tools": true}'
Multi-hop reasoning:
curl -X POST http://localhost:8000/query \
-H "X-API-Key: your-key" \
-H "Content-Type: application/json" \
-d '{"query": "Explain quantum computing", "use_multihop": true}'
Store and retrieve memory:
# Store
curl -X POST http://localhost:8000/memory/remember \
-H "X-API-Key: your-key" \
-H "Content-Type: application/json" \
-d '{"category": "email", "value": "contact@example.com"}'
# Retrieve
curl -H "X-API-Key: your-key" \
http://localhost:8000/memory/recall/emails
secrets.token_urlsafe(32)# Required
CRAWLLAMA_API_KEY=your-secret-key-here
# Optional
RATE_LIMIT=60
ALLOWED_ORIGINS=http://localhost:3000,https://yourdomain.com
ALLOWED_HOSTS=localhost,127.0.0.1,yourdomain.com
CRAWLLAMA_DEV_MODE=false
# Search APIs (optional)
BRAVE_API_KEY=your-brave-key
SERPER_API_KEY=your-serper-key
config.json is validX-API-Key headerCRAWLLAMA_DEV_MODE=true for testingRATE_LIMIT in .envLast Updated: October 26, 2025
Version: 1.4.2