Send one photo of a crop and get back a structured JSON diagnosis: the crop, its health status, the likely disease, and what to do about it. Try it below with your own image. You don't need a key for that.
The Image Analysis endpoint takes a single photo of a plant and returns a JSON object. The object says whether the image is usable, which crop it shows, whether the plant is healthy, and, if it isn't, the most likely disease with symptoms, preventive measures and treatment guidance.
Send one JPEG or PNG taken on a phone camera. No special hardware needed.
Disease names, symptoms and treatments come back in your farmer's language.
If a photo is too blurry or too far away, the response says so, so users can retake it.
Every request must include your API key as a Bearer token in the Authorization header. Requests without a valid key get a 401 Unauthorized response.
Authorization: Bearer YOUR_API_KEY
Keep your key secret. Call the API from your own server, not from a mobile app or browser, so the key never ships to end users. Don't have a key yet? Request API access.
Send the image as multipart/form-data.
| Header | Description |
|---|---|
| AuthorizationRequired | Bearer YOUR_API_KEY |
| Accept-LanguageOptional | Language for the disease information, as a code such as en or hi. See supported languages. Unsupported or missing values fall back to en. |
| Field | Type | Description |
|---|---|---|
| imageRequired | file | The plant photo. JPEG, PNG, WEBP or BMP, up to 10 MB. |
| application_used_image_galleryOptional | boolean | true if the user picked the image from their gallery, false if they took it with the camera. |
| application_idOptional | string | Your own identifier for the app or integration sending the request, e.g. my-farm-app-01. Up to 128 characters: letters, digits, . _ - :. |
| latitudeOptional | number | Where the photo was taken, in decimal degrees from -90 to 90, e.g. 12.9716. Send together with longitude. |
| longitudeOptional | number | Where the photo was taken, in decimal degrees from -180 to 180, e.g. 77.5946. Send together with latitude. |
This sandbox runs the same analysis as the API and shows the JSON response, so you can see the structure your integration will get. It's limited to a few requests per minute.
Sandbox preview. You'll see the crop, health status, diagnosis and image feedback. Detailed content (symptoms, triggers, preventive measures, treatments and reference images) shows as "Available with an API key". Request API access for complete responses.
A successfully processed image always returns 200 OK with the object below. If the photo can't be diagnosed (for example it's blurry or isn't a plant), you still get 200 OK, but crop_health is "unknown" and errors explains why. See Errors.
| Field | Type | Description |
|---|---|---|
| crop_health | string | healthy, unhealthy or unknown. |
| crops | string[] | The detected crop, e.g. ["tomato"]. Empty if the crop couldn't be identified. |
| predicted_diagnoses | object[] | The diagnosis. For a healthy plant this is [{"scientific_name": "Healthy"}]. For an unhealthy plant it holds the fields below. |
| common_name | string | Disease name in the requested language. |
| scientific_name | string | Scientific or reference name of the disease. |
| pathogen_class | string | The type of cause, one of fungi, bacteria, virus, insect, mite, deficiency, additional or others. |
| eppo_code | string | Standard EPPO code for the pest or disease, if one exists. |
| hosts | string[] | The crop the diagnosis applies to. |
| trigger | string | What causes the problem and the conditions that favour it. |
| symptoms | string | A full description of the symptoms. |
| symptoms_short | string[] | Short symptom bullet points, for list views. |
| preventive_measures | string[] | Steps to stop the problem from spreading or coming back. |
| treatment_chemical | string | Chemical control recommendations. |
| image_references | string[] | URLs of reference photos showing the disease. |
| diagnosis_likelihood | string | How confident the model is in this diagnosis: very_likely (90% or more), likely (75–90%) or possible (55–75%). Below 55% no diagnosis is returned. |
| treatment_organic green_diagnosis_id | string | Reserved for upcoming features. Don't rely on these values yet. |
| image_feedback | object | Quality check of the photo. |
| focus | string | null | good, mediocre or bad. null if not checked. |
| distance | string | null | good, mediocre, bad or very_bad. null if not checked. |
| errors | object[] | Empty on success. Otherwise each item has a type and a human-readable message. |
| green_trace_id | string | Unique ID of this request. Include it when you contact support. |
{
"crop_health": "unhealthy",
"crops": ["pepper"],
"predicted_diagnoses": [
{
"common_name": "Chilli Leaf Curl Virus",
"scientific_name": "CLCV",
"diagnosis_likelihood": "likely",
"hosts": ["pepper"],
"pathogen_class": "virus",
"eppo_code": "CHILCU",
"trigger": "Symptoms are caused by begomovirus, which is primarily transmitted through whiteflies...",
"symptoms": "Symptoms of Chilli Leaf Curl Virus are characterized by upward curling of leaf margins...",
"symptoms_short": [
"Upward curling of leaf margins.",
"Yellowing of veins.",
"Reduction of leaf size."
],
"preventive_measures": [
"Use the available plant-resistant species and extract seeds only from virus-free plants.",
"Ensure a weed-free field and surroundings."
],
"treatment_chemical": "Always consider an integrated approach with preventive measures...",
"treatment_organic": "need to fix",
"green_diagnosis_id": "need to fix",
"image_references": [
"https://storage.googleapis.com/hg-reference-images/reference/1a07d37f4e4ad24cbfdefa4836882f2c8812613e.jpg",
"https://storage.googleapis.com/hg-reference-images/reference/b46e31c3e4e5c0104600d7080939fe1331592036.jpg"
]
}
],
"image_feedback": { "focus": "good", "distance": "good" },
"errors": [],
"green_trace_id": "8c1f4b3e-6a2d-4f7e-9b1a-2d5e7c9f0a13"
}{
"crop_health": "healthy",
"crops": ["wheat"],
"predicted_diagnoses": [
{ "scientific_name": "Healthy" }
],
"image_feedback": { "focus": "good", "distance": "good" },
"errors": [],
"green_trace_id": "3f9a0c7d-51be-4c02-8e6f-7a4d2b1c9e55"
}{
"crop_health": "unknown",
"crops": [],
"predicted_diagnoses": [],
"image_feedback": { "focus": "bad", "distance": "good" },
"errors": [
{
"message": "Potential issues with the image were detected. Check the image_feedback object for more information.",
"type": "image_blurry"
}
],
"green_trace_id": "b27e6d14-0f3a-4a8c-9d51-6c3e8f2a7b90"
}The request worked, but the photo couldn't be diagnosed. crop_health is "unknown" and errors[0].type is one of:
| Type | Meaning | What to show your user |
|---|---|---|
| non_plant | No plant was found in the image. | Ask them to photograph the affected plant. |
| distance_too_far | The plant is too far away to see any symptoms. | Ask them to move closer to the leaf. |
| image_blurry | The photo is out of focus. | Ask them to hold steady, tap to focus and retake. |
| ornamental_plant | The plant is ornamental, not a crop. | Say that only crops are supported. |
| crop_not_supported | A crop was detected, but it isn't supported yet. | Show the supported crops. |
| unknown_disease | The crop was recognised, but the symptoms don't match a known problem. | Suggest a clearer photo of the affected area, or expert advice. |
These come back with the same errors array, so you can handle every error the same way.
| Status | Type | Cause |
|---|---|---|
| 400 | missing_image, invalid_image | No image field was sent, the file is empty, or it isn't a readable image. |
| 400 | invalid_parameter | An optional field has an invalid value: application_id has characters that aren't allowed or is too long, latitude/longitude isn't a number in range, or only one of the two was sent. |
| 401 | unauthorized | The API key is missing or invalid. |
| 413 | payload_too_large | The image is larger than 10 MB. |
| 415 | unsupported_media_type | The file isn't JPEG, PNG, WEBP or BMP. |
| 429 | rate_limited | Too many requests. Wait and retry (sandbox only). |
| 500 | internal_error | Something went wrong on our side. Retry, and quote the green_trace_id if it keeps happening. |
Replace YOUR_API_KEY with your key and leaf.jpg with the path to your image.
curl -X POST "https://healthygreens.co.in/api/v1/image-analysis" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Accept-Language: en" \ -F "image=@leaf.jpg" \ -F "application_used_image_gallery=false" \ -F "application_id=my-farm-app-01" \ -F "latitude=12.9716" \ -F "longitude=77.5946"
import requests
url = "https://healthygreens.co.in/api/v1/image-analysis"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Accept-Language": "en",
}
with open("leaf.jpg", "rb") as f:
response = requests.post(
url,
headers=headers,
files={"image": ("leaf.jpg", f, "image/jpeg")},
data={
"application_used_image_gallery": "false",
"application_id": "my-farm-app-01", # optional
"latitude": "12.9716", # optional, send with longitude
"longitude": "77.5946",
},
timeout=30,
)
result = response.json()
if result.get("errors"):
print("Could not diagnose:", result["errors"][0]["type"])
else:
print(result["crop_health"], result["crops"], result["predicted_diagnoses"][0]["scientific_name"])// Node.js 18+ (run on your server, never expose the key in a browser)
import { readFile } from "node:fs/promises";
const form = new FormData();
form.append("image", new Blob([await readFile("leaf.jpg")], { type: "image/jpeg" }), "leaf.jpg");
form.append("application_used_image_gallery", "false");
form.append("application_id", "my-farm-app-01"); // optional
form.append("latitude", "12.9716"); // optional, send with longitude
form.append("longitude", "77.5946");
const response = await fetch("https://healthygreens.co.in/api/v1/image-analysis", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Accept-Language": "en",
},
body: form,
});
const result = await response.json();
console.log(result.crop_health, result.crops, result.predicted_diagnoses);Pass one of these codes in the Accept-Language header. Disease names, symptoms, preventive measures and treatments are returned in that language.
| Code | Language | Code | Language |
|---|---|---|---|
| en | English | hi | Hindi |
| bn | Bengali | gu | Gujarati |
| kn | Kannada | ml | Malayalam |
| mr | Marathi | or | Odia |
| pa | Punjabi | ta | Tamil |
| te | Telugu | ur | Urdu |
| pt | Portuguese | vi | Vietnamese |
The crops field returns one of these values. We add new crops regularly. Tell us which ones you need.