API Reference
Fields
The individual plots that make up a farm, including boundaries and metadata.
/fields/{field_id}Get a field by id
Authorization: Bearer header.Parameters
field_idstringpathrequiredResponse 200
field_idstringrequiredcropsense_field_idstringoptionalfarm_idstringrequirednamestringrequiredfield_typeenum<string>optionalField type enum
open_fieldorchardplantationpastureforestagroforestryotherfield_statusenum<string>optionalField status enum
fallowharvestedplantedploughedirrigation_typeenum<string>optionallatitudenumberrequiredlongitudenumberrequiredarea_hanumberrequiredaddressstringoptionalcitystringoptionalstatestringoptionalcountrystringoptionalattributesobjectoptionalgeomobjectrequiredis_activebooleanrequiredactive_crop_countintegeroptionalcreated_atstring<date-time>requiredupdated_atstring<date-time>requiredcurl -X GET "https://api.cropsense.africa/fields/8b6e1a2f-2d4c-4e9a-9b0f-1c7d3e5a6f42" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"{
"field_id": "8b6e1a2f-2d4c-4e9a-9b0f-1c7d3e5a6f42",
"cropsense_field_id": "cropsense_field_id",
"farm_id": "3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a",
"name": "Green Valley Farm",
"field_type": "open_field",
"field_status": "fallow",
"irrigation_type": "rainfed",
"latitude": 1.5,
"longitude": 1.5,
"area_ha": 1.5,
"address": "address",
"city": "city",
"state": "state",
"country": "Kenya",
"attributes": {},
"geom": {},
"is_active": true,
"active_crop_count": 1,
"created_at": "2026-06-15T09:30:00Z",
"updated_at": "2026-06-15T09:30:00Z"
}/fields/{field_id}Update a field by id
Authorization: Bearer header.Parameters
field_idstringpathrequiredRequest body
namestringoptionalfield_typeenum<string>optionalField type enum
open_fieldorchardplantationpastureforestagroforestryotherfield_statusenum<string>optionalField status enum
fallowharvestedplantedploughedirrigation_typeenum<string>optionalHow a field is watered. Rainfed means no irrigation.
rainfeddripsprinklerfloodsurfacegeomobjectoptionalattributesobjectoptionalupdated_atstring<date-time>optionalResponse 200
field_idstringrequiredcropsense_field_idstringoptionalfarm_idstringrequirednamestringrequiredfield_typeenum<string>optionalField type enum
open_fieldorchardplantationpastureforestagroforestryotherfield_statusenum<string>optionalField status enum
fallowharvestedplantedploughedirrigation_typeenum<string>optionallatitudenumberrequiredlongitudenumberrequiredarea_hanumberrequiredaddressstringoptionalcitystringoptionalstatestringoptionalcountrystringoptionalattributesobjectoptionalgeomobjectrequiredis_activebooleanrequiredactive_crop_countintegeroptionalcreated_atstring<date-time>requiredupdated_atstring<date-time>requiredcurl -X PUT "https://api.cropsense.africa/fields/8b6e1a2f-2d4c-4e9a-9b0f-1c7d3e5a6f42" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Green Valley Farm",
"field_type": "open_field",
"field_status": "fallow",
"irrigation_type": "rainfed",
"geom": {},
"attributes": {},
"updated_at": "2026-06-15T09:30:00Z"
}'{
"field_id": "8b6e1a2f-2d4c-4e9a-9b0f-1c7d3e5a6f42",
"cropsense_field_id": "cropsense_field_id",
"farm_id": "3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a",
"name": "Green Valley Farm",
"field_type": "open_field",
"field_status": "fallow",
"irrigation_type": "rainfed",
"latitude": 1.5,
"longitude": 1.5,
"area_ha": 1.5,
"address": "address",
"city": "city",
"state": "state",
"country": "Kenya",
"attributes": {},
"geom": {},
"is_active": true,
"active_crop_count": 1,
"created_at": "2026-06-15T09:30:00Z",
"updated_at": "2026-06-15T09:30:00Z"
}/fields/{field_id}Delete a field by id
Authorization: Bearer header.Parameters
field_idstringpathrequiredResponse 200
curl -X DELETE "https://api.cropsense.africa/fields/8b6e1a2f-2d4c-4e9a-9b0f-1c7d3e5a6f42" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"null/fields/createCreate a field
Authorization: Bearer header.Request body
farm_idstringrequirednamestringrequiredfield_typeenum<string>optionalField type enum
open_fieldorchardplantationpastureforestagroforestryotherfield_statusenum<string>optionalField status enum
fallowharvestedplantedploughedirrigation_typeenum<string>optionalgeomobjectrequiredattributesobjectoptionalcreated_atstring<date-time>optionalupdated_atstring<date-time>optionalResponse 200
field_idstringrequiredcropsense_field_idstringoptionalfarm_idstringrequirednamestringrequiredfield_typeenum<string>optionalField type enum
open_fieldorchardplantationpastureforestagroforestryotherfield_statusenum<string>optionalField status enum
fallowharvestedplantedploughedirrigation_typeenum<string>optionallatitudenumberrequiredlongitudenumberrequiredarea_hanumberrequiredaddressstringoptionalcitystringoptionalstatestringoptionalcountrystringoptionalattributesobjectoptionalgeomobjectrequiredis_activebooleanrequiredactive_crop_countintegeroptionalcreated_atstring<date-time>requiredupdated_atstring<date-time>requiredcurl -X POST "https://api.cropsense.africa/fields/create" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"farm_id": "3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a",
"name": "Green Valley Farm",
"field_type": "open_field",
"field_status": "fallow",
"irrigation_type": "rainfed",
"geom": {},
"attributes": {},
"created_at": "2026-06-15T09:30:00Z",
"updated_at": "2026-06-15T09:30:00Z"
}'{
"field_id": "8b6e1a2f-2d4c-4e9a-9b0f-1c7d3e5a6f42",
"cropsense_field_id": "cropsense_field_id",
"farm_id": "3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a",
"name": "Green Valley Farm",
"field_type": "open_field",
"field_status": "fallow",
"irrigation_type": "rainfed",
"latitude": 1.5,
"longitude": 1.5,
"area_ha": 1.5,
"address": "address",
"city": "city",
"state": "state",
"country": "Kenya",
"attributes": {},
"geom": {},
"is_active": true,
"active_crop_count": 1,
"created_at": "2026-06-15T09:30:00Z",
"updated_at": "2026-06-15T09:30:00Z"
}/fields/farm/{farm_id}Get fields by farm id
Get fields by farm id, each with its active crop count
Authorization: Bearer header.Parameters
farm_idstringpathrequiredResponse 200
fieldsField[]requiredtotalintegerrequiredcurl -X GET "https://api.cropsense.africa/fields/farm/3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"{
"fields": [
{
"field_id": "8b6e1a2f-2d4c-4e9a-9b0f-1c7d3e5a6f42",
"cropsense_field_id": "cropsense_field_id",
"farm_id": "3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a",
"name": "Green Valley Farm",
"field_type": "open_field",
"field_status": "fallow",
"irrigation_type": "rainfed",
"latitude": 1.5,
"longitude": 1.5,
"area_ha": 1.5,
"address": "address",
"city": "city",
"state": "state",
"country": "Kenya",
"attributes": {},
"geom": {},
"is_active": true,
"active_crop_count": 1,
"created_at": "2026-06-15T09:30:00Z",
"updated_at": "2026-06-15T09:30:00Z"
}
],
"total": 1
}/fields/atFind your fields at a GPS location
Fields you can access that contain the point (distance_m 0) or, with radius_m, lie within that distance of it, nearest first. At most 20.
Authorization: Bearer header.Parameters
latitudenumberqueryrequiredlongitudenumberqueryrequiredradius_mnumberqueryAlso match fields whose edge is within this many metres, to allow for GPS error. 0 matches only fields containing the point.
Response 200
fieldsFieldAtLocation[]requiredtotalintegerrequiredcurl -X GET "https://api.cropsense.africa/fields/at?latitude=1.5&longitude=1.5&radius_m=0" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"{
"fields": [
{
"field_id": "8b6e1a2f-2d4c-4e9a-9b0f-1c7d3e5a6f42",
"cropsense_field_id": "cropsense_field_id",
"farm_id": "3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a",
"farm_name": "farm_name",
"name": "Green Valley Farm",
"area_ha": 1.5,
"latitude": 1.5,
"longitude": 1.5,
"distance_m": 1.5
}
],
"total": 1
}/fields/boundary/validateCheck a field boundary without creating a field
Report whether POST /fields/create would accept this boundary, with its area, centroid and any of your fields it overlaps. Always 200: a refused boundary comes back as valid=false with the reasons in `errors`. The country checks (field in Africa, same country as its farm) need a reverse geocode and are applied only at creation.
Authorization: Bearer header.Request body
geomobjectrequiredGeoJSON Polygon or MultiPolygon, bare or wrapped in a Feature/FeatureCollection with one feature
exclude_field_idstringoptionalResponse 200
validbooleanrequirederrorsBoundaryIssue[]optionalwarningsBoundaryIssue[]optionalgeometry_typestringoptionalarea_hanumberoptionallatitudenumberoptionallongitudenumberoptionaloverlapping_fieldsFieldOverlap[]optionalcurl -X POST "https://api.cropsense.africa/fields/boundary/validate" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"geom": {},
"exclude_field_id": "exclude_field_id"
}'{
"valid": true,
"errors": [
{
"code": "code",
"message": "message"
}
],
"warnings": [
{
"code": "code",
"message": "message"
}
],
"geometry_type": "geometry_type",
"area_ha": 1.5,
"latitude": 1.5,
"longitude": 1.5,
"overlapping_fields": [
{
"field_id": "8b6e1a2f-2d4c-4e9a-9b0f-1c7d3e5a6f42",
"cropsense_field_id": "cropsense_field_id",
"farm_id": "3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a",
"farm_name": "farm_name",
"name": "Green Valley Farm",
"area_ha": 1.5,
"latitude": 1.5,
"longitude": 1.5,
"overlap_area_ha": 1.5,
"overlap_pct_of_boundary": 1.5,
"overlap_pct_of_field": 1.5
}
]
}/fields/overlapsFind your fields that overlap a boundary
Fields you can access that share at least 1 m² with the boundary, largest overlap first. 422 if the boundary is not a valid polygon.
Authorization: Bearer header.Request body
geomobjectrequiredGeoJSON Polygon or MultiPolygon
exclude_field_idstringoptionalResponse 200
fieldsFieldOverlap[]requiredtotalintegerrequiredcurl -X POST "https://api.cropsense.africa/fields/overlaps" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"geom": {},
"exclude_field_id": "exclude_field_id"
}'{
"fields": [
{
"field_id": "8b6e1a2f-2d4c-4e9a-9b0f-1c7d3e5a6f42",
"cropsense_field_id": "cropsense_field_id",
"farm_id": "3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a",
"farm_name": "farm_name",
"name": "Green Valley Farm",
"area_ha": 1.5,
"latitude": 1.5,
"longitude": 1.5,
"overlap_area_ha": 1.5,
"overlap_pct_of_boundary": 1.5,
"overlap_pct_of_field": 1.5
}
],
"total": 1
}/fields/withinFind your fields inside an area
Fields you can access in a polygon or bounding box, ordered by farm and field name. `total` counts every match; `fields` holds at most `limit`.
Authorization: Bearer header.Request body
geomobjectoptionalbboxnumber[]optionalmatchenum<string>optionalintersects: any part of the field is in the area. within: the whole field is.
limitintegeroptionalResponse 200
fieldsFieldMatchSummary[]requiredtotalintegerrequiredMatching fields, which may exceed the number returned
curl -X POST "https://api.cropsense.africa/fields/within" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"geom": {},
"bbox": [
1.5
],
"match": "intersects",
"limit": 100
}'{
"fields": [
{
"field_id": "8b6e1a2f-2d4c-4e9a-9b0f-1c7d3e5a6f42",
"cropsense_field_id": "cropsense_field_id",
"farm_id": "3fa2c9e1-6b3a-4d2e-9c11-4a8e5f9d2b7a",
"farm_name": "farm_name",
"name": "Green Valley Farm",
"area_ha": 1.5,
"latitude": 1.5,
"longitude": 1.5
}
],
"total": 1
}