import requests
url = "https://api.fildraai.com/api/v1/image_diagnosis/infer/basic"
headers = {"X-Api-Key": "YOUR_USER_API_KEY"}
with open("/absolute/path/to/maize_leaf.jpg", "rb") as fh:
response = requests.post(
url,
headers=headers,
data={"plant": "maize", "locale": "en-us", "top_k": 3},
files={"image": ("maize_leaf.jpg", fh, "image/jpeg")},
timeout=60,
)
response.raise_for_status()
print(response.json())
async function diagnoseImage(file) {
const form = new FormData();
form.append('image', file, file.name);
form.append('plant', 'maize');
form.append('locale', 'en-us');
form.append('top_k', '3');
const response = await fetch(
'https://api.fildraai.com/api/v1/image_diagnosis/infer/basic',
{
method: 'POST',
headers: { 'X-Api-Key': 'YOUR_USER_API_KEY' },
body: form,
}
);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
return response.json();
}
Postman is the fastest way to verify your API key and image work before wiring up code. The five steps below mirror what the Python and JavaScript snippets do above.
Screenshot 1
Setting the method + URL
Show Postman with POST selected and the full URL pasted in. Filename:
postman_diagnosis_01_url.png
Screenshot 2
Adding the X-Api-Key header
Headers tab with one row visible: X-Api-Key + your masked key value. Filename:
postman_diagnosis_02_header.png
Screenshot 3
Body → form-data with image File row
Body tab, form-data selected, the image row toggled to File with a selected JPEG, and the three text rows below. Filename:
postman_diagnosis_03_formdata.png
Screenshot 4
200 response with predictions
Response pane showing 200 status + pretty-printed JSON with a predictions array. Filename:
postman_diagnosis_04_response.png