API Reference

Base URL: https://api.example.com
Authentication: X-API-Key header on all endpoints except /health.

Train a model

POST/train

Train a new classifier from labeled data.

Request body

FieldTypeRequiredDescription
model_idstringYesUnique identifier for the model
Xfloat[][]YesTraining samples, shape (n_samples, n_features)
ystring[]YesClass labels, length n_samples
rule_purityfloatNoMinimum rule purity. Default: 1.0
online_correctionboolNoApply online correction. Default: true
recover_undeterminedboolNoRecover UNDETERMINED via evidence escalation. Default: true

Response

{
  "model_id": "my_model",
  "n_classes": 3,
  "classes": ["setosa", "versicolor", "virginica"],
  "status": "trained"
}

Errors

StatusCause
401Invalid API key
429Model limit or training sample limit exceeded

Predict

POST/predict

Get a typed prediction for one or more samples.

Request body

FieldTypeRequiredDescription
model_idstringYesModel to use for prediction
Xfloat[] or float[][]YesSingle sample (1D) or batch (2D)
costfloatNoCost ratio for action recommendation. Omit for no action field.

Response (single sample)

{
  "type": "CLASS",
  "class_": "setosa",
  "alternatives": [],
  "margin": 4,
  "support": 7,
  "total_evidence": 9,
  "action": "commit",
  "evidence": {
    "setosa":     {"support": 7, "against": 0},
    "versicolor": {"support": 3, "against": 4},
    "virginica":  {"support": 2, "against": 5}
  }
}

Response (batch)

Returns a JSON array of prediction objects, one per input sample.

Response fields

FieldTypeDescription
typestringCLASS, POSSIBILITIES, or UNDETERMINED
class_string | nullCommitted class (only when type is CLASS)
alternativesstring[]Possible classes (only when type is POSSIBILITIES)
marginintEvidence gap between top class and runner-up
supportintEvidence count for committed class
total_evidenceintTotal rules that fired
actionstring | nullcommit, narrow, or abstain (only if cost provided)
evidenceobject | nullPer-class support/against counts

Errors

StatusCause
401Invalid API key
404Model not found
429Monthly prediction limit exceeded

List models

GET/models

List all models for the authenticated user.

{
  "models": [
    {
      "model_id": "credit_risk_v2",
      "n_classes": 2,
      "classes": ["approve", "deny"],
      "created_at": "2026-03-15T14:30:00Z"
    }
  ]
}

Delete a model

DELETE/models/{model_id}

Delete a trained model and free the model slot.

{"status": "deleted", "model_id": "old_model"}

Check usage

GET/billing/usage

Get current month's usage and limits for the authenticated user.

{
  "tier": "free",
  "month": "2026-03",
  "predictions_used": 1247,
  "predictions_limit": 50000,
  "trains_used": 3
}

Health check

GET/health

No authentication required.

{"status": "ok", "version": "0.1.0"}

Rate limits

TierPredictions / monthModelsMax training samples
Free50,000550,000
Team ($49/mo)500,00020100,000
Business ($199/mo)2,000,0001001,000,000
EnterpriseUnlimitedUnlimitedUnlimited

When a limit is exceeded, the API returns 429 Too Many Requests with a message indicating which limit was hit and how to upgrade.