> ## Documentation Index
> Fetch the complete documentation index at: https://docs.withleaf.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Field Operations

> List and retrieve standardized field operations (planting, harvest, application, tillage) and their GeoJSON, summary, and image outputs through the Leaf API.

Use the operations endpoints to list and inspect Leaf's merged field operations after machine files have been converted and allocated to field boundaries. This page covers operation retrieval, summaries, GeoJSON and GeoParquet outputs, images, units, and reprocessing.

For conceptual background, see [Field Operations](/machine-data/field-operations).

## Base URL

```
https://api.withleaf.io/services/operations/api
```

## Endpoints

| Method                                                           | Path                                  | Description                                                                 |
| ---------------------------------------------------------------- | ------------------------------------- | --------------------------------------------------------------------------- |
| <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/operations`                         | [Get all field operations](#get-all-field-operations)                       |
| <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/operations/{id}`                    | [Get a field operation](#get-a-field-operation)                             |
| <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/operations/{id}/summary`            | [Get operation summary](#get-operation-summary)                             |
| <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/operations/{id}/standardGeojson`    | [Get operation standardGeojson](#get-operation-standardgeojson)             |
| <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/operations/{id}/standardGeoparquet` | [Get operation standardGeoParquet](#get-operation-standardgeoparquet)       |
| <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/operations/{id}/filteredGeojson`    | [Get operation filteredGeojson](#get-operation-filteredgeojson)             |
| <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/operations/{id}/filteredGeoparquet` | [Get operation filteredGeoParquet](#get-operation-filteredgeoparquet)       |
| <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/operations/{id}/imagesV2`           | [Get operation images](#get-operation-images)                               |
| <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/operations/{id}/geotiffImages`      | [Get operation geotiff images](#get-operation-geotiff-images)               |
| <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/operations/{id}/units`              | [Get operation units](#get-operation-units)                                 |
| <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/operations/{id}/machines`           | [Get operation machines](#get-operation-machines)                           |
| <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/operations/{id}/implements`         | [Get operation implements](#get-operation-implements)                       |
| <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/operations/{id}/operators`          | [Get operation operators](#get-operation-operators)                         |
| <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/operations/{id}/sessions`           | [Get operation sessions](#get-operation-sessions)                           |
| <span style={{fontWeight: 'bold', color: '#e5a00d'}}>POST</span> | `/operations/cropOperationByField`    | [Crop operation by field](#crop-operation-by-field)                         |
| <span style={{fontWeight: 'bold', color: '#e5a00d'}}>POST</span> | `/operations/reprocess`               | [Reprocess field operations by field](#reprocess-field-operations-by-field) |
| <span style={{fontWeight: 'bold', color: '#e5a00d'}}>POST</span> | `/operations/{id}/reprocess`          | [Reprocess an operation](#reprocess-an-operation)                           |
| <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/operations/{id}/files`              | [Get files from an operation](#get-files-from-an-operation)                 |

***

## Get all field operations

<span style={{color: 'green', fontWeight: 'bold'}}>GET</span> `/operations`

Returns a paginated list of field operations for the authenticated API owner.

### Parameters

| Parameter       | Type    | Description                                                                                                           |
| --------------- | ------- | --------------------------------------------------------------------------------------------------------------------- |
| `leafUserId`    | string  | UUID of a Leaf user                                                                                                   |
| `provider`      | string  | `CNHI`, `JohnDeere`, `Trimble`, `ClimateFieldView`, `AgLeader`, `Stara`, `Panorama`, or `Leaf`                        |
| `startTime`     | string  | ISO 8601 timestamp. Returns operations starting on or after this time                                                 |
| `updatedTime`   | string  | ISO 8601 timestamp. Returns operations updated on or after this time                                                  |
| `endTime`       | string  | ISO 8601 timestamp. Returns operations ending on or before this time                                                  |
| `operationType` | string  | `applied`, `planted`, `harvested`, or `tillage`                                                                       |
| `fieldId`       | string  | UUID of the field where the operation occurred                                                                        |
| `fileId`        | string  | UUID of a machine file associated with the operation                                                                  |
| `zoneId`        | string  | UUID of a zone associated with the operation                                                                          |
| `standard`      | boolean | Filter by whether the operation has a standardGeojson                                                                 |
| `page`          | integer | Page number (default `0`)                                                                                             |
| `size`          | integer | Page size (max `100`)                                                                                                 |
| `sort`          | string  | Sort order. Valid fields: `id`, `leafUserId`, `startTime`, `endTime`, `type`, `updatedTime`. Append `,asc` or `,desc` |

<Info>The default page size is 20 when `page` and `size` are not set.</Info>

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/operations/api/operations?leafUserId=UUID'
  ```

  ```python Python theme={null}
  import requests

  TOKEN = 'YOUR_TOKEN'
  endpoint = 'https://api.withleaf.io/services/operations/api/operations'
  headers = {'Authorization': f'Bearer {TOKEN}'}

  response = requests.get(endpoint, headers=headers, params={'leafUserId': 'UUID'})
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const TOKEN = 'YOUR_TOKEN'

  const endpoint = 'https://api.withleaf.io/services/operations/api/operations'
  const headers = { 'Authorization': `Bearer ${TOKEN}` }

  axios.get(endpoint, { headers, params: { leafUserId: 'UUID' } })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>

### Response

```json theme={null}
[
  {
    "id": "5c8fdb34-4dc4-4b96-bfd5-53e6206ce971",
    "apiOwnerUsername": "test",
    "leafUserId": "7494c90e-28b8-4bb2-9ede-95c1cc894349",
    "startTime": "2015-04-18T19:31:27Z",
    "endTime": "2015-04-18T19:58:50Z",
    "updatedTime": "2021-08-24T16:00:15.062Z",
    "type": "planted",
    "files": ["a10b85c2-ac2e-4b0f-8e65-74edbd2ca53e"],
    "fields": [{ "id": "0071484f-4a75-4190-9fd0-f5995d241c2c" }],
    "providers": ["providerName"]
  }
]
```

***

## Get a field operation

<span style={{color: 'green', fontWeight: 'bold'}}>GET</span> `/operations/{id}`

Returns a single field operation by its UUID.

### Parameters

| Parameter | Type | Description           |
| --------- | ---- | --------------------- |
| `id`      | path | UUID of the operation |

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/operations/api/operations/{id}'
  ```

  ```python Python theme={null}
  import requests

  TOKEN = 'YOUR_TOKEN'
  endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}'
  headers = {'Authorization': f'Bearer {TOKEN}'}

  response = requests.get(endpoint, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const TOKEN = 'YOUR_TOKEN'

  const endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}'
  const headers = { 'Authorization': `Bearer ${TOKEN}` }

  axios.get(endpoint, { headers })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "id": "5c8fdb34-4dc4-4b96-bfd5-53e6206ce971",
  "apiOwnerUsername": "test",
  "leafUserId": "7494c90e-28b8-4bb2-9ede-95c1cc894349",
  "startTime": "2015-04-18T19:31:27Z",
  "endTime": "2015-04-18T19:58:50Z",
  "updatedTime": "2021-08-24T16:00:15.062Z",
  "type": "planted",
  "files": ["a10b85c2-ac2e-4b0f-8e65-74edbd2ca53e"],
  "fields": [{ "id": "0071484f-4a75-4190-9fd0-f5995d241c2c" }],
  "providers": ["providerName"]
}
```

***

## Get operation summary

<span style={{color: 'green', fontWeight: 'bold'}}>GET</span> `/operations/{id}/summary`

Returns the GeoJSON summary for a field operation. The summary contains aggregated statistics such as area, elevation, speed, and operation-specific properties (e.g., seed rate, applied rate, yield).

### Parameters

| Parameter | Type | Description           |
| --------- | ---- | --------------------- |
| `id`      | path | UUID of the operation |

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/operations/api/operations/{id}/summary'
  ```

  ```python Python theme={null}
  import requests

  TOKEN = 'YOUR_TOKEN'
  endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/summary'
  headers = {'Authorization': f'Bearer {TOKEN}'}

  response = requests.get(endpoint, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const TOKEN = 'YOUR_TOKEN'

  const endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/summary'
  const headers = { 'Authorization': `Bearer ${TOKEN}` }

  axios.get(endpoint, { headers })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>

***

## Get operation standardGeojson

<span style={{color: 'green', fontWeight: 'bold'}}>GET</span> `/operations/{id}/standardGeojson`

Returns a URL to the standardGeojson file for the operation. This file contains all data points in Leaf's standardized schema.

### Parameters

| Parameter | Type | Description           |
| --------- | ---- | --------------------- |
| `id`      | path | UUID of the operation |

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/operations/api/operations/{id}/standardGeojson'
  ```

  ```python Python theme={null}
  import requests

  TOKEN = 'YOUR_TOKEN'
  endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/standardGeojson'
  headers = {'Authorization': f'Bearer {TOKEN}'}

  response = requests.get(endpoint, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const TOKEN = 'YOUR_TOKEN'

  const endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/standardGeojson'
  const headers = { 'Authorization': `Bearer ${TOKEN}` }

  axios.get(endpoint, { headers })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "downloadStandardGeojson": "URL"
}
```

***

## Get operation standardGeoParquet

<span style={{color: 'green', fontWeight: 'bold'}}>GET</span> `/operations/{id}/standardGeoparquet`

Returns a URL to the standard GeoParquet file for the operation.

<Tip>You must enable the `enableGeoparquetOutput` configuration to use this endpoint.</Tip>

### Parameters

| Parameter | Type | Description           |
| --------- | ---- | --------------------- |
| `id`      | path | UUID of the operation |

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/operations/api/operations/{id}/standardGeoparquet'
  ```

  ```python Python theme={null}
  import requests

  TOKEN = 'YOUR_TOKEN'
  endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/standardGeoparquet'
  headers = {'Authorization': f'Bearer {TOKEN}'}

  response = requests.get(endpoint, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const TOKEN = 'YOUR_TOKEN'

  const endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/standardGeoparquet'
  const headers = { 'Authorization': `Bearer ${TOKEN}` }

  axios.get(endpoint, { headers })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "downloadStandardGeoparquet": "URL"
}
```

***

## Get operation filteredGeojson

<span style={{color: 'green', fontWeight: 'bold'}}>GET</span> `/operations/{id}/filteredGeojson`

Returns a URL to the filteredGeojson file for the operation. This file contains data points after Leaf applies statistical outlier removal.

<Tip>You must enable the `operationsFilteredGeojson` configuration to use this endpoint.</Tip>

### Parameters

| Parameter | Type | Description           |
| --------- | ---- | --------------------- |
| `id`      | path | UUID of the operation |

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/operations/api/operations/{id}/filteredGeojson'
  ```

  ```python Python theme={null}
  import requests

  TOKEN = 'YOUR_TOKEN'
  endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/filteredGeojson'
  headers = {'Authorization': f'Bearer {TOKEN}'}

  response = requests.get(endpoint, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const TOKEN = 'YOUR_TOKEN'

  const endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/filteredGeojson'
  const headers = { 'Authorization': `Bearer ${TOKEN}` }

  axios.get(endpoint, { headers })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "filteredGeojson": "URL",
  "downloadFilteredGeoJson": "URL"
}
```

***

## Get operation filteredGeoParquet

<span style={{color: 'green', fontWeight: 'bold'}}>GET</span> `/operations/{id}/filteredGeoparquet`

Returns a URL to the filtered GeoParquet file for the operation.

<Tip>You must enable both `operationsFilteredGeojson` and `enableGeoparquetOutput` configurations to use this endpoint.</Tip>

### Parameters

| Parameter | Type | Description           |
| --------- | ---- | --------------------- |
| `id`      | path | UUID of the operation |

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/operations/api/operations/{id}/filteredGeoparquet'
  ```

  ```python Python theme={null}
  import requests

  TOKEN = 'YOUR_TOKEN'
  endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/filteredGeoparquet'
  headers = {'Authorization': f'Bearer {TOKEN}'}

  response = requests.get(endpoint, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const TOKEN = 'YOUR_TOKEN'

  const endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/filteredGeoparquet'
  const headers = { 'Authorization': `Bearer ${TOKEN}` }

  axios.get(endpoint, { headers })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "downloadFilteredGeoparquet": "URL"
}
```

***

## Get operation images

<span style={{color: 'green', fontWeight: 'bold'}}>GET</span> `/operations/{id}/imagesV2`

Returns improved PNG images based on the filteredGeojson. Each image includes a quantile-classified legend with 7 color-coded ranges and an extent for map plotting.

### Parameters

| Parameter | Type | Description           |
| --------- | ---- | --------------------- |
| `id`      | path | UUID of the operation |

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/operations/api/operations/{id}/imagesV2'
  ```

  ```python Python theme={null}
  import requests

  TOKEN = 'YOUR_TOKEN'
  endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/imagesV2'
  headers = {'Authorization': f'Bearer {TOKEN}'}

  response = requests.get(endpoint, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const TOKEN = 'YOUR_TOKEN'

  const endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/imagesV2'
  const headers = { 'Authorization': `Bearer ${TOKEN}` }

  axios.get(endpoint, { headers })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>

### Response

```json theme={null}
[
  {
    "property": "elevation",
    "legend": {
      "ranges": [
        { "colorCode": "#C80000", "min": 0, "max": 20 },
        { "colorCode": "#FF2800", "min": 20, "max": 50 },
        { "colorCode": "#FF9600", "min": 50, "max": 100 },
        { "colorCode": "#FFF000", "min": 100, "max": 250 },
        { "colorCode": "#00E600", "min": 250, "max": 340 },
        { "colorCode": "#00BE00", "min": 340, "max": 480 },
        { "colorCode": "#008200", "min": 480, "max": 570 }
      ]
    },
    "extent": { "xmin": 0, "xmax": 0, "ymin": 0, "ymax": 0 },
    "url": "URL",
    "downloadUrl": "URL"
  }
]
```

***

## Get operation geotiff images

<span style={{color: 'green', fontWeight: 'bold'}}>GET</span> `/operations/{id}/geotiffImages`

Returns a list of GeoTIFF images generated from the operation's properties based on the filteredGeojson.

### Parameters

| Parameter | Type | Description           |
| --------- | ---- | --------------------- |
| `id`      | path | UUID of the operation |

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/operations/api/operations/{id}/geotiffImages'
  ```

  ```python Python theme={null}
  import requests

  TOKEN = 'YOUR_TOKEN'
  endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/geotiffImages'
  headers = {'Authorization': f'Bearer {TOKEN}'}

  response = requests.get(endpoint, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const TOKEN = 'YOUR_TOKEN'

  const endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/geotiffImages'
  const headers = { 'Authorization': `Bearer ${TOKEN}` }

  axios.get(endpoint, { headers })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>

### Response

```json theme={null}
[
  {
    "property": "dryMassPerArea",
    "url": "URL",
    "downloadUrl": "URL"
  }
]
```

***

## Get operation units

<span style={{color: 'green', fontWeight: 'bold'}}>GET</span> `/operations/{id}/units`

Returns the property-to-unit mapping for the operation. Properties vary by operation type but use standardized keys across providers.

### Parameters

| Parameter | Type | Description           |
| --------- | ---- | --------------------- |
| `id`      | path | UUID of the operation |

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/operations/api/operations/{id}/units'
  ```

  ```python Python theme={null}
  import requests

  TOKEN = 'YOUR_TOKEN'
  endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/units'
  headers = {'Authorization': f'Bearer {TOKEN}'}

  response = requests.get(endpoint, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const TOKEN = 'YOUR_TOKEN'

  const endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/units'
  const headers = { 'Authorization': `Bearer ${TOKEN}` }

  axios.get(endpoint, { headers })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>

***

## Get operation machines

<span style={{color: 'green', fontWeight: 'bold'}}>GET</span> `/operations/{id}/machines`

Returns the UUIDs of machines used in the operation. Use the Assets endpoints to fetch full machine details.

### Parameters

| Parameter | Type | Description           |
| --------- | ---- | --------------------- |
| `id`      | path | UUID of the operation |

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/operations/api/operations/{id}/machines'
  ```

  ```python Python theme={null}
  import requests

  TOKEN = 'YOUR_TOKEN'
  endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/machines'
  headers = {'Authorization': f'Bearer {TOKEN}'}

  response = requests.get(endpoint, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const TOKEN = 'YOUR_TOKEN'

  const endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/machines'
  const headers = { 'Authorization': `Bearer ${TOKEN}` }

  axios.get(endpoint, { headers })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "machines": [
    "77385069-7666-4867-8d72-72c2584e2b4e",
    "baad537c-69e3-4d86-a99b-92d5b716b574"
  ]
}
```

***

## Get operation implements

<span style={{color: 'green', fontWeight: 'bold'}}>GET</span> `/operations/{id}/implements`

Returns the UUIDs of implements used in the operation. Use the Assets endpoints to fetch full implement details.

### Parameters

| Parameter | Type | Description           |
| --------- | ---- | --------------------- |
| `id`      | path | UUID of the operation |

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/operations/api/operations/{id}/implements'
  ```

  ```python Python theme={null}
  import requests

  TOKEN = 'YOUR_TOKEN'
  endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/implements'
  headers = {'Authorization': f'Bearer {TOKEN}'}

  response = requests.get(endpoint, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const TOKEN = 'YOUR_TOKEN'

  const endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/implements'
  const headers = { 'Authorization': `Bearer ${TOKEN}` }

  axios.get(endpoint, { headers })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "implements": [
    "1190bc0d-e94c-407a-8aba-ac4c6a1cd29b"
  ]
}
```

***

## Get operation operators

<span style={{color: 'green', fontWeight: 'bold'}}>GET</span> `/operations/{id}/operators`

Returns the UUIDs of operators who performed the operation. Use the Assets endpoints to fetch full operator details.

### Parameters

| Parameter | Type | Description           |
| --------- | ---- | --------------------- |
| `id`      | path | UUID of the operation |

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/operations/api/operations/{id}/operators'
  ```

  ```python Python theme={null}
  import requests

  TOKEN = 'YOUR_TOKEN'
  endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/operators'
  headers = {'Authorization': f'Bearer {TOKEN}'}

  response = requests.get(endpoint, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const TOKEN = 'YOUR_TOKEN'

  const endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/operators'
  const headers = { 'Authorization': `Bearer ${TOKEN}` }

  axios.get(endpoint, { headers })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "operators": [
    "f2f4723a-2bfe-472b-b6f7-7874c8500208"
  ]
}
```

***

## Get operation sessions

<span style={{color: 'green', fontWeight: 'bold'}}>GET</span> `/operations/{id}/sessions`

Returns compiled session data grouped by machine, with session time ranges, operator data, and covered area for each session in the operation.

<Warning>
  Requires the `enableOperationsSession` configuration. Currently available for John Deere operations only.
</Warning>

### Parameters

| Parameter | Type | Description           |
| --------- | ---- | --------------------- |
| `id`      | path | UUID of the operation |

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/operations/api/operations/{id}/sessions'
  ```

  ```python Python theme={null}
  import requests

  TOKEN = 'YOUR_TOKEN'
  endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/sessions'
  headers = {'Authorization': f'Bearer {TOKEN}'}

  response = requests.get(endpoint, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const TOKEN = 'YOUR_TOKEN'

  const endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/sessions'
  const headers = { 'Authorization': `Bearer ${TOKEN}` }

  axios.get(endpoint, { headers })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>

### Response

```json theme={null}
[
  {
    "machineId": "uuid",
    "serialNumber": "SERIALNUMBER001",
    "sessions": [
      {
        "id": "sessionId",
        "startTime": "2023-11-29T11:03:42",
        "endTime": "2023-11-29T20:58:36",
        "operator": { "id": "operatorId", "name": "Operator A" },
        "area": { "value": 18.215, "unit": "ha" }
      }
    ]
  }
]
```

***

## Crop operation by field

<span style={{color: 'orange', fontWeight: 'bold'}}>POST</span> `/operations/cropOperationByField`

Removes data points from the operation standardGeojson that fall outside the associated field boundary. Processing is asynchronous.

### Request body

```json theme={null}
{
  "id": "operationId"
}
```

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Content-Type: application/json' \
    -d '{"id": "operationId"}' \
    'https://api.withleaf.io/services/operations/api/operations/cropOperationByField'
  ```

  ```python Python theme={null}
  import requests

  TOKEN = 'YOUR_TOKEN'
  endpoint = 'https://api.withleaf.io/services/operations/api/operations/cropOperationByField'
  headers = {'Authorization': f'Bearer {TOKEN}'}

  response = requests.post(endpoint, headers=headers, json={'id': 'operationId'})
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const TOKEN = 'YOUR_TOKEN'

  const endpoint = 'https://api.withleaf.io/services/operations/api/operations/cropOperationByField'
  const headers = { 'Authorization': `Bearer ${TOKEN}` }

  axios.post(endpoint, { id: 'operationId' }, { headers })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "id": "1162a1c6-9872-4d7f-9833-5d48add8eed4",
  "message": "Sent operation to be processed.",
  "leafFileId": "33020f03-5889-4c0f-b465-7a7e2c03a91d"
}
```

<Tip>Use the `leafFileId` with the Alerts service to monitor processing status.</Tip>

***

## Reprocess field operations by field

<span style={{color: 'orange', fontWeight: 'bold'}}>POST</span> `/operations/reprocess`

Reprocesses field operations for one field and Leaf user. When `overwrite` is `true`, Leaf removes the existing operations for that field before regenerating them.

### Request body

```json theme={null}
{
  "leafUserId": "uuid",
  "fieldId": "uuid",
  "overwrite": true
}
```

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Content-Type: application/json' \
    -d '{"leafUserId":"uuid","fieldId":"uuid","overwrite":true}' \
    'https://api.withleaf.io/services/operations/api/operations/reprocess'
  ```

  ```python Python theme={null}
  import requests

  TOKEN = 'YOUR_TOKEN'
  endpoint = 'https://api.withleaf.io/services/operations/api/operations/reprocess'
  headers = {'Authorization': f'Bearer {TOKEN}'}

  data = {'leafUserId': 'uuid', 'fieldId': 'uuid', 'overwrite': True}

  response = requests.post(endpoint, headers=headers, json=data)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const TOKEN = 'YOUR_TOKEN'

  const endpoint = 'https://api.withleaf.io/services/operations/api/operations/reprocess'
  const headers = { 'Authorization': `Bearer ${TOKEN}` }

  const data = { leafUserId: 'uuid', fieldId: 'uuid', overwrite: true }

  axios.post(endpoint, data, { headers })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "totalFiles": 42,
  "message": "Sending files to create automerge and operations based on field"
}
```

***

## Reprocess an operation

<span style={{color: 'orange', fontWeight: 'bold'}}>POST</span> `/operations/{id}/reprocess`

Reprocesses an existing field operation starting from the merge step. The standardGeoJSON, filteredGeoJSON, summary, and images are regenerated.

### Parameters

| Parameter | Type | Description           |
| --------- | ---- | --------------------- |
| `id`      | path | UUID of the operation |

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/operations/api/operations/{id}/reprocess'
  ```

  ```python Python theme={null}
  import requests

  TOKEN = 'YOUR_TOKEN'
  endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/reprocess'
  headers = {'Authorization': f'Bearer {TOKEN}'}

  response = requests.post(endpoint, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const TOKEN = 'YOUR_TOKEN'

  const endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/reprocess'
  const headers = { 'Authorization': `Bearer ${TOKEN}` }

  axios.post(endpoint, {}, { headers })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>

<Tip>Use the Alerts service to monitor the reprocessing status.</Tip>

***

## Get files from an operation

<span style={{color: 'green', fontWeight: 'bold'}}>GET</span> `/operations/{id}/files`

Returns the machine files that were aggregated to produce the field operation.

### Parameters

| Parameter | Type    | Description                  |
| --------- | ------- | ---------------------------- |
| `id`      | path    | UUID of the operation        |
| `page`    | integer | Page number (default `0`)    |
| `size`    | integer | Page size (max `100`)        |
| `sort`    | string  | Sort order (e.g., `id,desc`) |

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/operations/api/operations/{id}/files'
  ```

  ```python Python theme={null}
  import requests

  TOKEN = 'YOUR_TOKEN'
  endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/files'
  headers = {'Authorization': f'Bearer {TOKEN}'}

  response = requests.get(endpoint, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const TOKEN = 'YOUR_TOKEN'

  const endpoint = 'https://api.withleaf.io/services/operations/api/operations/{id}/files'
  const headers = { 'Authorization': `Bearer ${TOKEN}` }

  axios.get(endpoint, { headers })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>
