Skip to main content

Farm API

Standards: GeoJSON · AgroVoc · ITU/FAO data model Transport: REST · OpenAPI · /swagger Base URL: https://api.<your-deployment>

The Farm API manages the master-data hierarchy:

Organization → Farm → Field → Region (ROI) → cultivation periods · actions · records · sensors

A Region is the ITU/FAO Region of Interest — a freely nestable sub-division of a field. Regions are the unit at which sensors, activities and AgroVoc tagging attach.

Users & Organizations

MethodPathPurpose
GET/v1/usersList users
GET/v1/users/{id}Get one user
PATCH/v1/users/{id}Update a user
DELETE/v1/users/{id}Delete a user
GET/v1/organizationsList organizations
POST/v1/organizationsCreate an organization
GET/v1/organizations/{id}Get one organization
PATCH/v1/organizations/{id}Update an organization
DELETE/v1/organizations/{id}Delete an organization

User accounts are provisioned via Keycloak (IAM). The endpoints above operate on the platform-side user records that bind a Keycloak identity to roles and organisations.

Farms

MethodPathPurpose
GET/v1/farmsList farms visible to the caller
POST/v1/farmsCreate a farm
GET/v1/farms/{farmId}Get one farm
PATCH/v1/farms/{farmId}Update a farm
DELETE/v1/farms/{farmId}Delete a farm
POST/v1/farms/{farmId}/usersAdd a user to a farm with a role

Fields

Fields live under a farm. Every field carries a GeoJSON geometry.

MethodPathPurpose
POST/v1/farms/{farmId}/fieldsCreate a field
PATCH/v1/farms/{farmId}/fields/{fieldId}Update a field
DELETE/v1/farms/{farmId}/fields/{fieldId}Delete a field

GET listings of fields are returned as part of the nested farm / region responses below — there is no flat GET /v1/farms/{farmId}/fields collection endpoint in the current build.

Regions (ROIs)

Regions are the recursively nestable subdivision of a field. They are the primary attachment point for sensors, activities and AgroVoc tags.

MethodPathPurpose
GET/v1/regionsAll regions, returned as a nested tree
POST/v1/regionsCreate a region (optionally as a child of another)
GET/v1/regions/{regionId}Get one region with its nested children
PATCH/v1/regions/{regionId}Update a region
DELETE/v1/regions/{regionId}Delete a region

AgroVoc tagging

MethodPathPurpose
GET/v1/regions/agrovoc-labelsAll AgroVoc labels in use across the platform
GET/v1/regions/{regionId}/agrovoc-labelsAgroVoc labels for one region and its children

The POST/PATCH endpoints on a region accept AgroVoc IRIs as part of the payload — see the Swagger schemas for the exact field name.

Curl example

TOKEN="<your access token>"
BASE="https://api.example.com"

# List the user's farms
curl -H "Authorization: Bearer $TOKEN" "$BASE/v1/farms"

# Pull the full region tree
curl -H "Authorization: Bearer $TOKEN" "$BASE/v1/regions"

# Tags in use
curl -H "Authorization: Bearer $TOKEN" "$BASE/v1/regions/agrovoc-labels"