Prerequisites
- A CNHi developer account. Register here.
- Your application’s
clientId,clientSecret, andsubscriptionKeyfrom CNHi. - A grower’s
refreshTokenobtained through the CNHi OAuth 2.0 consent flow.
Setup steps
- Complete the CNHi OAuth 2.0 flow to obtain a
refreshTokenfor the grower’s account. - POST the credentials to Leaf:
- Leaf validates the token and begins syncing. Check credential status with
GET /users/{leafUserId}/cnhi-credentials.
Credentials schema
Create request body:
Response:
Endpoints
Base URL:https://api.withleaf.io/services/usermanagement/api
Troubleshooting
Use the events endpoint to inspect credential health:- Status changes to invalid: The grower may have revoked access or the refresh token expired. Have the grower re-authorize.
- STAGE vs. PRODUCTION mismatch: Make sure
clientEnvironmentmatches the environment your CNHi app is registered in. - Missing subscription key: CNHi requires a
subscriptionKeyin addition to OAuth credentials. Verify you’re passing it in the request body.
What to do next
- Connect CNHi Tutorial — Step-by-step walkthrough.
- Provider Authentication Overview — How provider credentials work across all providers.
- API Reference: Providers — Full endpoint reference for provider credentials.

