This guide covers how to migrate an existing CNHI (AFS Connect) integration to CNHI FieldOps. You can migrate at your own pace — both providers run in parallel, and no growers are disrupted until you choose to switch them.
What changed
CNHI FieldOps is CNH Industrial’s current API platform. The data you receive through Leaf — field operations, machine files, boundaries — is the same. What changes is how the connection is established.
| Aspect | CNHI (AFS Connect) | CNHI FieldOps |
|---|
| Leaf credential path | cnhi-credentials | cnhi-field-ops-credentials |
| Leaf OAuth helper | /get_url, /get_token | /fieldops/get_url, /fieldops/get_token |
| Magic Link / Leaf Link provider name | CNHI | CNHIFieldOps |
| Subscription keys | Legacy keys | New keys required (legacy keys do not work) |
| Change detection | Polling (Leaf checks periodically) | Webhooks (CNH pushes changes to Leaf) |
| Token format | Opaque | JWT |
The FieldOps API also supports webhook-based change notifications. Instead of Leaf polling CNH on a schedule, CNH pushes events to Leaf when new data is available. This reduces the delay between when a grower uploads data from their equipment and when Leaf processes it.
What you need before migrating
- A CNH developer account at develop.cnh.com (company-domain email required — Gmail, Hotmail, and other generic domains are not supported).
- A new FieldOps application registered in the developer portal. This produces a new
clientId, clientSecret, and subscriptionKey. Existing CNHI credentials cannot be reused.
- Each grower must re-authorize through the FieldOps OAuth flow. Existing refresh tokens do not carry over.
- Growers must have the Farm Manager title in their FieldOps account and must have logged into the FieldOps portal at least once.
Migration approach: run both in parallel
Leaf treats CNHI and CNHI FieldOps as separate providers. A single Leaf user can hold both cnhi-credentials and cnhi-field-ops-credentials at the same time. This means you can migrate growers one at a time without disrupting anyone.
The recommended approach:
- Register your CNHI FieldOps app keys with Leaf:
curl -X POST \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"clientId": "your-fieldops-client-id", "clientSecret": "your-fieldops-secret", "subscriptionKey": "your-fieldops-key"}' \
"https://api.withleaf.io/services/usermanagement/api/app-keys/CNHIFieldOps/your-app-name/PRODUCTION"
-
For each grower you want to migrate:
- Run the FieldOps OAuth flow (via the Leaf helper or Magic Link)
- Attach
cnhi-field-ops-credentials to the Leaf user
- Verify data syncs correctly
- Once confirmed, delete the old
cnhi-credentials from the Leaf user
-
Growers you haven’t migrated yet continue working on the legacy CNHI provider with no disruption.
While both credentials are attached, Leaf syncs from both providers. This may produce duplicate fields or files until you remove the old credential. We recommend verifying the FieldOps connection, then promptly deleting the legacy credential.
Identifying FieldOps data in the API
Data from CNHI FieldOps appears in the same Leaf endpoints (fields, files, operations) as legacy CNHI data. The provider field distinguishes the source:
- Legacy CNHI:
"provider": "CNHI"
- CNHI FieldOps:
"provider": "CNHIFieldOps"
You can filter queries by provider (e.g., ?provider=CNHIFieldOps) to see only FieldOps data. During the parallel-run period, the same physical field may appear twice with different provider values.
Abbreviated setup steps
For the full walkthrough with code examples in cURL, Python, and JavaScript, see Connect CNHI FieldOps. The key steps:
- Get the authorization URL —
POST https://cnhi-oauth2-helper.withleaf.io/fieldops/get_url with client_id, client_redirect_url, and production flag.
- Redirect the grower — they log in and consent.
- Exchange the code for a refresh token —
POST https://cnhi-oauth2-helper.withleaf.io/fieldops/get_token with client_id, client_secret, client_redirect_url, and response_url.
- Attach credentials to the Leaf user —
POST /users/{leafUserId}/cnhi-field-ops-credentials with clientId, clientSecret, subscriptionKey, refreshToken, and clientEnvironment.
- Confirm —
GET /users/{leafUserId}/cnhi-field-ops-credentials.
Updating Magic Link and Leaf Link
If you use Magic Link or Leaf Link widgets to onboard growers:
- Register your FieldOps app keys with Leaf:
curl -X POST \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"clientId": "your-fieldops-client-id", "clientSecret": "your-fieldops-secret", "subscriptionKey": "your-fieldops-key"}' \
"https://api.withleaf.io/services/usermanagement/api/app-keys/CNHIFieldOps/your-app-name/PRODUCTION"
-
Add
https://widget.withleaf.io as a callback URL in your CNHI FieldOps application on the CNH developer portal.
-
Update your
allowedProviders to include "CNHIFieldOps". During the transition, you can include both "CNHI" and "CNHIFieldOps" so growers can connect through either provider.
What to do next