CropSense

Search documentation

Search for a command to run...

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_idstringpathrequired

Response 200

record_idstringrequired
farm_idstringrequired
farm_namestringoptional
field_idstringrequired
field_namestringoptional
crop_idstringrequired
crop_namestringrequired
crop_categorystringrequired
harvest_datestring<date-time>required
quantity_kgnumberrequired
qualityenum<string>optional

Harvest quality enum

excellentgoodaveragepoor
market_price_per_kgnumberoptional
notesstringoptional
is_activebooleanrequired
created_atstring<date-time>required
updated_atstring<date-time>required
GET /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_idstringpathrequired

Request body

crop_idstringoptional
harvest_datestring<date-time>optional
quantity_kgnumberoptional
qualityenum<string>optional

Harvest quality enum

excellentgoodaveragepoor
market_price_per_kgnumberoptional
notesstringoptional

Response 200

record_idstringrequired
farm_idstringrequired
farm_namestringoptional
field_idstringrequired
field_namestringoptional
crop_idstringrequired
crop_namestringrequired
crop_categorystringrequired
harvest_datestring<date-time>required
quantity_kgnumberrequired
qualityenum<string>optional

Harvest quality enum

excellentgoodaveragepoor
market_price_per_kgnumberoptional
notesstringoptional
is_activebooleanrequired
created_atstring<date-time>required
updated_atstring<date-time>required
PUT /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_idstringpathrequired

Response 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
null
post/harvest-records/create

Create a harvest record

Requires an Authorization: Bearer header.

Request body

farm_idstringrequired
field_idstringrequired
crop_idstringrequired
harvest_datestring<date-time>required
quantity_kgnumberrequired
qualityenum<string>optional

Harvest quality enum

excellentgoodaveragepoor
market_price_per_kgnumberoptional
notesstringoptional

Response 200

record_idstringrequired
farm_idstringrequired
farm_namestringoptional
field_idstringrequired
field_namestringoptional
crop_idstringrequired
crop_namestringrequired
crop_categorystringrequired
harvest_datestring<date-time>required
quantity_kgnumberrequired
qualityenum<string>optional

Harvest quality enum

excellentgoodaveragepoor
market_price_per_kgnumberoptional
notesstringoptional
is_activebooleanrequired
created_atstring<date-time>required
updated_atstring<date-time>required
POST /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_idstringpathrequired

Response 200

recordsHarvestRecord[]required
totalintegerrequired
GET /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
}