Back to docs

REST API

Score any UK or EU SME via a single HTTPS call. Available on Team tier.

Base URL

https://api.agentcredit.net

Until the production host is live, the development sandbox runs athttp://localhost:8000when you run the scoring engine locally.

Authentication

Every request must include your personal API key (generated from Account Settings → API Keys, coming soon):

Authorization: Bearer ak_live_…

Keys are scoped per-user. Never expose them in client-side code. Rotate immediately from the dashboard if a key leaks.

Quickstart: run your first assessment

curl https://api.agentcredit.net/api/v1/scoring/score \
  -H "Authorization: Bearer ak_live_…" \
  -H "Content-Type: application/json" \
  -d '{
    "borrower_id": "B-test-1",
    "financials": {
      "total_assets": 5000000,
      "current_assets": 2000000,
      "total_liabilities": 2500000,
      "current_liabilities": 1000000,
      "total_equity": 2500000,
      "revenue": 8000000,
      "ebit": 600000,
      "net_income": 400000
    },
    "borrower_info": {
      "industry_code": "62020",
      "country_code": "GB",
      "years_in_business": 5
    },
    "loan_amount": 1500000,
    "collateral_value": 800000
  }'

Returns a JSON body with the full ensemble breakdown:

{
  "borrower_id": "B-test-1",
  "composite_pd": 0.021,
  "composite_score": 712,
  "risk_grade": "A-",
  "risk_rating": "Low",
  "scorecard_result": { "score": 705, "pd": 0.024, "features": [ ... ] },
  "ml_result":        { "pd": 0.019, "feature_importances": [ ... ] },
  "z_score_result":   { "z_score": 3.2, "zone": "safe" },
  "expected_loss":    4250.0,
  "data_completeness_grade": "full",
  "peer_comparison": [ ... ]
}

Core endpoints

MethodPathPurpose
POST/api/v1/scoring/scoreRun a full ensemble assessment
GET/api/v1/scoring/recentList your recent assessments
GET/api/v1/scoring/score/{borrower_id}Retrieve a specific assessment
POST/api/v1/credit-report/generateGenerate an AI narrative report (Team tier+)
GET/api/v1/scoring/reference/sicUK SIC 2007 code reference data

Interactive reference

The full OpenAPI schema with request/response examples and an in-browser “Try it now” console is auto-generated by FastAPI and hosted at:

https://api.agentcredit.net/docs

Available once the production host is live. In the meantime, run the scoring engine locally with python -m main and browse http://localhost:8000/docs.

Rate limits

  • Free: no API access
  • Team: 150 assessments / month, 10 requests / second
  • Need more? Email [email protected]

Exceeding the per-second rate returns 429 Too Many Requests. Exceeding the monthly quota returns 402 Payment Required.

Errors

All errors return a standard JSON envelope:

{ "error": "Invalid industry_code: 12345 is not a UK SIC 2007 code" }

Common status codes:

  • 400 — validation error (missing field, bad value)
  • 401 — missing or invalid API key
  • 402 — monthly quota exhausted
  • 403 — feature not available on your plan
  • 429 — rate limit exceeded
  • 500 — scoring engine error (please report)