Cropwise
powered by syngenta

CROPWISE SERVICES

Working with Crop Zones 🌽

Overview

Crop Zones enable you to track field-specific agronomic data within production seasons, providing detailed temporal and spatial context for each field's usage.

Cardinality summary

  • Workspace ➜ 1..* Organizations
  • Organization ➜ 1..* Properties
  • Property ➜ 1..* Fields
  • Field ➜ 0..* Crop Zones (max 1 per Season)
  • Season ➜ 0..* Crop Zones (max 1 per Field)
  • (Field, Season) pair ➜ 0..1 Crop Zone (UNIQUE)
Workspace
└── Organization
    β”œβ”€β”€ Seasons 1..*
    └── Properties 1..*
      └── Fields 1..*
        └── Crop Zones (0..1 per Season)

The Crop Zone references:

Key Concepts

ConceptDescription
Crop ZoneUnique seasonal representation of a field (Season Γ— Field)
PeriodStart / end datetimes start_date / end_date (UTC+0 ISO 8601) defining active crop window
Agronomic InfoNested object aggregating varieties, planting/emergence, yield, spacing, irrigation, etc.
VarietiesSet of variety UUIDs planted in that season on the field
UniquenessAt most one Crop Zone exists for a given Season + Field pair
GeometryOptional valid GeoJSON Polygon (WGS84 lon/lat, closed ring, non self-intersecting)

Uniqueness & Integrity Rules

RuleRationale
(season_id, field_id) must be uniquePrevent conflicting agronomic data
Field must belong to a Property under same Organization as SeasonConsistent ownership & ACLs
Period start_date < end_dateValid temporal interval
(Recommended) Period lies inside Season timeframeLogical containment
Geometry (if provided) valid GeoJSON PolygonSpatial integrity

Attempting to create a second crop zone for the same Season + Field returns a conflict (409) or validation error. Query first or use idempotent logic.

Business Rules (Create & Update)

Permissions

  • Caller must have create permission for every involved organization (derived from each property's company) or request is rejected.

Existence & Ownership

  • All referenced properties, seasons, and fields must exist.
  • Each field must belong to the referenced property; mismatches fail validation.
  • Season and property must belong to the same company.
  • Fields must be available (not archived / blocked).

Duplicate Handling & Soft-Deleted Reuse

  • (season_id, field_id) uniqueness enforced; creation path reuses an existing (even soft-deleted) crop zone record (reactivates & overwrites data) instead of inserting a new row.

Geometry

  • If payload includes geometry (no geometry_id) a new geometry is persisted; calculated area stored.
  • Geometry MUST be a valid GeoJSON Polygon: WGS84 [longitude, latitude], first and last coordinate identical, no self-intersections, coordinates within [-180..180, -90..90].
  • If geometry is omitted today no automatic derivation occurs (planned future enhancement: derive from field geometry when absent).
  • On update, existing geometry reference retained unless a new one is supplied.
  • Spatial & temporal overlap checks run at property level; field-level collision checks ensure no active overlapping zones for same field.

Varieties & Agronomic Info

  • If season has a crop_id, any variety IDs must exist in the crop's catalog.

Temporal Adjustments

  • On update the new period is applied before validations so overlap checks use incoming dates.
  • After create/update, affected season start/end may be recomputed (aggregate across its crop zones / land scope).

Batch Transaction

  • Each batch is atomic: any failure aborts all creates/updates.
  • Preloads: existing crop zones (by property/field), previous versions (for update), seasons, properties, fields, geometries.

API Documentation

For complete API reference including request/response schemas, authentication, and interactive testing, visit:

πŸ“š Crop Zones API Documentation - Interactive API documentation with request/response examples

Available Endpoints

Method & PathPurpose
POST /v3/cropzonesCreate a crop zone
PUT /v3/cropzonesUpdate (single) crop zone (full body)
DELETE /v3/cropzonesDelete multiple crop zones (IDs in body)
POST /v3/cropzones/batchBatch create
PUT /v3/cropzones/batchBatch update
DELETE /v3/cropzones/batchBatch delete
GET /v3/cropzones/{uuid}Retrieve by ID
DELETE /v3/cropzones/{uuid}Delete by ID
GET /v3/cropzones/org/{uuid}List by organization
GET /v3/cropzones/property/{uuid}List by property
POST /v3/cropzones/listFilter / paginate

Best Practices

PracticeWhy
Enforce (season_id, field_id) uniqueness client-sideReduce conflicts & retries
Use batch endpoints for bulk ingestionEfficiency & atomicity at request level
Normalise geometry on createStable spatial comparisons
Record all planting/emergence eventsBetter agronomic analytics
Avoid geometry in frequent pollingLower bandwidth
Avoid large (> 100) batch sizes in POST and PUTExcessive load and possible timeouts

Error Codes

Detailed (non-exhaustive) errors surfaced during create & update flows. Some codes listed for completeness though not always triggered in standard paths.

Permission / Auth

CodeHTTPMessageTrigger
EIAM001403 FORBIDDENAccount does not have permission to perform this operationMissing crop zone create/update org permission or RBAC denial

Property

CodeHTTPMessageTrigger
EPRO007404 NOT_FOUNDProperty does not existReferenced property id missing

Season

CodeHTTPMessageTrigger
ESEA009404 NOT_FOUNDSeason does not existReferenced season id missing
ESEA012400 BAD_REQUESTSeasons org and properties org must be the sameSeason & property company mismatch
ESEA006400 BAD_REQUESTInvalid varietyNew variety ids not in catalog for season crop
ESEA007400 BAD_REQUESTInvalid Start Date(Indirect) recomputed season start invalid after adjustments
ESEA008400 BAD_REQUESTStart date cannot be after end date(Indirect) recomputed bounds inverted

Crop Zone

CodeHTTPMessageTrigger
CZE003404 NOT_FOUNDThere no CropZone with this IDMissing existing crop zone during update lookup
CZE002400 BAD_REQUESTOne or more IDs at the UPDATE section does not existBatch update includes non-existent IDs
CZE001400 BAD_REQUESTID null in bulk (not typical)Bulk validation (other flows)
CZE004400 BAD_REQUESTAll IDs in section do not existBulk validation (other flows)
CZE005400 BAD_REQUESTCropZone already exists for %sLegacy duplicate path (creation now reuses existing)
CZE006400 BAD_REQUESTEither cycle_ids and season_ids may be present. Not bothConflicting list/filter parameters (not create/update)

Geometry & Spatial / Temporal

SituationHTTPDescription
Spatial overlap (property)400 BAD_REQUESTOverlap with other crop zones in same property
Field-level collision400 BAD_REQUESTAnother active crop zone for same field conflicts
Invalid geometry400 BAD_REQUESTMalformed / self-intersecting polygon
Period invalid400 BAD_REQUESTstart_date >= end_date or violates internal constraints

Generic / Other

SituationHTTPDescription
Resource not found404 NOT_FOUNDGeneric missing referenced entity
Duplicate Season Γ— Field (attempt)409 CONFLICTUniqueness attempt when reuse logic not applied
Permission denied (any stage)403 FORBIDDENLacking required scope / RBAC

Next Steps