opafire

Developers

A JSON API that returns two risk scores, risk grades and reason codes for an agent's loan application.

Start here

The quickstart walks through your first score in curl, Python and JavaScript, how to read the result, and how to report outcomes. The API reference lists every field.

Quickstart

Your first score in a few minutes.

API reference

Every field, type and error, from the OpenAPI schema.

Basics

  • Base URL: https://api.opafire.com
  • Send your key on every request as Authorization: Bearer <key>, from your server only. The API is server-to-server (no CORS).
  • Test keys start with opa_test_: they score normally and store nothing. Live keys start with opa_live_ and store each score, so you can report outcomes later.
  • Don't have the on-chain fields? Send the agent's wallet addresses in an autofill block and the API reads its stablecoin activity on Robinhood Chain, Base and Ethereum, and checks it against the US Treasury's OFAC sanctions list, before scoring.
  • Only three fields are required: agent.agent_id, loan.amount_usd and loan.term_days. Leaving out an optional field is fine; sending one incorrectly returns an error naming the exact field.
  • Every response carries model_version and an input_hash, so you can audit exactly which model scored exactly which input.

To get keys, email hello@opafire.com.

Endpoints

MethodPathWhat it does
POST/v1/scoreScore one application
POST/v1/score/batchScore up to 100 applications in one request
POST/v1/outcomesReport how a scored loan turned out
GET/v1/modelThe model version, configuration and reason codes
GET/v1/healthService health

Example

curl -s https://api.opafire.com/v1/score \
  -H "Authorization: Bearer $OPAFIRE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "agent": {
    "agent_id": "solid_new_verified",
    "identity_verification": "registry_verified",
    "owner_type": "company",
    "owner_verified": true,
    "owner_guarantee_usd": 0,
    "deployment_age_days": 60
  },
  "onchain": {
    "wallet_age_days": 60,
    "tx_count_90d": 120,
    "unique_counterparties_90d": 40,
    "self_transfer_ratio_90d": 0.05,
    "monthly_inflow_usd": [
      4800,
      5200
    ],
    "largest_single_inflow_share_90d": 0.3,
    "inflow_last_7d_usd": 1200,
    "defi_liquidations_count": 0,
    "mixer_exposure": false,
    "sanctions_hit": false,
    "fraud_flag": false
  },
  "credit_history": {
    "source": "lender_reported",
    "prior_loans": []
  },
  "controls": {
    "collateral": [],
    "spending_limit_configured": true,
    "lender_can_auto_collect": true,
    "kill_switch_available": true
  },
  "loan": {
    "amount_usd": 2000,
    "term_days": 30,
    "currency": "USDC",
    "application_id": "demo-0001"
  }
}'
{
  "score": 576,
  "grade": "K5",
  "agent_score": 632,
  "agent_grade": "K4",
  "guidance": "review",
  "guidance_note": "Non-binding guidance. The lender makes the final lending decision.",
  "confidence": "medium",
  "suggested_max_loan_usd": 894.0,
  "target_grade": "K4",
  "reason_codes": {
    "negative": [
      {
        "code": "THIN_HISTORY",
        "factor": "repayment_history",
        "impact_points": -132,
        "message": "The agent has little or no record of repaying loans.",
        "applies_to": "both"
      }
    ],
    "positive": [
      "..."
    ]
  },
  "model_version": "kynes-v1.0",
  "application_id": "demo-0001"
}