Getting Started
Quickstart
From API key to your first successful call, in four steps.
- 1
Log in
Exchange your organisation API key for an access token. See Authentication for details.
curl -X POST "https://api.cropsense.africa/auth/api-key?api_key=YOUR_ORG_API_KEY" - 2
Create a field
Add a field to an existing farm to start monitoring, with its boundary as GeoJSON:
curl -X POST "https://api.cropsense.africa/fields/create" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "farm_id": "YOUR_FARM_ID", "name": "North Block", "field_type": "open_field", "field_status": "fallow", "geom": { "type": "Polygon", "coordinates": [[ [36.821, -1.292], [36.825, -1.292], [36.825, -1.296], [36.821, -1.296], [36.821, -1.292] ]] } }' - 3
List a farm's fields
Fetch every field that belongs to a farm:
curl "https://api.cropsense.africa/fields/farm/YOUR_FARM_ID" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" - 4
Handle validation errors
Invalid requests return
422 Unprocessable Entitywith a field-level breakdown:{ "detail": [ { "loc": ["body", "name"], "msg": "Field required", "type": "missing" } ] }
That's the whole loop. Next, browse the full API Reference for every resource CropSense exposes.