API Reference
Harvest Records
Log and retrieve harvest yield, quality, and quantity records.
get
/harvest-records/{record_id}Get a harvest record by id
Requires an
Authorization: Bearer header.Parameters
record_idstringpathrequiredResponse 200
record_idstringrequiredfarm_idstringrequiredfarm_namestringoptionalfield_idstringrequiredfield_namestringoptionalcrop_idstringrequiredcrop_namestringrequiredcrop_categorystringrequiredharvest_datestring<date-time>requiredquantity_kgnumberrequiredqualityenum<string>optionalHarvest quality enum
excellentgoodaveragepoormarket_price_per_kgnumberoptionalnotesstringoptionalis_activebooleanrequiredcreated_atstring<date-time>requiredupdated_atstring<date-time>requiredGET /harvest-records/{record_id}
curl -X GET "https://api.cropsense.africa/harvest-records/9f8e7d6c-5b4a-4c3d-8e2f-1a0b9c8d7e6f" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"Example response · 200
{
"record_id": "9f8e7d6c-5b4a-4c3d-8e2f-1a0b9c8d7e6f",
"farm_id": "3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a",
"farm_name": "farm_name",
"field_id": "8b6e1a2f-2d4c-4e9a-9b0f-1c7d3e5a6f42",
"field_name": "field_name",
"crop_id": "cassava-01",
"crop_name": "crop_name",
"crop_category": "crop_category",
"harvest_date": "2026-06-15T09:30:00Z",
"quantity_kg": 1.5,
"quality": "excellent",
"market_price_per_kg": 1.5,
"notes": "Applied 50kg urea to the north block.",
"is_active": true,
"created_at": "2026-06-15T09:30:00Z",
"updated_at": "2026-06-15T09:30:00Z"
}put
/harvest-records/{record_id}Update a harvest record by id
Requires an
Authorization: Bearer header.Parameters
record_idstringpathrequiredRequest body
crop_idstringoptionalharvest_datestring<date-time>optionalquantity_kgnumberoptionalqualityenum<string>optionalHarvest quality enum
excellentgoodaveragepoormarket_price_per_kgnumberoptionalnotesstringoptionalResponse 200
record_idstringrequiredfarm_idstringrequiredfarm_namestringoptionalfield_idstringrequiredfield_namestringoptionalcrop_idstringrequiredcrop_namestringrequiredcrop_categorystringrequiredharvest_datestring<date-time>requiredquantity_kgnumberrequiredqualityenum<string>optionalHarvest quality enum
excellentgoodaveragepoormarket_price_per_kgnumberoptionalnotesstringoptionalis_activebooleanrequiredcreated_atstring<date-time>requiredupdated_atstring<date-time>requiredPUT /harvest-records/{record_id}
curl -X PUT "https://api.cropsense.africa/harvest-records/9f8e7d6c-5b4a-4c3d-8e2f-1a0b9c8d7e6f" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"crop_id": "cassava-01",
"harvest_date": "2026-06-15T09:30:00Z",
"quantity_kg": 1.5,
"quality": "excellent",
"market_price_per_kg": 1.5,
"notes": "Applied 50kg urea to the north block."
}'Example response · 200
{
"record_id": "9f8e7d6c-5b4a-4c3d-8e2f-1a0b9c8d7e6f",
"farm_id": "3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a",
"farm_name": "farm_name",
"field_id": "8b6e1a2f-2d4c-4e9a-9b0f-1c7d3e5a6f42",
"field_name": "field_name",
"crop_id": "cassava-01",
"crop_name": "crop_name",
"crop_category": "crop_category",
"harvest_date": "2026-06-15T09:30:00Z",
"quantity_kg": 1.5,
"quality": "excellent",
"market_price_per_kg": 1.5,
"notes": "Applied 50kg urea to the north block.",
"is_active": true,
"created_at": "2026-06-15T09:30:00Z",
"updated_at": "2026-06-15T09:30:00Z"
}delete
/harvest-records/{record_id}Delete a harvest record by id
Requires an
Authorization: Bearer header.Parameters
record_idstringpathrequiredResponse 200
DELETE /harvest-records/{record_id}
curl -X DELETE "https://api.cropsense.africa/harvest-records/9f8e7d6c-5b4a-4c3d-8e2f-1a0b9c8d7e6f" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"Example response · 200
nullpost
/harvest-records/createCreate a harvest record
Requires an
Authorization: Bearer header.Request body
farm_idstringrequiredfield_idstringrequiredcrop_idstringrequiredharvest_datestring<date-time>requiredquantity_kgnumberrequiredqualityenum<string>optionalHarvest quality enum
excellentgoodaveragepoormarket_price_per_kgnumberoptionalnotesstringoptionalResponse 200
record_idstringrequiredfarm_idstringrequiredfarm_namestringoptionalfield_idstringrequiredfield_namestringoptionalcrop_idstringrequiredcrop_namestringrequiredcrop_categorystringrequiredharvest_datestring<date-time>requiredquantity_kgnumberrequiredqualityenum<string>optionalHarvest quality enum
excellentgoodaveragepoormarket_price_per_kgnumberoptionalnotesstringoptionalis_activebooleanrequiredcreated_atstring<date-time>requiredupdated_atstring<date-time>requiredPOST /harvest-records/create
curl -X POST "https://api.cropsense.africa/harvest-records/create" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"farm_id": "3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a",
"field_id": "8b6e1a2f-2d4c-4e9a-9b0f-1c7d3e5a6f42",
"crop_id": "cassava-01",
"harvest_date": "2026-06-15T09:30:00Z",
"quantity_kg": 1.5,
"quality": "excellent",
"market_price_per_kg": 1.5,
"notes": "Applied 50kg urea to the north block."
}'Example response · 200
{
"record_id": "9f8e7d6c-5b4a-4c3d-8e2f-1a0b9c8d7e6f",
"farm_id": "3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a",
"farm_name": "farm_name",
"field_id": "8b6e1a2f-2d4c-4e9a-9b0f-1c7d3e5a6f42",
"field_name": "field_name",
"crop_id": "cassava-01",
"crop_name": "crop_name",
"crop_category": "crop_category",
"harvest_date": "2026-06-15T09:30:00Z",
"quantity_kg": 1.5,
"quality": "excellent",
"market_price_per_kg": 1.5,
"notes": "Applied 50kg urea to the north block.",
"is_active": true,
"created_at": "2026-06-15T09:30:00Z",
"updated_at": "2026-06-15T09:30:00Z"
}get
/harvest-records/field/{field_id}Get all harvest records by field id
Requires an
Authorization: Bearer header.Parameters
field_idstringpathrequiredResponse 200
recordsHarvestRecord[]requiredtotalintegerrequiredGET /harvest-records/field/{field_id}
curl -X GET "https://api.cropsense.africa/harvest-records/field/8b6e1a2f-2d4c-4e9a-9b0f-1c7d3e5a6f42" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"Example response · 200
{
"records": [
{
"record_id": "9f8e7d6c-5b4a-4c3d-8e2f-1a0b9c8d7e6f",
"farm_id": "3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a",
"farm_name": "farm_name",
"field_id": "8b6e1a2f-2d4c-4e9a-9b0f-1c7d3e5a6f42",
"field_name": "field_name",
"crop_id": "cassava-01",
"crop_name": "crop_name",
"crop_category": "crop_category",
"harvest_date": "2026-06-15T09:30:00Z",
"quantity_kg": 1.5,
"quality": "excellent",
"market_price_per_kg": 1.5,
"notes": "Applied 50kg urea to the north block.",
"is_active": true,
"created_at": "2026-06-15T09:30:00Z",
"updated_at": "2026-06-15T09:30:00Z"
}
],
"total": 1
}