HomeDemoAPIDocsPilotResearchAboutNews

API reference

Integrate credit scoring into your platform

The AfriScore API accepts alternative data fields and returns a calibrated credit score, risk tier, recommended loan terms, and SHAP explainability — designed for sub-200ms response times in production.

Quickstart

Your first API call, illustrated below. Live keys are issued after pilot onboarding.

curl -X POST https://afriscore-site.vercel.app/api/v1/score \
  -H "Authorization: Bearer $AFRISCORE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mm_months": 18,
    "avg_inflow": 1200,
    "avg_outflow": 950,
    "avg_balance": 450,
    "balance_stability": 0.65,
    "counterparties": 12,
    "tx_frequency": 38,
    "weekend_activity": 0.28,
    "airtime_avg": 8,
    "airtime_freq": 6,
    "airtime_regularity": 0.82,
    "device_type": "smartphone",
    "device_age_months": 14,
    "requested_amount": 300,
    "requested_term_days": 90,
    "loan_purpose": "business",
    "region": "central_africa"
  }'

Authentication

All requests require a Bearer token in the Authorization header.

Authorization: Bearer afriscore_live_xxxxxxxxxxxxxxxxxxxxxxxx

Test Keys

afriscore_test_Rate-limited, synthetic-calibrated scores only — for development and integration testing.

Live Keys

afriscore_live_Issued after pilot calibration. Full rate limits and production SLAs apply.

Endpoints

POST/v1/score

Submit an application for scoring. Returns score, tier, recommendation, and SHAP contributions.

200 OK
{
  "score": 742,
  "tier": "A",
  "default_probability": 0.02,
  "decision": "APPROVED",
  "recommended_limit": 5000,
  "recommended_term_days": 365,
  "recommended_apr": 12.0,
  "shap_values": [
    { "feature": "balance_stability", "contribution": 0.18 },
    { "feature": "avg_inflow", "contribution": 0.15 }
  ],
  "request_id": "req_abc123",
  "processing_ms": 187
}
POST/v1/explain

Returns SHAP values and counterfactual explanations without storing the request.

{
  "shap_values": [ ... ],
  "counterfactuals": [
    {
      "feature": "balance_stability",
      "current_value": 0.45,
      "target_value": 0.60,
      "score_gain": 32
    }
  ]
}
GET/v1/health

Check API status. No authentication required.

{
  "status": "healthy",
  "version": "1.1.0",
  "uptime_seconds": 2592000
}

Error Handling

Standard HTTP status codes with a structured error body.

400 — Bad Request

Missing required fields or invalid data types.

401 — Unauthorized

Invalid or expired API key.

429 — Rate Limited

Rate limit exceeded — see the Retry-After header.

500 — Internal Error

Internal error. All 500s are logged and alerted on immediately.

Rate Limits

Test Key
100 / day
Synthetic-calibrated scores only
Live Key
10,000 / hr
Production-calibrated, full SLA
Enterprise
Unlimited
Custom deployment, dedicated cluster

Self-Hosting

The engine is designed to be containerized for institutions with data residency requirements. Full deployment guides are on the roadmap alongside the first pilot integration.

Try It

This is a client-side simulation using the same illustrative model as the Demo page — for live API access, apply for the pilot.

{ }