Back to ResourcesDeveloper reference

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.org

Local development

https://api.agwise.org

Public 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.

POST/advisory/yield/point

Get yield predictions for a specific point location and crop.

Parameters

  • latLatitude in decimal degrees (required)
  • lngLongitude in decimal degrees (required)
  • cropCrop name — e.g. "wheat" (optional, default: "wheat")
  • country_codeCountry code — eth, rwa, ken, gha (optional, default: eth)
  • nameLocation 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}]}
POST/advisory/fertilizer/point

Get inorganic fertilizer recommendations for a point location.

Parameters

  • latLatitude in decimal degrees (required)
  • lngLongitude in decimal degrees (required)
  • cropCrop name — e.g. "wheat" (optional, default: "wheat")
  • country_codeCountry code — eth, rwa, ken, gha (optional, default: eth)
  • nameLocation 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}]}
POST/advisory/isfm/point

Get integrated soil fertility management (organic input) recommendations.

Parameters

  • latLatitude in decimal degrees (required)
  • lngLongitude in decimal degrees (required)
  • cropCrop name — e.g. "wheat" (optional, default: "wheat")
  • country_codeCountry code — eth, rwa, ken, gha (optional, default: eth)
  • nameLocation 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}]}
POST/advisory/forage/point

Get forage suitability scores for a point location.

Parameters

  • latLatitude in decimal degrees (required)
  • lngLongitude in decimal degrees (required)
  • country_codeCountry code — eth, rwa, ken, gha (optional, default: eth)
  • nameLocation 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}/feedback

Support

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.