API Reference

The AgriBase API returns a parcel-level risk assessment for an agricultural loan application in a single call. It's designed to sit alongside your existing bureau pull: one request at origination, one score back.

Base URL: https://agribase.co/api/v1

Authentication

Every request requires an API key, passed either as a bearer token or an X-Api-Key header. Production keys are provisioned per institution during onboarding. The sandbox key below works now, against the demo scoring environment:

Authorization: Bearer agb_demo_7f3c91d24aeb
Sandbox environment. Sandbox responses use the production request and response contract. Scores are served by a gradient-boosted model (out-of-time validated) trained on a synthetic reference loan book over synthesized parcel features — production models are trained on partner repayment outcomes and live satellite data. Scores are deterministic: the same parcel and loan always return the same result, so you can build and test your integration end-to-end before go-live.

Score a loan application

POST /api/v1/score

Takes the loan, the parcel, and (for crop loans) the crop being financed. Returns a 300–900 score, a probability of default over the loan tenor, the top drivers behind the decision, and the underlying parcel assessment.

Request body

FieldTypeDescription
loan.typestringRequired. crop, equipment, or allied. Each loan type is scored by a model tuned to its risk drivers.
loan.amount_inrnumberRequired. Principal in INR (1,000 – 100,000,000).
loan.tenor_monthsnumberRequired. 1 – 120.
parcel.lat, parcel.lngnumberRequired. Parcel centroid in decimal degrees. Current coverage: India.
parcel.area_hectaresnumberRequired. Cultivated area under the applicant.
parcel.statestringOptional.
crop.namestringRequired for crop loans. See supported crops.
crop.seasonstringOptional. kharif, rabi, zaid, or perennial.
farmer_refstringOptional. Your internal applicant reference, echoed back in the response.

Example request

curl -s https://agribase.co/api/v1/score \
  -H "Authorization: Bearer agb_demo_7f3c91d24aeb" \
  -H "Content-Type: application/json" \
  -d '{
    "loan":   { "type": "crop", "amount_inr": 150000, "tenor_months": 12 },
    "parcel": { "lat": 18.5204, "lng": 73.8567, "area_hectares": 1.6 },
    "crop":   { "name": "wheat", "season": "rabi" },
    "farmer_ref": "APP-2026-00417"
  }'

Example response

{
  "request_id": "req_465e8f088bab4673aa68",
  "score": 669,
  "band": "C+",
  "default_probability": 0.1054,
  "confidence": 0.84,
  "drivers": [
    { "factor": "Location climate volatility", "impact_points": -27, "direction": "negative" },
    { "factor": "Irrigation access", "impact_points": -21, "direction": "negative" },
    { "factor": "Estimated yield vs district median", "impact_points": 9, "direction": "positive" },
    { "factor": "Rainfall vs 10-yr normal", "impact_points": 8, "direction": "positive" },
    { "factor": "Cropping intensity", "impact_points": -8, "direction": "negative" }
  ],
  "parcel_assessment": {
    "location": { "lat": 18.5204, "lng": 73.8567 },
    "area_hectares": 1.6,
    "vegetation": { "ndvi_mean": 0.65, "trend_5_seasons": 0.005 },
    "estimated_yield_percentile": 60,
    "water": {
      "irrigation_probability": 0.24,
      "soil_moisture_index": 0.79,
      "rainfall_deviation_pct": 4
    },
    "climate_volatility": 0.91,
    "cropping_intensity": 1.52,
    "seasons_observed": 10
  },
  "loan": { "type": "crop", "amount_inr": 150000, "tenor_months": 12 },
  "crop": { "name": "wheat", "season": "rabi" },
  "farmer_ref": "APP-2026-00417",
  "meta": {
    "model_version": "agribase-xgb-0.1.0-synth",
    "environment": "sandbox",
    "latency_ms": 1
  }
}

score is a bureau-style scale where higher is safer; default_probability is the model's estimate over the loan tenor; drivers shows the largest contributions to this decision in score points, suitable for credit memos and adverse-action reasoning.

Supported crops

GET /api/v1/crops

Returns the crops the scoring models currently recognize, with their typical seasons and accepted aliases. Applications with unrecognized crops are still scored, using reference-crop assumptions, and flagged with a warning.

Health

GET /api/v1/health

Unauthenticated liveness check. Returns API and model versions and serving region.

Errors

Errors return a JSON body with a stable code, a human-readable message, and the request_id to quote when contacting us. Validation failures list every failing field.

StatusCodeMeaning
400invalid_jsonBody could not be parsed as JSON.
401unauthorizedMissing or invalid API key.
405method_not_allowedWrong HTTP method for the endpoint.
422validation_failedSee error.details for per-field messages. Includes parcels outside current coverage (India).

Integration notes

The API is stateless and adds single-digit milliseconds of scoring latency; typical end-to-end response time is dominated by the network. CORS is enabled, but we recommend calling from your backend so your API key stays server-side. Scores are versioned via meta.model_version — pin your credit policy to a model version and we'll never change scoring under you without a version bump.

Ready to go beyond the sandbox? Get in touch — we're onboarding a small number of design-partner lenders.