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

# Provider Credentials

> Provider credential endpoints to connect Leaf users to John Deere, Climate FieldView, CLAAS, CNHi, Trimble, AgLeader, Stara, Raven, and other providers.

Use these endpoints to attach provider credentials to a Leaf user. The base path is consistent, but the request body and supported helper endpoints vary by provider, so this page is best used as a path matrix rather than a single normalized contract.

For setup requirements and request-body examples, see the provider-specific guides under [Connecting Providers](/providers/overview).

## Base URL

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

## Credential path matrix

| Provider                    | Credential path                  | Notes                                                                                                                    | Documentation                                     |
| --------------------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------- |
| John Deere                  | `john-deere-credentials`         | OAuth credentials                                                                                                        | [John Deere](/providers/john-deere)               |
| CLAAS                       | `claas-credentials`              | OAuth with `clientKey` / `clientSecret` and grower `refreshToken`; `clientEnvironment` supports `STAGE` and `PRODUCTION` | [CLAAS](/providers/claas)                         |
| Climate FieldView           | `climate-field-view-credentials` | OAuth credentials                                                                                                        | [Climate FieldView](/providers/climate-fieldview) |
| CNHI (AFS Connect - Legacy) | `cnhi-credentials`               | Requires `clientEnvironment`; legacy AFS Connect API                                                                     | [CNHI (AFS Connect)](/providers/cnhi)             |
| CNHI FieldOps               | `cnhi-field-ops-credentials`     | Requires `clientEnvironment`; existing CNHI keys do not work                                                             | [CNHI FieldOps](/providers/cnhi-fieldops)         |
| Trimble                     | `trimble-credentials`            | OAuth credentials                                                                                                        | [Trimble](/providers/trimble)                     |
| AgLeader                    | `ag-leader-credentials`          | Uses app keys plus grower refresh token                                                                                  | [AgLeader](/providers/agleader)                   |
| Stara                       | `stara-credentials`              | Uses `apiKey`, `accessToken`, `accessTokenClient`, and `refreshToken`                                                    | [Stara](/providers/stara)                         |
| Raven                       | `raven-credentials`              | OAuth credentials for grower, farm, and field data                                                                       | [Raven](/providers/raven)                         |
| Raven Slingshot             | `raven-slingshot-credentials`    | API key for machine file ingestion                                                                                       | [Raven Slingshot](/providers/raven-slingshot)     |
| Sentera                     | `sentera-credentials`            | Username/password credentials                                                                                            | [Sentera](/providers/sentera)                     |
| AgVance                     | `agvance-credentials`            | API key plus account credentials                                                                                         | [AgVance](/providers/agvance)                     |
| Panorama                    | `panorama-credentials`           | Precision Planting Panorama                                                                                              | [Panorama](/providers/panorama)                   |
| Lindsay                     | `lindsay-credentials`            | OAuth credentials with `clientEnvironment`                                                                               | [Lindsay](/providers/lindsay)                     |
| Valley                      | `valley-credentials`             | API key plus account credentials                                                                                         | [Valley](/providers/valley)                       |

## Common path shape

The credential endpoints always start with the Leaf user:

```text theme={null}
/users/{leafUserId}/{credential-path}
```

Examples:

* `GET /users/{leafUserId}/john-deere-credentials`
* `POST /users/{leafUserId}/ag-leader-credentials`
* `DELETE /users/{leafUserId}/panorama-credentials`

Most providers also expose a credential events endpoint:

```text theme={null}
/users/{leafUserId}/{credential-path}/events
```

Use the provider-specific documentation to confirm the exact request body and any provider-specific fields.

## Example: get stored credentials

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

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

  TOKEN = "YOUR_TOKEN"
  endpoint = "https://api.withleaf.io/services/usermanagement/api/users/{leafUserId}/john-deere-credentials"
  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/usermanagement/api/users/{leafUserId}/john-deere-credentials";
  const headers = { Authorization: `Bearer ${TOKEN}` };

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

## Events endpoint

Many provider credential endpoints expose `/events` for troubleshooting authentication failures, token refreshes, and sync-related issues.

When available, these endpoints support:

| Parameter | Type    | Description                           |
| --------- | ------- | ------------------------------------- |
| `page`    | integer | Page number (default `0`)             |
| `size`    | integer | Page size (default `20`)              |
| `sort`    | string  | Sort order such as `createdDate,desc` |

## What to do next

* Use [Connecting Providers](/providers/overview) to choose the right provider flow.
* Use the provider-specific guides for request-body schemas and setup details.
* Use [Leaf users](/api-reference/users) to create the Leaf user before attaching credentials.
