Prerequisites
- An AgLeader developer account. Create an account.
- Your application’s
publicKeyandprivateKeyfrom AgLeader. - A grower’s
refreshTokenobtained through the AgLeader OAuth consent flow.
Setup steps
- Complete the AgLeader OAuth 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}/ag-leader-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 tokens expired. Have the grower re-authorize through the AgLeader OAuth flow.
- Key mismatch: Verify that the
publicKeyandprivateKeyare from the same AgLeader application registration.
What to do next
- Connect AgLeader Tutorial — Step-by-step walkthrough.
- Provider Authentication Overview — How provider credentials work across all providers.
- API Reference: Providers — Full endpoint reference for provider credentials.

