Before you start
- A Leaf account with a valid API token.
- A Leaf user created.
- An AgLeader developer account. Complete the developer registration form.
AgLeader requires proof of liability insurance and a one-time fee before providing developer credentials.
Step 1: Get your AgLeader credentials
Log in to AgFiniti, navigate to the Consumer Keys tab, and note your:- Public Key
- Private Key
Step 2: Get the authorization code
Redirect the grower to the AgFiniti authorization URL. Replace{your_public_key} and {redirect_uri} with your values:
read and readwrite scopes required for Leaf integration. If you plan to upload prescriptions, add the fileupload scope.
After the grower authenticates, AgFiniti redirects to your redirect_uri with a code parameter.
Step 3: Exchange the code for tokens
POST the code to AgFiniti’s token endpoint. TheAuthorization header requires Base64-encoded publicKey:privateKey:
refresh_token.
Step 4: Attach credentials to the Leaf user
Step 5: Confirm the credentials are attached
Check the stored credentials for the Leaf user:cURL

