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

> Upload prescriptions across providers and use list or download endpoints where supported.

Use these endpoints to upload prescription (Rx) maps to provider accounts. Depending on the provider, you can also list existing prescriptions or download them.

For conceptual background, see [Prescriptions](/beta/prescriptions).

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

## Base URL

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

## Endpoints

| Endpoint                                                                              | Method                                                           | Path                                     |
| ------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------- |
| [Upload prescription to Raven Slingshot](#upload-prescription-to-raven-slingshot)     | <span style={{fontWeight: 'bold', color: '#e5a00d'}}>POST</span> | `/users/{leafUserId}/ravenSlingshot`     |
| [List prescriptions from Raven Slingshot](#list-prescriptions-from-raven-slingshot)   | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/users/{leafUserId}/ravenSlingshot`     |
| [Upload prescription to John Deere](#upload-prescription-to-john-deere)               | <span style={{fontWeight: 'bold', color: '#e5a00d'}}>POST</span> | `/users/{leafUserId}/johnDeere`          |
| [List prescriptions from John Deere](#list-prescriptions-from-john-deere)             | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/users/{leafUserId}/johnDeere`          |
| [Download prescription from John Deere](#download-prescription-from-john-deere)       | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/users/{leafUserId}/johnDeere/download` |
| [Upload prescription to CNHi](#upload-prescription-to-cnhi)                           | <span style={{fontWeight: 'bold', color: '#e5a00d'}}>POST</span> | `/users/{leafUserId}/cnhi`               |
| [List prescriptions from CNHi](#list-prescriptions-from-cnhi)                         | <span style={{fontWeight: 'bold', color: '#16a34a'}}>GET</span>  | `/users/{leafUserId}/cnhi`               |
| [Upload prescription to Climate FieldView](#upload-prescription-to-climate-fieldview) | <span style={{fontWeight: 'bold', color: '#e5a00d'}}>POST</span> | `/users/{leafUserId}/climateFieldView`   |
| [Upload prescription to Trimble](#upload-prescription-to-trimble)                     | <span style={{fontWeight: 'bold', color: '#e5a00d'}}>POST</span> | `/users/{leafUserId}/trimble`            |
| [Upload prescription to AgLeader](#upload-prescription-to-agleader)                   | <span style={{fontWeight: 'bold', color: '#e5a00d'}}>POST</span> | `/users/{leafUserId}/agleader`           |

***

## Raven Slingshot

### Upload prescription to Raven Slingshot

<span style={{fontWeight: 'bold', color: '#e5a00d'}}>POST</span> `/users/{leafUserId}/ravenSlingshot`

Uploads a prescription file using the Raven Slingshot credentials of a Leaf user.

The file must be a `.zip` containing one each of `.shp`, `.dbf`, and `.shx` — all sharing the same base name. The zip cannot contain subfolders.

#### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -F 'file=@prescription_rx_map.zip' \
    'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/ravenSlingshot'
  ```

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

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

  files = {"file": open("prescription_rx_map.zip", "rb")}

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

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const FormData = require('form-data')
  const fs = require('fs')

  const TOKEN = 'YOUR_TOKEN'
  const endpoint = 'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/ravenSlingshot'

  const form = new FormData()
  form.append('file', fs.createReadStream('prescription_rx_map.zip'))

  const headers = {
    Authorization: `Bearer ${TOKEN}`,
    ...form.getHeaders()
  }

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

#### Response

```json theme={null}
{
  "id": "str",
  "name": "str"
}
```

***

### List prescriptions from Raven Slingshot

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

Lists existing prescriptions available in Raven Slingshot for the Leaf user.

#### Request

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

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

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

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

#### Response

```json theme={null}
[
  {
    "id": "str",
    "name": "str"
  }
]
```

***

## John Deere

### Upload prescription to John Deere

<span style={{fontWeight: 'bold', color: '#e5a00d'}}>POST</span> `/users/{leafUserId}/johnDeere`

Uploads a prescription file using the John Deere credentials of a Leaf user.

The `organizationId` query parameter is **required** and must be the organization ID from John Deere.

The file must be a `.zip` containing a folder named `Rx/` with one each of `.shp`, `.dbf`, and `.shx` — all sharing the same base name.

#### Parameters

| Parameter        | Type   | Description                                   |
| ---------------- | ------ | --------------------------------------------- |
| `organizationId` | string | **Required.** The John Deere organization ID. |

#### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -F 'file=@prescription_rx_map.zip' \
    'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/johnDeere?organizationId={organizationId}'
  ```

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

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

  files = {"file": open("prescription_rx_map.zip", "rb")}

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

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const FormData = require('form-data')
  const fs = require('fs')

  const TOKEN = 'YOUR_TOKEN'
  const endpoint = 'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/johnDeere'

  const form = new FormData()
  form.append('file', fs.createReadStream('prescription_rx_map.zip'))

  const headers = {
    Authorization: `Bearer ${TOKEN}`,
    ...form.getHeaders()
  }

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

#### Response

```json theme={null}
{
  "id": "str",
  "name": "str"
}
```

***

### List prescriptions from John Deere

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

Lists existing prescriptions available in John Deere for the Leaf user.

#### Parameters

| Parameter        | Type   | Description                                   |
| ---------------- | ------ | --------------------------------------------- |
| `organizationId` | string | **Required.** The John Deere organization ID. |

#### Request

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

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

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

  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/prescription/api/users/{leafUserId}/johnDeere'
  const headers = { Authorization: `Bearer ${TOKEN}` }

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

#### Response

```json theme={null}
[
  {
    "id": "str",
    "name": "str"
  }
]
```

***

### Download prescription from John Deere

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

Downloads a prescription by its John Deere file ID. The `fileId` parameter refers to the ID on the John Deere side.

#### Parameters

| Parameter | Type   | Description                                |
| --------- | ------ | ------------------------------------------ |
| `fileId`  | string | **Required.** The file ID from John Deere. |

#### Request

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

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/johnDeere/download"
  headers = {"Authorization": f"Bearer {TOKEN}"}
  params = {"fileId": "{fileId}"}

  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/prescription/api/users/{leafUserId}/johnDeere/download'
  const headers = { Authorization: `Bearer ${TOKEN}` }

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

#### Response

```json theme={null}
{
  "fileUrl": "url_to_download"
}
```

***

## CNHi

### Upload prescription to CNHi

<span style={{fontWeight: 'bold', color: '#e5a00d'}}>POST</span> `/users/{leafUserId}/cnhi`

Uploads a prescription file using the CNHi credentials of a Leaf user.

The `companyId` query parameter is **required**. You can obtain this value from the grower endpoints using the `providerOrganizationId` property.

The file must be a `.zip` containing one each of `.shp`, `.dbf`, and `.shx` — all sharing the same base name. No subfolders.

#### Parameters

| Parameter   | Type   | Description                                                   |
| ----------- | ------ | ------------------------------------------------------------- |
| `companyId` | string | **Required.** The CNHi company ID (`providerOrganizationId`). |

#### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -F 'file=@prescription_map.zip' \
    'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/cnhi?companyId={companyId}'
  ```

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

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

  files = {"file": open("prescription_map.zip", "rb")}

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

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const FormData = require('form-data')
  const fs = require('fs')

  const TOKEN = 'YOUR_TOKEN'
  const endpoint = 'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/cnhi'

  const form = new FormData()
  form.append('file', fs.createReadStream('prescription_map.zip'))

  const headers = {
    Authorization: `Bearer ${TOKEN}`,
    ...form.getHeaders()
  }

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

#### Response

```json theme={null}
{
  "id": "str",
  "name": "str"
}
```

***

### List prescriptions from CNHi

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

Lists existing prescriptions available in CNHi for the Leaf user.

#### Parameters

| Parameter   | Type   | Description                        |
| ----------- | ------ | ---------------------------------- |
| `companyId` | string | **Required.** The CNHi company ID. |

#### Request

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

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

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

  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/prescription/api/users/{leafUserId}/cnhi'
  const headers = { Authorization: `Bearer ${TOKEN}` }

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

#### Response

```json theme={null}
[
  {
    "id": "str",
    "name": "str"
  }
]
```

***

## Climate FieldView

### Upload prescription to Climate FieldView

<span style={{fontWeight: 'bold', color: '#e5a00d'}}>POST</span> `/users/{leafUserId}/climateFieldView`

Uploads a prescription file using the Climate FieldView credentials of a Leaf user.

The file must be a `.zip` containing one each of `.shp`, `.dbf`, and `.shx` — all sharing the same base name. No subfolders.

#### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -F 'file=@prescription_rx_map.zip' \
    'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/climateFieldView'
  ```

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

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

  files = {"file": open("prescription_rx_map.zip", "rb")}

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

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const FormData = require('form-data')
  const fs = require('fs')

  const TOKEN = 'YOUR_TOKEN'
  const endpoint = 'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/climateFieldView'

  const form = new FormData()
  form.append('file', fs.createReadStream('prescription_rx_map.zip'))

  const headers = {
    Authorization: `Bearer ${TOKEN}`,
    ...form.getHeaders()
  }

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

#### Response

```json theme={null}
{
  "id": "str",
  "name": "str"
}
```

***

## Trimble

### Upload prescription to Trimble

<span style={{fontWeight: 'bold', color: '#e5a00d'}}>POST</span> `/users/{leafUserId}/trimble`

Uploads a prescription file using the Trimble credentials of a Leaf user.

The `organizationId`, `rateColumn`, and `rateUnit` query parameters are **required**.

`rateColumn` must be the column name from the Shapefile. `rateUnit` must be one of the supported units listed below.

The file must be a `.zip` containing one each of `.shp`, `.dbf`, and `.shx` — all sharing the same base name. No subfolders.

#### Parameters

| Parameter        | Type   | Description                                                                                                                     |
| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------- |
| `organizationId` | string | **Required.** The Trimble organization ID.                                                                                      |
| `rateColumn`     | string | **Required.** Column name from the Shapefile.                                                                                   |
| `rateUnit`       | string | **Required.** One of: `gal/ac`, `l/ha`, `lbs/ac`, `ton/ac`, `kg/ha`, `t/ha`, `kS/ac`, `kS/ha`, `lbs(N)/ac`, `kg(N)/ha`, `S/ha`. |

#### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -F 'file=@prescription_rx_map.zip' \
    'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/trimble?organizationId={organizationId}&rateColumn=Rate&rateUnit=lbs/ac'
  ```

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/trimble"
  headers = {"Authorization": f"Bearer {TOKEN}"}
  params = {"organizationId": "{organizationId}", "rateColumn": "Rate", "rateUnit": "lbs/ac"}

  files = {"file": open("prescription_rx_map.zip", "rb")}

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

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const FormData = require('form-data')
  const fs = require('fs')

  const TOKEN = 'YOUR_TOKEN'
  const endpoint = 'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/trimble'

  const form = new FormData()
  form.append('file', fs.createReadStream('prescription_rx_map.zip'))

  const headers = {
    Authorization: `Bearer ${TOKEN}`,
    ...form.getHeaders()
  }

  axios.post(endpoint, form, { headers, params: { organizationId: '{organizationId}', rateColumn: 'Rate', rateUnit: 'lbs/ac' } })
    .then(res => console.log(res.data))
    .catch(console.error)
  ```
</CodeGroup>

#### Response

```json theme={null}
{
  "id": "str",
  "name": "str"
}
```

***

## AgLeader

### Upload prescription to AgLeader

<span style={{fontWeight: 'bold', color: '#e5a00d'}}>POST</span> `/users/{leafUserId}/agleader`

Uploads a prescription file using the AgLeader credentials of a Leaf user.

The file must be a `.zip` containing one each of `.shp`, `.dbf`, and `.shx` — all sharing the same base name. No subfolders.

#### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -F 'file=@prescription_rx_map.zip' \
    'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/agleader'
  ```

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

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

  files = {"file": open("prescription_rx_map.zip", "rb")}

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

  ```javascript JavaScript theme={null}
  const axios = require('axios')
  const FormData = require('form-data')
  const fs = require('fs')

  const TOKEN = 'YOUR_TOKEN'
  const endpoint = 'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/agleader'

  const form = new FormData()
  form.append('file', fs.createReadStream('prescription_rx_map.zip'))

  const headers = {
    Authorization: `Bearer ${TOKEN}`,
    ...form.getHeaders()
  }

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

#### Response

```json theme={null}
{
  "id": "str",
  "name": "str"
}
```
