> ## 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.

# Irrigation

> Retrieve irrigation equipment, applied irrigation records, and field irrigation data from Lindsay and Valley systems through the Leaf API.

Use these endpoints to retrieve irrigation equipment, applied irrigation records, and field irrigation data from Lindsay and Valley systems connected through a Leaf user.

For conceptual background, see [Irrigation Overview](/irrigation/overview).

## Base URL

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

## Endpoints

| Endpoint                                                                                              | Method                                                          | Path                                                                             |
| ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| [Get all irrigation equipment](#get-all-irrigation-equipment)                                         | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> | `/users/{leafUserId}/irrigation-equipment`                                       |
| [Get an irrigation equipment](#get-an-irrigation-equipment)                                           | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> | `/users/{leafUserId}/irrigation-equipment/{id}`                                  |
| [Get as-applied irrigation](#get-as-applied-irrigation)                                               | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> | `/users/{leafUserId}/irrigation/applied-irrigation`                              |
| [Get an irrigation activity](#get-an-irrigation-activity)                                             | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> | `/users/{leafUserId}/irrigation/applied-irrigation/{id}`                         |
| [Get an irrigation activity standard GeoJSON](#get-an-irrigation-activity-standard-geojson)           | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> | `/users/{leafUserId}/irrigation/applied-irrigation/{id}/standardGeojson`         |
| [Get an irrigation activity units](#get-an-irrigation-activity-units)                                 | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> | `/users/{leafUserId}/irrigation/applied-irrigation/{id}/units`                   |
| [Get all irrigated fields](#get-all-irrigated-fields)                                                 | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> | `/users/{leafUserId}/irrigation/fields`                                          |
| [Get an irrigated field](#get-an-irrigated-field)                                                     | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> | `/users/{leafUserId}/irrigation/fields/{fieldId}`                                |
| [Get an irrigated field activity](#get-an-irrigated-field-activity)                                   | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> | `/users/{leafUserId}/irrigation/fields/{fieldId}/irrigated/{id}`                 |
| [Get an irrigated field activity standard GeoJSON](#get-an-irrigated-field-activity-standard-geojson) | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> | `/users/{leafUserId}/irrigation/fields/{fieldId}/irrigated/{id}/standardGeojson` |
| [Get an irrigated field activity units](#get-an-irrigated-field-activity-units)                       | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> | `/users/{leafUserId}/irrigation/fields/{fieldId}/irrigated/{id}/units`           |

***

## Equipment

### Get all irrigation equipment

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/users/{leafUserId}/irrigation-equipment`

Lists all irrigation system equipment available for a given Leaf user.

#### Parameters

| Parameter             | Type        | Description                                      |
| --------------------- | ----------- | ------------------------------------------------ |
| `leafUserId`          | path (UUID) | The Leaf user ID.                                |
| `providerEquipmentId` | string      | Filter by the equipment ID on the provider side. |
| `provider`            | string      | Filter by provider (`Lindsay` or `Valley`).      |

#### Request

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

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/irrigation/api/users/{leafUserId}/irrigation-equipment"
  headers = {"Authorization": f"Bearer {TOKEN}"}
  params = {"provider": "Lindsay"}

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

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

  const endpoint = 'https://api.withleaf.io/services/irrigation/api/users/{leafUserId}/irrigation-equipment'
  const headers = { Authorization: `Bearer ${TOKEN}` }
  const params = { provider: 'Lindsay' }

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

#### Response

```json theme={null}
[
  {
    "id": "uuid",
    "providerEquipmentId": "uuid",
    "provider": "Lindsay",
    "name": "HHD 700C",
    "type": "pivot",
    "pivotLength": {
      "value": 0.0,
      "unit": "m"
    },
    "endgunLength": {
      "value": 0.0,
      "unit": "m"
    },
    "pivotRuntime": {
      "value": 0.0,
      "unit": "hr"
    },
    "brand": "unknown",
    "originalEquipmentData": {
      "equipmentType": "",
      "equipmentSubType": ""
    }
  }
]
```

***

### Get an irrigation equipment

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/users/{leafUserId}/irrigation-equipment/{id}`

Returns a single irrigation equipment record by ID.

#### Parameters

| Parameter    | Type        | Description       |
| ------------ | ----------- | ----------------- |
| `leafUserId` | path (UUID) | The Leaf user ID. |
| `id`         | path (UUID) | The equipment ID. |

#### Request

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

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/irrigation/api/users/{leafUserId}/irrigation-equipment/{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/irrigation/api/users/{leafUserId}/irrigation-equipment/{id}'
  const headers = { Authorization: `Bearer ${TOKEN}` }

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

#### Response

Returns a single equipment object (same shape as the objects in the [Get all irrigation equipment](#get-all-irrigation-equipment) response).

***

## Applied Irrigation

### Get as-applied irrigation

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/users/{leafUserId}/irrigation/applied-irrigation`

Lists all irrigation activities from supported providers, summarized by day.

#### Parameters

| Parameter    | Type              | Description                                        |
| ------------ | ----------------- | -------------------------------------------------- |
| `leafUserId` | path (UUID)       | The Leaf user ID.                                  |
| `provider`   | string            | Filter by provider (`Lindsay` or `Valley`).        |
| `startTime`  | string (ISO 8601) | Return irrigation data from this timestamp onward. |
| `endTime`    | string (ISO 8601) | Return irrigation data up to this timestamp.       |

#### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/irrigation/api/users/{leafUserId}/irrigation/applied-irrigation?provider=Lindsay&startTime=2024-01-01T00:00:00Z&endTime=2024-01-31T23:59:59Z'
  ```

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/irrigation/api/users/{leafUserId}/irrigation/applied-irrigation"
  headers = {"Authorization": f"Bearer {TOKEN}"}
  params = {
      "provider": "Lindsay",
      "startTime": "2024-01-01T00:00:00Z",
      "endTime": "2024-01-31T23:59:59Z"
  }

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

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

  const endpoint = 'https://api.withleaf.io/services/irrigation/api/users/{leafUserId}/irrigation/applied-irrigation'
  const headers = { Authorization: `Bearer ${TOKEN}` }
  const params = {
    provider: 'Lindsay',
    startTime: '2024-01-01T00:00:00Z',
    endTime: '2024-01-31T23:59:59Z'
  }

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

#### Response

```json theme={null}
[
  {
    "id": "uuid",
    "provider": "Lindsay",
    "standardGeojson": "url.json",
    "downloadStandardGeojson": "url.json",
    "leafUserId": "uuid",
    "apiOwnerUsername": "apiowner@withleaf.io",
    "summary": {
      "type": "Feature",
      "properties": {
        "depth": {
          "avg": 4.87,
          "sum": 28.36,
          "min": 2.53,
          "max": 7.49,
          "unit": "mm"
        },
        "totalArea": {
          "value": 52.72,
          "unit": "ha"
        },
        "totalVolume": {
          "value": 1604.7,
          "unit": "L"
        },
        "totalPowerOn": {
          "value": 16.7,
          "unit": "hr"
        }
      },
      "geometry": {}
    },
    "equipment": [
      {
        "id": "uuid",
        "name": "My Pivot",
        "type": "pivot",
        "providerEquipmentId": "d0245010-157d-4988-96a2-5f3637098475"
      }
    ],
    "createdTime": "2024-03-04T00:31:25.497Z",
    "startTime": "2024-01-07T00:00:00Z",
    "endTime": "2024-01-07T23:59:59Z"
  }
]
```

***

### Get an irrigation activity

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/users/{leafUserId}/irrigation/applied-irrigation/{id}`

Returns a single as-applied irrigation activity by ID.

#### Parameters

| Parameter    | Type        | Description                 |
| ------------ | ----------- | --------------------------- |
| `leafUserId` | path (UUID) | The Leaf user ID.           |
| `id`         | path (UUID) | The irrigation activity ID. |

#### Request

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

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/irrigation/api/users/{leafUserId}/irrigation/applied-irrigation/{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/irrigation/api/users/{leafUserId}/irrigation/applied-irrigation/{id}'
  const headers = { Authorization: `Bearer ${TOKEN}` }

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

#### Response

Returns a single irrigation activity object (same shape as the objects in the [Get as-applied irrigation](#get-as-applied-irrigation) response).

***

### Get an irrigation activity standard GeoJSON

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/users/{leafUserId}/irrigation/applied-irrigation/{id}/standardGeojson`

Returns the standard GeoJSON links for a single irrigation activity.

#### Parameters

| Parameter    | Type        | Description                 |
| ------------ | ----------- | --------------------------- |
| `leafUserId` | path (UUID) | The Leaf user ID.           |
| `id`         | path (UUID) | The irrigation activity ID. |

#### Response

```json theme={null}
{
  "standardGeojson": "url.json",
  "downloadStandardGeojson": "url.json"
}
```

***

### Get an irrigation activity units

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/users/{leafUserId}/irrigation/applied-irrigation/{id}/units`

Returns the units used by a single irrigation activity.

#### Parameters

| Parameter    | Type        | Description                 |
| ------------ | ----------- | --------------------------- |
| `leafUserId` | path (UUID) | The Leaf user ID.           |
| `id`         | path (UUID) | The irrigation activity ID. |

#### Response

```json theme={null}
{
  "depth": "mm",
  "area": "ha",
  "volume": "L"
}
```

***

## Irrigated Fields

### Get all irrigated fields

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/users/{leafUserId}/irrigation/fields`

Lists all fields that have received irrigation.

#### Parameters

| Parameter     | Type              | Description                                        |
| ------------- | ----------------- | -------------------------------------------------- |
| `leafUserId`  | path (UUID)       | The Leaf user ID.                                  |
| `equipmentId` | string (UUID)     | Filter by Leaf equipment ID.                       |
| `startTime`   | string (ISO 8601) | Return irrigation data from this timestamp onward. |
| `endTime`     | string (ISO 8601) | Return irrigation data up to this timestamp.       |

#### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/irrigation/api/users/{leafUserId}/irrigation/fields?equipmentId={equipmentId}&startTime=2024-01-01T00:00:00Z&endTime=2024-01-31T23:59:59Z'
  ```

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/irrigation/api/users/{leafUserId}/irrigation/fields"
  headers = {"Authorization": f"Bearer {TOKEN}"}
  params = {
      "equipmentId": "{equipmentId}",
      "startTime": "2024-01-01T00:00:00Z",
      "endTime": "2024-01-31T23:59:59Z"
  }

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

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

  const endpoint = 'https://api.withleaf.io/services/irrigation/api/users/{leafUserId}/irrigation/fields'
  const headers = { Authorization: `Bearer ${TOKEN}` }
  const params = {
    equipmentId: '{equipmentId}',
    startTime: '2024-01-01T00:00:00Z',
    endTime: '2024-01-31T23:59:59Z'
  }

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

#### Response

```json theme={null}
[
  {
    "fieldId": "95eb7d79-b93d-4fc2-877a-3f2b366f8beb",
    "lastIrrigationTime": "2024-02-18T23:59:59.000000Z"
  }
]
```

***

### Get an irrigated field

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/users/{leafUserId}/irrigation/fields/{fieldId}`

Returns the irrigation records associated with a single field.

#### Parameters

| Parameter      | Type              | Description                                        |
| -------------- | ----------------- | -------------------------------------------------- |
| `leafUserId`   | path (UUID)       | The Leaf user ID.                                  |
| `fieldId`      | path (UUID)       | The field ID.                                      |
| `irrigationId` | string (UUID)     | Filter by as-applied irrigation ID.                |
| `provider`     | string            | Filter by provider (`Lindsay` or `Valley`).        |
| `startTime`    | string (ISO 8601) | Return irrigation data from this timestamp onward. |
| `endTime`      | string (ISO 8601) | Return irrigation data up to this timestamp.       |

This endpoint relies on existing field boundaries for the Leaf user. Valley does not provide field boundaries, and Lindsay requires the FieldNET Advisor product to make them available.

#### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/irrigation/api/users/{leafUserId}/irrigation/fields/{fieldId}?provider=Lindsay&startTime=2024-01-01T00:00:00Z&endTime=2024-01-31T23:59:59Z'
  ```

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/irrigation/api/users/{leafUserId}/irrigation/fields/{fieldId}"
  headers = {"Authorization": f"Bearer {TOKEN}"}
  params = {
      "provider": "Lindsay",
      "startTime": "2024-01-01T00:00:00Z",
      "endTime": "2024-01-31T23:59:59Z"
  }

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

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

  const endpoint = 'https://api.withleaf.io/services/irrigation/api/users/{leafUserId}/irrigation/fields/{fieldId}'
  const headers = { Authorization: `Bearer ${TOKEN}` }
  const params = {
    provider: 'Lindsay',
    startTime: '2024-01-01T00:00:00Z',
    endTime: '2024-01-31T23:59:59Z'
  }

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

#### Response

```json theme={null}
[
  {
    "id": "uuid",
    "fieldId": "uuid",
    "irrigationId": ["uuid"],
    "provider": "Lindsay",
    "standardGeojson": "url.json",
    "downloadStandardGeojson": "url.json",
    "leafUserId": "uuid",
    "apiOwnerUsername": "apiowner@withleaf.io",
    "summary": {
      "type": "Feature",
      "properties": {
        "depth": {
          "avg": 4.87,
          "sum": 28.36,
          "min": 2.53,
          "max": 7.49,
          "unit": "mm"
        },
        "totalArea": {
          "value": 49.48,
          "unit": "ha"
        },
        "totalVolume": {
          "value": 1604.7,
          "unit": "L"
        },
        "totalPowerOn": {
          "value": 16.7,
          "unit": "hr"
        },
        "coverage": {
          "value": 81.51,
          "unit": "percentage"
        }
      },
      "geometry": {}
    },
    "equipment": [
      {
        "id": "uuid",
        "name": "My Pivot",
        "type": "pivot",
        "providerEquipmentId": "d0245010-157d-4988-96a2-5f3637098475"
      }
    ],
    "createdTime": "2024-03-04T00:31:25.497Z",
    "startTime": "2024-01-07T00:00:00Z",
    "endTime": "2024-01-07T23:59:59Z"
  }
]
```

***

### Get an irrigated field activity standard GeoJSON

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/users/{leafUserId}/irrigation/fields/{fieldId}/irrigated/{id}/standardGeojson`

Returns the standard GeoJSON links for a single irrigated field activity.

#### Parameters

| Parameter    | Type        | Description                 |
| ------------ | ----------- | --------------------------- |
| `leafUserId` | path (UUID) | The Leaf user ID.           |
| `fieldId`    | path (UUID) | The field ID.               |
| `id`         | path (UUID) | The irrigation activity ID. |

#### Response

```json theme={null}
{
  "standardGeojson": "url.json",
  "downloadStandardGeojson": "url.json"
}
```

***

### Get an irrigated field activity units

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/users/{leafUserId}/irrigation/fields/{fieldId}/irrigated/{id}/units`

Returns the units used by a single irrigated field activity.

#### Parameters

| Parameter    | Type        | Description                 |
| ------------ | ----------- | --------------------------- |
| `leafUserId` | path (UUID) | The Leaf user ID.           |
| `fieldId`    | path (UUID) | The field ID.               |
| `id`         | path (UUID) | The irrigation activity ID. |

#### Response

```json theme={null}
{
  "depth": "mm",
  "area": "ha",
  "volume": "L"
}
```

***

### Get an irrigated field activity

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/users/{leafUserId}/irrigation/fields/{fieldId}/irrigated/{id}`

Returns a single irrigation activity record associated with the specified field.

#### Parameters

| Parameter    | Type        | Description                 |
| ------------ | ----------- | --------------------------- |
| `leafUserId` | path (UUID) | The Leaf user ID.           |
| `fieldId`    | path (UUID) | The field ID.               |
| `id`         | path (UUID) | The irrigation activity ID. |

#### Request

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

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/irrigation/api/users/{leafUserId}/irrigation/fields/{fieldId}/irrigated/{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/irrigation/api/users/{leafUserId}/irrigation/fields/{fieldId}/irrigated/{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": "uuid",
  "fieldId": "uuid",
  "irrigationId": ["uuid"],
  "provider": "Lindsay",
  "standardGeojson": "url.json",
  "downloadStandardGeojson": "url.json",
  "leafUserId": "uuid",
  "apiOwnerUsername": "apiowner@withleaf.io",
  "summary": {
    "type": "Feature",
    "properties": {
      "depth": {
        "avg": 4.87,
        "sum": 28.36,
        "min": 2.53,
        "max": 7.49,
        "unit": "mm"
      },
      "totalArea": {
        "value": 49.48,
        "unit": "ha"
      },
      "totalVolume": {
        "value": 1604.7,
        "unit": "L"
      },
      "totalPowerOn": {
        "value": 16.7,
        "unit": "hr"
      },
      "coverage": {
        "value": 81.51,
        "unit": "percentage"
      }
    },
    "geometry": {}
  },
  "equipment": [
    {
      "id": "uuid",
      "name": "My Pivot",
      "type": "pivot",
      "providerEquipmentId": "d0245010-157d-4988-96a2-5f3637098475"
    }
  ],
  "createdTime": "2024-03-04T00:31:25.497Z",
  "startTime": "2024-01-07T00:00:00Z",
  "endTime": "2024-01-07T23:59:59Z"
}
```
