API documentation
Programmatic access to agricultural advisory data. Public point endpoints require no authentication and return JSON with location metadata and recommendations.
Overview
The AgWise API is built on R Plumber and provides endpoints for yield predictions, fertilizer recommendations, integrated soil fertility management (ISFM), and forage suitability assessments.
Production base URL
https://api.agwise.orgLocal development
https://api.agwise.orgPublic point endpoints do not require authentication. Authenticated endpoints (registration, history, polygon advisories) are available after login via the dashboard workflow.
Public point endpoints
Accept parameters via JSON body or URL query string. All return JSON.
/advisory/yield/pointGet yield predictions for a specific point location and crop.
Parameters
- lat — Latitude in decimal degrees (required)
- lng — Longitude in decimal degrees (required)
- crop — Crop name — e.g. "wheat" (optional, default: "wheat")
- country_code — Country code — eth, rwa, ken, gha (optional, default: eth)
- name — Location label (optional, default: "Point")
JSON body
POST /advisory/yield/point
{"lat": 9.5, "lng": 40.5, "crop": "wheat", "country_code": "eth", "name": "My Farm"}Query parameters
POST /advisory/yield/point?lat=9.5&lng=40.5&crop=wheat&country_code=eth&name=My%20Farm
Example response
{"location": {"name": "My Farm", "lat": 9.5, "lng": 40.5, "type": "point"}, "forecast_period": "July 2022", "yield_data": [{"scenario": "Above Normal", "yield_kg_ha": 4500}, {"scenario": "Normal", "yield_kg_ha": 4000}]}/advisory/fertilizer/pointGet inorganic fertilizer recommendations for a point location.
Parameters
- lat — Latitude in decimal degrees (required)
- lng — Longitude in decimal degrees (required)
- crop — Crop name — e.g. "wheat" (optional, default: "wheat")
- country_code — Country code — eth, rwa, ken, gha (optional, default: eth)
- name — Location label (optional, default: "Point")
JSON body
POST /advisory/fertilizer/point
{"lat": 9.5, "lng": 40.5, "crop": "wheat", "country_code": "eth"}Example response
{"location": {"lat": 9.5, "lng": 40.5}, "fertilizer_data": [{"fertilizer_type": "Urea", "scenario": "Normal", "rate_kg_ha": 130}]}/advisory/isfm/pointGet integrated soil fertility management (organic input) recommendations.
Parameters
- lat — Latitude in decimal degrees (required)
- lng — Longitude in decimal degrees (required)
- crop — Crop name — e.g. "wheat" (optional, default: "wheat")
- country_code — Country code — eth, rwa, ken, gha (optional, default: eth)
- name — Location label (optional, default: "Point")
JSON body
POST /advisory/isfm/point
{"lat": 9.5, "lng": 40.5, "crop": "wheat", "country_code": "eth"}Example response
{"isfm_data": [{"isfm_type": "Compost", "scenario": "Normal", "rate_tons_ha": 5.0}]}/advisory/forage/pointGet forage suitability scores for a point location.
Parameters
- lat — Latitude in decimal degrees (required)
- lng — Longitude in decimal degrees (required)
- country_code — Country code — eth, rwa, ken, gha (optional, default: eth)
- name — Location label (optional, default: "Point")
JSON body
POST /advisory/forage/point
{"lat": 9.5, "lng": 40.5, "country_code": "eth"}Example response
{"forage_data": [{"forage_variety": "Avena sativa", "suitability_score": 85.5}]}Available crops by country
- Ethiopia (eth): wheat
- Rwanda (rwa): potato
- Kenya (ken): forage only
- Ghana (gha): forage only
Error handling
- 200 OK — successful request
- 400 Bad Request — missing or invalid parameters
- 404 Not Found — resource not found
- 500 Internal Server Error — server processing error
Error response format:
{"error": "Invalid admin0 parameter. Country not found in database."}Authenticated endpoints
Available after login (Bearer token):
POST /auth/login
POST /auth/register
POST /validate_location
GET /admin?admin0={country}&level={1|2|3}
POST /advisory/yield
POST /advisory/fertilizer
GET /stats
GET /history/my
GET /user/profile
POST /history/{id}/feedbackSupport
For technical support or API questions, contact EIA@cgiar.org or visit the contact page.
Rate limiting: none currently enforced. Please use the API responsibly.