Quickstart
Get your API key and make your first decision in 5 minutes.
1. Get Your API Key
Sign in to the Sparkient Dashboard and navigate to Settings → API Keys. Click Create API Key, give it a name, and copy the key.
Your API key is shown only once. Copy it and store it securely.
2. Create a Decision Type
A decision type defines what you're deciding. It specifies the possible outcomes, reason codes, and any hard rules.
curl -X POST https://api.sparkient.ai/api/v1/decision-types \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "content_moderation",
"description": "Should this user-generated content be approved?",
"options": ["approve", "flag", "reject"],
"reason_codes": ["safe_content", "borderline", "policy_violation", "spam"],
"rules": [
{
"name": "block_spam_links",
"condition": "ctx.link_count > 5",
"then": "reject",
"reason_code": "spam",
"priority": 1
}
]
}'3. Make a Decision
Now send an input to get a structured decision:
curl -X POST https://api.sparkient.ai/api/v1/decide \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"decision_type": "content_moderation",
"input": {
"text": "Check out this great new product!",
"link_count": 1,
"user_reputation_score": 0.85
}
}'Response
{
"decision": "approve",
"confidence": 0.92,
"reason_codes": ["safe_content"],
"latency_ms": 4.2,
"stage": "rules",
"escalate": false,
"rules_triggered": [],
"request_id": "req_abc123"
}4. Train a Model (Optional)
Rules handle the obvious cases. For nuanced decisions, train an ML model:
- Add training examples — via the dashboard or the API
- Generate synthetic data — Sparkient's teacher LLM creates additional examples
- Train — one API call triggers the full pipeline (feature engineering → model training → ONNX export)
- Deploy — promote the trained model to production
curl -X POST https://api.sparkient.ai/api/v1/decision-types/{id}/train \
-H "Authorization: Bearer YOUR_API_KEY"Once deployed, subsequent /decide calls automatically use the trained model for higher-quality decisions.
Verify Your Setup
You can verify your API connection by hitting the root endpoint:
curl https://api.sparkient.ai/{
"service": "Sparkient API",
"by": "Sparkient",
"version": "1.0.0",
"documentation": "https://docs.sparkient.ai",
"openapi": "/openapi.json",
"health": "/health"
}Next Steps
- Authentication — understand API keys vs Firebase JWT
- Decision Types — learn about options, rules, and versions
- Training Pipeline — how the teacher-student architecture works
- API Reference — full endpoint documentation