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
Score a loan application
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
| Field | Type | Description |
|---|---|---|
| loan.type | string | Required. crop, equipment, or allied. Each loan type is scored by a model tuned to its risk drivers. |
| loan.amount_inr | number | Required. Principal in INR (1,000 – 100,000,000). |
| loan.tenor_months | number | Required. 1 – 120. |
| parcel.lat, parcel.lng | number | Required. Parcel centroid in decimal degrees. Current coverage: India. |
| parcel.area_hectares | number | Required. Cultivated area under the applicant. |
| parcel.state | string | Optional. |
| crop.name | string | Required for crop loans. See supported crops. |
| crop.season | string | Optional. kharif, rabi, zaid, or perennial. |
| farmer_ref | string | Optional. 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
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
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.
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_json | Body could not be parsed as JSON. |
| 401 | unauthorized | Missing or invalid API key. |
| 405 | method_not_allowed | Wrong HTTP method for the endpoint. |
| 422 | validation_failed | See 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.