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

# Beta Input

> Look up products, varieties, and tank mixes from provider databases like John Deere, Agrian, and CDMS. Match and validate inputs for field operations.

Use these endpoints to look up agricultural products, varieties, and tank mixes from standardized databases and to match product names from machine files against known products.

For conceptual background, see [Input Validator](/beta/input-validator).

<Warning>The Input API is currently in **beta**. Endpoints, request/response schemas, and behavior may change without notice.</Warning>

## Base URL

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

## Endpoints

### Products

| Endpoint                                                                            | Method                                                            | Path                                                                       |
| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------- | -------------------------------------------------------------------------- |
| [Get all products](#get-all-products)                                               | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>   | `/products`                                                                |
| [Get summarized products](#get-summarized-products)                                 | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>   | `/users/{leafUserId}/products/summary`                                     |
| [Search for products](#search-for-products)                                         | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>   | `/products/search`                                                         |
| [Get a product](#get-a-product)                                                     | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>   | `/products/{id}`                                                           |
| [Get matching products from an operation](#get-matching-products-from-an-operation) | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>   | `/products/matching/operations/{operationId}`                              |
| [Update product matches](#update-product-matches)                                   | <span style={{fontWeight: 'bold', color: '#e5a00d'}}>PATCH</span> | `/products/matching/operations/{operationId}/matches/{matchId}`            |
| [Get product matches historical](#get-product-matches-historical)                   | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>   | `/products/matching/operations/{operationId}/matches/{matchId}/historical` |

### Varieties

| Endpoint                                              | Method                                                          | Path                                    |
| ----------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------- |
| [Get all varieties](#get-all-varieties)               | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> | `/varieties`                            |
| [Get a variety](#get-a-variety)                       | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> | `/varieties/{id}`                       |
| [Get summarized varieties](#get-summarized-varieties) | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> | `/users/{leafUserId}/varieties/summary` |
| [Search for varieties](#search-for-varieties)         | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> | `/varieties/search`                     |

### Tank Mixes

| Endpoint                                        | Method                                                          | Path                |
| ----------------------------------------------- | --------------------------------------------------------------- | ------------------- |
| [Get all tank mixes](#get-all-tank-mixes)       | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> | `/tankMixes`        |
| [Search for tank mixes](#search-for-tank-mixes) | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> | `/tankMixes/search` |

***

## Products

### Get all products

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/products`

Returns a paginated list of products from providers at the Leaf user level. Currently supports John Deere products. This endpoint does **not** include products from label databases such as Agrian and CDMS — use [Search for products](#search-for-products) for those.

#### Parameters

| Parameter    | Type          | Description                                                                   |
| ------------ | ------------- | ----------------------------------------------------------------------------- |
| `leafUserId` | string (UUID) | Filter by Leaf user.                                                          |
| `provider`   | string        | Filter by provider (`JohnDeere`).                                             |
| `page`       | integer       | Page number (default `0`).                                                    |
| `size`       | integer       | Page size (max `100`).                                                        |
| `sort`       | string        | Sorting order. Comma-separated fields with optional `,asc` or `,desc` suffix. |

#### Request

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

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/beta/api/products"
  headers = {"Authorization": f"Bearer {TOKEN}"}
  params = {"leafUserId": "{leafUserId}"}

  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/beta/api/products'
  const headers = { Authorization: `Bearer ${TOKEN}` }

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

#### Response

```json theme={null}
[
  {
    "id": "07b3f270-8af8-11ee-b9d1-0242ac120002",
    "name": "Propiconazole",
    "registrant": "Tide International USA, Inc.",
    "productType": "Chemical",
    "labelProvider": "JohnDeere",
    "providerId": "020c55f6-8af8-11ee-b9d1-0242ac120002",
    "formulationType": "DRY",
    "leafUserId": "fb6fcda4-8af7-11ee-b9d1-0242ac120002",
    "registration": "0084229-00011-AA-0000000",
    "status": "ACTIVE",
    "carrier": true
  }
]
```

***

### Get summarized products

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

Returns a summarized list of products extracted from machine files for a Leaf user.

#### Parameters

| Parameter | Type    | Description                                                                   |
| --------- | ------- | ----------------------------------------------------------------------------- |
| `name`    | string  | Filter by partial product name.                                               |
| `page`    | integer | Page number (default `0`).                                                    |
| `size`    | integer | Page size (max `100`).                                                        |
| `sort`    | string  | Sorting order. Comma-separated fields with optional `,asc` or `,desc` suffix. |

#### Request

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

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

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

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

#### Response

```json theme={null}
[
  {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "Default product",
    "leafUserId": "8bbe50a0-992c-11ee-b9d1-0242ac120002"
  }
]
```

***

### Search for products

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/products/search`

Searches for products by name (partial values supported). Includes results from Agrian and CDMS databases available to everyone, plus John Deere products at the Leaf user level.

#### Parameters

| Parameter    | Type    | Description                                          |
| ------------ | ------- | ---------------------------------------------------- |
| `name`       | string  | **Required.** Partial product name to search.        |
| `maxResults` | integer | Maximum results to return (default `10`, max `100`). |

#### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/beta/api/products/search?name=Roundup'
  ```

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/beta/api/products/search"
  headers = {"Authorization": f"Bearer {TOKEN}"}
  params = {"name": "Roundup"}

  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/beta/api/products/search'
  const headers = { Authorization: `Bearer ${TOKEN}` }

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

#### Response

```json theme={null}
[
  {
    "id": "7d85c556-0ac5-4f0b-b7cc-b35ac559af8f",
    "name": "CompostX",
    "registration": "00000-00-00000",
    "registrant": "Leaf Company, LLC",
    "productType": "Dry",
    "physicalState": "dry",
    "formulationType": "Dry Flowable",
    "labelProvider": "CDMS",
    "productPageUrl": "https://www.cdms.net/ldat/",
    "labels": [
      {
        "name": "meE2000.pdf",
        "url": "https://www.cdms.net/ldat/meE2000.pdf"
      }
    ],
    "activeIngredient": [
      "Urea",
      "Calcium"
    ]
  },
  {
    "id": "21f4cb76-07fa-46ca-a8cf-cfbc2f161bdf",
    "name": "Product AB",
    "registration": "0434785-2911",
    "registrant": "Loveland Products, Inc.",
    "productType": "Insecticide Miticide",
    "formulationType": "Emulsifiable Concentrate",
    "labelProvider": "AGRIAN",
    "productPageUrl": "https://www.agrian.com/labelcenter/results.cfm?d=0000",
    "labels": [
      {
        "name": "Label",
        "url": "https://www.agrian.com/pdfs/new/00000.pdf"
      }
    ],
    "activeIngredient": [
      "13.1 - Lambda-cyhalothrin"
    ],
    "physicalState": "liquid",
    "density": {
      "value": "7.17",
      "unit": "lb/ga"
    },
    "activeIngredients": [
      {
        "name": "Lambda-cyhalothrin",
        "value": "13.1",
        "unit": "%"
      }
    ]
  }
]
```

***

### Get a product

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/products/{id}`

Returns a single product by its ID. Data is sourced from multiple product databases.

#### Parameters

| Parameter | Type          | Description                  |
| --------- | ------------- | ---------------------------- |
| `id`      | string (UUID) | Path param — the product ID. |

#### Request

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

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/beta/api/products/{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/beta/api/products/{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": "81ffe756-1fd0-4d97-b2ec-e33b5232f507",
  "name": "GameOn",
  "registration": "62719-724",
  "registrant": "Corteva Agriscience",
  "productType": "Dry",
  "formulationType": "Dry Flowable",
  "labelProvider": "AGRIAN",
  "productPageUrl": "https://www.agrian.com/labelcenter/results.cfm?d=21666",
  "labels": [
    {
      "name": "Label - 03-R0718",
      "url": "https://www.agrian.com/pdfs/current/Badge_X2_FungicideBactericide_Label1p.pdf"
    }
  ]
}
```

***

### Get matching products from an operation

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/products/matching/operations/{operationId}`

Returns the standard products that best match the products found in a field operation. Use the returned `productId` with the [Get a product](#get-a-product) endpoint to retrieve registration numbers and labels.

#### Parameters

| Parameter     | Type          | Description                    |
| ------------- | ------------- | ------------------------------ |
| `operationId` | string (UUID) | Path param — the operation ID. |

#### Request

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

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/beta/api/products/matching/operations/{operationId}"
  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/beta/api/products/matching/operations/{operationId}'
  const headers = { Authorization: `Bearer ${TOKEN}` }

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

#### Response

```json theme={null}
[
  {
    "id": "37159c45-4c1f-48e4-aa87-90b34cc6e789",
    "name": "ams",
    "productId": "e5b91778-0714-4e1f-850c-b458d1bdc7ed",
    "matchDetails": {
      "status": "PREDICTED",
      "score": 14.354036
    }
  },
  {
    "id": "7fb70242-498b-42c1-92c3-a7d2361d2125",
    "name": "counter",
    "productId": "a85c1d0d-b673-46aa-a3a3-31cb65f57598",
    "matchDetails": {
      "status": "VALIDATED"
    }
  }
]
```

***

### Update product matches

<span style={{fontWeight: 'bold', color: '#e5a00d'}}>PATCH</span> `/products/matching/operations/{operationId}/matches/{matchId}`

Approves or updates a product match prediction. Send `"status": "VALIDATED"` to approve the current prediction, or send a new `productId` to change the matched product.

#### Parameters

| Parameter     | Type          | Description                    |
| ------------- | ------------- | ------------------------------ |
| `operationId` | string (UUID) | Path param — the operation ID. |
| `matchId`     | string (UUID) | Path param — the match ID.     |

#### Request body

To approve the prediction:

```json theme={null}
{
  "status": "VALIDATED"
}
```

To change the matched product:

```json theme={null}
{
  "productId": "expectedProductID"
}
```

#### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PATCH \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Content-Type: application/json' \
    -d '{ "status": "VALIDATED" }' \
    'https://api.withleaf.io/services/beta/api/products/matching/operations/{operationId}/matches/{matchId}'
  ```

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/beta/api/products/matching/operations/{operationId}/matches/{matchId}"
  headers = {"Authorization": f"Bearer {TOKEN}"}

  data = {"status": "VALIDATED"}

  response = requests.patch(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/beta/api/products/matching/operations/{operationId}/matches/{matchId}'
  const headers = { Authorization: `Bearer ${TOKEN}` }

  const data = { status: 'VALIDATED' }

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

#### Response

```json theme={null}
[
  {
    "id": "uidd-match-0001",
    "name": "Ta35",
    "productId": "uidd-prd-1001",
    "matchDetails": {
      "score": 91,
      "status": "PREDICTED"
    }
  },
  {
    "id": "uidd-match-0002",
    "name": "Talisman",
    "productId": "uidd-prd-1003",
    "matchDetails": {
      "status": "VALIDATED"
    }
  }
]
```

***

### Get product matches historical

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/products/matching/operations/{operationId}/matches/{matchId}/historical`

Returns the change history for a product match.

#### Parameters

| Parameter     | Type          | Description                    |
| ------------- | ------------- | ------------------------------ |
| `operationId` | string (UUID) | Path param — the operation ID. |
| `matchId`     | string (UUID) | Path param — the match ID.     |

#### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/beta/api/products/matching/operations/{operationId}/matches/{matchId}/historical'
  ```

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/beta/api/products/matching/operations/{operationId}/matches/{matchId}/historical"
  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/beta/api/products/matching/operations/{operationId}/matches/{matchId}/historical'
  const headers = { Authorization: `Bearer ${TOKEN}` }

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

#### Response

```json theme={null}
[
  {
    "matchId": "uidd-match-0002",
    "name": "Talisman",
    "productId": "uidd-prd-1003",
    "matchDetails": {
      "status": "PREDICTED",
      "score": 8.225217
    },
    "historicalTime": "2023-12-19T13:18:44.709Z"
  }
]
```

***

## Varieties

### Get all varieties

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/varieties`

Returns a paginated list of varieties from providers. Currently supports John Deere.

#### Parameters

| Parameter    | Type          | Description                                                                   |
| ------------ | ------------- | ----------------------------------------------------------------------------- |
| `leafUserId` | string (UUID) | Filter by Leaf user.                                                          |
| `provider`   | string        | Filter by provider (`JohnDeere`).                                             |
| `page`       | integer       | Page number (default `0`).                                                    |
| `size`       | integer       | Page size (max `100`).                                                        |
| `sort`       | string        | Sorting order. Comma-separated fields with optional `,asc` or `,desc` suffix. |

#### Request

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

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/beta/api/varieties"
  headers = {"Authorization": f"Bearer {TOKEN}"}
  params = {"leafUserId": "{leafUserId}"}

  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/beta/api/varieties'
  const headers = { Authorization: `Bearer ${TOKEN}` }

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

#### Response

```json theme={null}
[
  {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "crops": ["ALFALFA"],
    "name": "Master Piece",
    "companyName": "Simplot",
    "status": "ACTIVE",
    "leafUserId": "028c30fa-6d2a-11ee-b962-0242ac120002",
    "provider": "JohnDeere",
    "providerId": "8e1e0920-1265-4066-8067-8ce2ce5012b2",
    "organizationId": "9999"
  }
]
```

***

### Get a variety

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/varieties/{id}`

Returns a single variety by its ID.

#### Parameters

| Parameter | Type          | Description                  |
| --------- | ------------- | ---------------------------- |
| `id`      | string (UUID) | Path param — the variety ID. |

#### Request

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

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/beta/api/varieties/{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/beta/api/varieties/{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": "111120cc-d0c5-40d3-a063-ca09903a0738",
  "crops": ["SOYBEANS"],
  "providerId": "f4c43d25-0000-1000-7fc2-e1e1e1193019",
  "name": "2105 2000 mix",
  "companyName": "CHANNEL",
  "status": "ACTIVE",
  "provider": "JohnDeere",
  "leafUserId": "90a7faf4-33d3-4e35-9f46-1894ae13955d",
  "organizationId": "9999"
}
```

***

### Get summarized varieties

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

Returns a summarized list of varieties extracted from machine files for a Leaf user.

#### Parameters

| Parameter | Type    | Description                                                                   |
| --------- | ------- | ----------------------------------------------------------------------------- |
| `name`    | string  | Filter by partial variety name.                                               |
| `crops`   | string  | Filter by crop name.                                                          |
| `page`    | integer | Page number (default `0`).                                                    |
| `size`    | integer | Page size (max `100`).                                                        |
| `sort`    | string  | Sorting order. Comma-separated fields with optional `,asc` or `,desc` suffix. |

#### Request

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

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

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

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

#### Response

```json theme={null}
[
  {
    "id": "680ff073-18d0-4951-ba69-b2ca0b098bc3",
    "name": "corn variety 2",
    "leafUserId": "028c30fa-6d2a-11ee-b962-0242ac120002",
    "crops": ["corn"]
  }
]
```

***

### Search for varieties

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/varieties/search`

Searches for varieties by name (partial values supported). John Deere Operation Center varieties are available at the Leaf user level.

#### Parameters

| Parameter    | Type    | Description                                         |
| ------------ | ------- | --------------------------------------------------- |
| `name`       | string  | **Required.** Partial variety name to search.       |
| `maxResults` | integer | Maximum results to return (default `10`, max `20`). |
| `crop`       | string  | Filter by crop name.                                |

#### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/beta/api/varieties/search?name=Master'
  ```

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/beta/api/varieties/search"
  headers = {"Authorization": f"Bearer {TOKEN}"}
  params = {"name": "Master"}

  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/beta/api/varieties/search'
  const headers = { Authorization: `Bearer ${TOKEN}` }

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

#### Response

```json theme={null}
[
  {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "crops": ["ALFALFA"],
    "name": "Master Piece",
    "companyName": "Simplot",
    "status": "ACTIVE",
    "leafUserId": "028c30fa-6d2a-11ee-b962-0242ac120002",
    "provider": "JohnDeere",
    "providerId": "8e1e0920-1265-4066-8067-8ce2ce5012b2"
  }
]
```

***

## Tank Mixes

### Get all tank mixes

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/tankMixes`

Returns a paginated list of tank mixes from providers. Currently supports John Deere.

#### Parameters

| Parameter    | Type          | Description                                                                   |
| ------------ | ------------- | ----------------------------------------------------------------------------- |
| `leafUserId` | string (UUID) | Filter by Leaf user.                                                          |
| `provider`   | string        | Filter by provider (`JohnDeere`).                                             |
| `page`       | integer       | Page number (default `0`).                                                    |
| `size`       | integer       | Page size (max `100`).                                                        |
| `sort`       | string        | Sorting order. Comma-separated fields with optional `,asc` or `,desc` suffix. |

#### Request

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

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/beta/api/tankMixes"
  headers = {"Authorization": f"Bearer {TOKEN}"}
  params = {"leafUserId": "{leafUserId}"}

  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/beta/api/tankMixes'
  const headers = { Authorization: `Bearer ${TOKEN}` }

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

#### Response

```json theme={null}
[
  {
    "id": "abc59ca6-937c-11ee-b9d1-0242ac120002",
    "name": "TankTest1",
    "providerId": "b74878dc-937c-11ee-b9d1-0242ac120002",
    "notes": null,
    "solutionRate": {
      "valueAsDouble": 5,
      "unit": "gal1ac-1",
      "vrDomainId": "vrSolutionRateLiquid"
    },
    "formulationType": "LIQUID",
    "targetCrops": ["PINEAPPLE"],
    "carrier": {
      "id": "c0cb84d0-937c-11ee-b9d1-0242ac120002",
      "name": "Water",
      "labelProvider": "JohnDeere",
      "registrant": "GENERIC",
      "productType": "ADDITIVE",
      "formulationType": "LIQUID",
      "carrier": true,
      "status": "ACTIVE"
    },
    "components": [
      {
        "id": "d1fb3aac-937c-11ee-b9d1-0242ac120002",
        "name": "Brandt Big Foot SS",
        "labelProvider": "JohnDeere",
        "registrant": "Brandt Consolidated, Inc.",
        "productType": "ADDITIVE",
        "formulationType": "DRY",
        "carrier": false,
        "status": "ACTIVE"
      }
    ],
    "status": "ACTIVE",
    "provider": "JohnDeere",
    "leafUserId": "cd06377c-937c-11ee-b9d1-0242ac120002"
  }
]
```

***

### Search for tank mixes

<span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span> `/tankMixes/search`

Searches for tank mixes by name (partial values supported). John Deere Operation Center tank mixes are available at the Leaf user level.

#### Parameters

| Parameter    | Type    | Description                                         |
| ------------ | ------- | --------------------------------------------------- |
| `name`       | string  | **Required.** Partial tank mix name to search.      |
| `maxResults` | integer | Maximum results to return (default `10`, max `20`). |

#### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/beta/api/tankMixes/search?name=Tank'
  ```

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/beta/api/tankMixes/search"
  headers = {"Authorization": f"Bearer {TOKEN}"}
  params = {"name": "Tank"}

  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/beta/api/tankMixes/search'
  const headers = { Authorization: `Bearer ${TOKEN}` }

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

#### Response

```json theme={null}
[
  {
    "id": "abc59ca6-937c-11ee-b9d1-0242ac120002",
    "name": "TankTest1",
    "providerId": "b74878dc-937c-11ee-b9d1-0242ac120002",
    "notes": null,
    "solutionRate": {
      "valueAsDouble": 5,
      "unit": "gal1ac-1",
      "vrDomainId": "vrSolutionRateLiquid"
    },
    "formulationType": "LIQUID",
    "targetCrops": ["PINEAPPLE"],
    "carrier": {
      "id": "c0cb84d0-937c-11ee-b9d1-0242ac120002",
      "name": "Water",
      "labelProvider": "JohnDeere",
      "registrant": "GENERIC",
      "productType": "ADDITIVE",
      "formulationType": "LIQUID",
      "carrier": true,
      "status": "ACTIVE"
    },
    "components": [
      {
        "id": "d1fb3aac-937c-11ee-b9d1-0242ac120002",
        "name": "Brandt Big Foot SS",
        "labelProvider": "JohnDeere",
        "registrant": "Brandt Consolidated, Inc.",
        "productType": "ADDITIVE",
        "formulationType": "DRY",
        "carrier": false,
        "status": "ACTIVE"
      }
    ],
    "status": "ACTIVE",
    "provider": "JohnDeere",
    "leafUserId": "cd06377c-937c-11ee-b9d1-0242ac120002"
  }
]
```
