API Reference
Farms
Create and manage the farms owned by a user on the platform.
post
/farms/createCreate a farm without an organization (any authenticated user)
Requires an
Authorization: Bearer header.Request body
namestringrequiredfarm_typeenum<string>optionalsmallholdercommercialcooperativeoutgrowercorporatefarm_sizeenum<string>optionalmicrosmallmediumlargeenterprisetenure_typeenum<string>optionalEnum for tenure types
ownedleasedsharedrentedhas_irrigationbooleanoptionalirrigation_typeenum<string>optionalEnum for irrigation types
dripsprinklerfloodsurfacenonewater_sourceenum<string>optionalEnum for water source types
riverwellboreholerainfedotherscommon_grown_cropsstring[]optionalsoil_typeenum<string>optionalEnum for soil types
claysandyloamysiltypeatychalkyunknowncurrencystringoptionallocationstringoptionalcountrystringoptionalResponse 201
farm_idstringrequiredcropsense_farm_idstringoptionalnamestringrequiredowner_idstringrequiredregistered_by_org_idstringoptionalfarm_typeenum<string>optionalsmallholdercommercialcooperativeoutgrowercorporatefarm_sizeenum<string>optionalmicrosmallmediumlargeenterprisetenure_typeenum<string>optionalEnum for tenure types
ownedleasedsharedrentedhas_irrigationbooleanrequiredirrigation_typeenum<string>optionalEnum for irrigation types
dripsprinklerfloodsurfacenonewater_sourceenum<string>optionalEnum for water source types
riverwellboreholerainfedotherscommon_grown_cropsstring[]optionalsoil_typeenum<string>optionalEnum for soil types
claysandyloamysiltypeatychalkyunknowncurrencystringoptionallocationstringoptionalcountrystringoptionalis_activebooleanrequiredcreated_atstring<date-time>requiredupdated_atstring<date-time>requiredfarmerFarmerProfileoptionalFarmer identity returned in farm responses.
organizationsFarmLinkedOrganization[]optionalPOST /farms/create
curl -X POST "https://api.cropsense.africa/farms/create" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Green Valley Farm",
"farm_type": "smallholder",
"farm_size": "micro",
"tenure_type": "owned",
"has_irrigation": false,
"irrigation_type": "drip",
"water_source": "river",
"common_grown_crops": [
"common_grown_crops"
],
"soil_type": "clay",
"currency": "USD",
"location": "Kiambu County",
"country": "Kenya"
}'Example response · 201
{
"farm_id": "3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a",
"cropsense_farm_id": "cropsense_farm_id",
"name": "Green Valley Farm",
"owner_id": "d4e2f1a0-9b8c-4a6d-8e3f-2c1b0a9d8e7f",
"registered_by_org_id": "registered_by_org_id",
"farm_type": "smallholder",
"farm_size": "micro",
"tenure_type": "owned",
"has_irrigation": true,
"irrigation_type": "drip",
"water_source": "river",
"common_grown_crops": [
"common_grown_crops"
],
"soil_type": "clay",
"currency": "USD",
"location": "Kiambu County",
"country": "Kenya",
"is_active": true,
"created_at": "2026-06-15T09:30:00Z",
"updated_at": "2026-06-15T09:30:00Z",
"farmer": {
"farmer_id": "farmer_id",
"cropsense_farmer_id": "CS-FARMER-48213",
"first_name": "first_name",
"last_name": "last_name",
"phone_number": "phone_number",
"language": "language",
"upload_channel": "upload_channel",
"whatsapp_number": "whatsapp_number",
"onboarding_status": "onboarding_status",
"data_consent_given": true,
"is_active": true,
"created_at": "2026-06-15T09:30:00Z",
"updated_at": "2026-06-15T09:30:00Z"
},
"organizations": []
}get
/farms/{farm_id}Get a farm by id
Requires an
Authorization: Bearer header.Parameters
farm_idstringpathrequiredResponse 200
farm_idstringrequiredcropsense_farm_idstringoptionalnamestringrequiredowner_idstringrequiredregistered_by_org_idstringoptionalfarm_typeenum<string>optionalsmallholdercommercialcooperativeoutgrowercorporatefarm_sizeenum<string>optionalmicrosmallmediumlargeenterprisetenure_typeenum<string>optionalEnum for tenure types
ownedleasedsharedrentedhas_irrigationbooleanrequiredirrigation_typeenum<string>optionalEnum for irrigation types
dripsprinklerfloodsurfacenonewater_sourceenum<string>optionalEnum for water source types
riverwellboreholerainfedotherscommon_grown_cropsstring[]optionalsoil_typeenum<string>optionalEnum for soil types
claysandyloamysiltypeatychalkyunknowncurrencystringoptionallocationstringoptionalcountrystringoptionalis_activebooleanrequiredcreated_atstring<date-time>requiredupdated_atstring<date-time>requiredfarmerFarmerProfileoptionalFarmer identity returned in farm responses.
organizationsFarmLinkedOrganization[]optionalGET /farms/{farm_id}
curl -X GET "https://api.cropsense.africa/farms/3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"Example response · 200
{
"farm_id": "3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a",
"cropsense_farm_id": "cropsense_farm_id",
"name": "Green Valley Farm",
"owner_id": "d4e2f1a0-9b8c-4a6d-8e3f-2c1b0a9d8e7f",
"registered_by_org_id": "registered_by_org_id",
"farm_type": "smallholder",
"farm_size": "micro",
"tenure_type": "owned",
"has_irrigation": true,
"irrigation_type": "drip",
"water_source": "river",
"common_grown_crops": [
"common_grown_crops"
],
"soil_type": "clay",
"currency": "USD",
"location": "Kiambu County",
"country": "Kenya",
"is_active": true,
"created_at": "2026-06-15T09:30:00Z",
"updated_at": "2026-06-15T09:30:00Z",
"farmer": {
"farmer_id": "farmer_id",
"cropsense_farmer_id": "CS-FARMER-48213",
"first_name": "first_name",
"last_name": "last_name",
"phone_number": "phone_number",
"language": "language",
"upload_channel": "upload_channel",
"whatsapp_number": "whatsapp_number",
"onboarding_status": "onboarding_status",
"data_consent_given": true,
"is_active": true,
"created_at": "2026-06-15T09:30:00Z",
"updated_at": "2026-06-15T09:30:00Z"
},
"organizations": []
}put
/farms/{farm_id}Update a farm
Requires an
Authorization: Bearer header.Parameters
farm_idstringpathrequiredRequest body
namestringoptionalfarm_typeenum<string>optionalsmallholdercommercialcooperativeoutgrowercorporatefarm_sizeenum<string>optionalmicrosmallmediumlargeenterprisetenure_typeenum<string>optionalEnum for tenure types
ownedleasedsharedrentedhas_irrigationbooleanoptionalirrigation_typeenum<string>optionalEnum for irrigation types
dripsprinklerfloodsurfacenonewater_sourceenum<string>optionalEnum for water source types
riverwellboreholerainfedotherscommon_grown_cropsstring[]optionalsoil_typeenum<string>optionalEnum for soil types
claysandyloamysiltypeatychalkyunknowncurrencystringoptionallocationstringoptionalcountrystringoptionalupdated_atstring<date-time>optionalResponse 200
farm_idstringrequiredcropsense_farm_idstringoptionalnamestringrequiredowner_idstringrequiredregistered_by_org_idstringoptionalfarm_typeenum<string>optionalsmallholdercommercialcooperativeoutgrowercorporatefarm_sizeenum<string>optionalmicrosmallmediumlargeenterprisetenure_typeenum<string>optionalEnum for tenure types
ownedleasedsharedrentedhas_irrigationbooleanrequiredirrigation_typeenum<string>optionalEnum for irrigation types
dripsprinklerfloodsurfacenonewater_sourceenum<string>optionalEnum for water source types
riverwellboreholerainfedotherscommon_grown_cropsstring[]optionalsoil_typeenum<string>optionalEnum for soil types
claysandyloamysiltypeatychalkyunknowncurrencystringoptionallocationstringoptionalcountrystringoptionalis_activebooleanrequiredcreated_atstring<date-time>requiredupdated_atstring<date-time>requiredfarmerFarmerProfileoptionalFarmer identity returned in farm responses.
organizationsFarmLinkedOrganization[]optionalPUT /farms/{farm_id}
curl -X PUT "https://api.cropsense.africa/farms/3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Green Valley Farm",
"farm_type": "smallholder",
"farm_size": "micro",
"tenure_type": "owned",
"has_irrigation": true,
"irrigation_type": "drip",
"water_source": "river",
"common_grown_crops": [
"common_grown_crops"
],
"soil_type": "clay",
"currency": "USD",
"location": "Kiambu County",
"country": "Kenya",
"updated_at": "2026-06-15T09:30:00Z"
}'Example response · 200
{
"farm_id": "3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a",
"cropsense_farm_id": "cropsense_farm_id",
"name": "Green Valley Farm",
"owner_id": "d4e2f1a0-9b8c-4a6d-8e3f-2c1b0a9d8e7f",
"registered_by_org_id": "registered_by_org_id",
"farm_type": "smallholder",
"farm_size": "micro",
"tenure_type": "owned",
"has_irrigation": true,
"irrigation_type": "drip",
"water_source": "river",
"common_grown_crops": [
"common_grown_crops"
],
"soil_type": "clay",
"currency": "USD",
"location": "Kiambu County",
"country": "Kenya",
"is_active": true,
"created_at": "2026-06-15T09:30:00Z",
"updated_at": "2026-06-15T09:30:00Z",
"farmer": {
"farmer_id": "farmer_id",
"cropsense_farmer_id": "CS-FARMER-48213",
"first_name": "first_name",
"last_name": "last_name",
"phone_number": "phone_number",
"language": "language",
"upload_channel": "upload_channel",
"whatsapp_number": "whatsapp_number",
"onboarding_status": "onboarding_status",
"data_consent_given": true,
"is_active": true,
"created_at": "2026-06-15T09:30:00Z",
"updated_at": "2026-06-15T09:30:00Z"
},
"organizations": []
}delete
/farms/{farm_id}Soft-delete a farm
Requires an
Authorization: Bearer header.Parameters
farm_idstringpathrequiredDELETE /farms/{farm_id}
curl -X DELETE "https://api.cropsense.africa/farms/3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"Example response · 204
{}get
/farms/farmers/{cropsense_farmer_id}Look up a farmer and all their farms by shareable farmer ID
Requires an
Authorization: Bearer header.Parameters
cropsense_farmer_idstringpathrequiredResponse 200
farmer_idstringrequiredcropsense_farmer_idstringrequiredfirst_namestringrequiredlast_namestringrequiredphone_numberstringoptionallanguagestringoptionalupload_channelstringoptionalwhatsapp_numberstringoptionalonboarding_statusstringrequireddata_consent_givenbooleanrequiredis_activebooleanrequiredcreated_atstring<date-time>requiredupdated_atstring<date-time>requiredfarmsFarmWithFarmer[]optionaltotal_farmsintegeroptionalGET /farms/farmers/{cropsense_farmer_id}
curl -X GET "https://api.cropsense.africa/farms/farmers/CS-FARMER-48213" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"Example response · 200
{
"farmer_id": "farmer_id",
"cropsense_farmer_id": "CS-FARMER-48213",
"first_name": "first_name",
"last_name": "last_name",
"phone_number": "phone_number",
"language": "language",
"upload_channel": "upload_channel",
"whatsapp_number": "whatsapp_number",
"onboarding_status": "onboarding_status",
"data_consent_given": true,
"is_active": true,
"created_at": "2026-06-15T09:30:00Z",
"updated_at": "2026-06-15T09:30:00Z",
"farms": [],
"total_farms": 0
}