Skip to main content
Leaf connects to Stara using an API key combined with OAuth tokens. Once connected, Leaf syncs fields, machine files, and field operations. Stara’s FMIS structure exposes fields only (no separate grower or farm hierarchy).

Prerequisites

  1. A Stara developer/partner account with API access.
  2. Your apiKey from Stara.
  3. The grower’s accessToken, accessTokenClient, and refreshToken from the Stara authentication flow.

Setup steps

POST the credentials to Leaf:
curl -X POST \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Content-Type: application/json' \
    -d '{
      "apiKey": "your-api-key",
      "accessToken": "grower-access-token",
      "accessTokenClient": "grower-access-token-client",
      "refreshToken": "grower-refresh-token"
    }' \
    'https://api.withleaf.io/services/usermanagement/api/users/{leafUserId}/stara-credentials'

Credentials schema

Create request body:
FieldTypeRequiredDescription
apiKeystringYesYour Stara API key
accessTokenstringYesThe grower’s access token
accessTokenClientstringYesThe grower’s client access token
refreshTokenstringYesThe grower’s refresh token
Response:
{
  "id": "uuid",
  "status": "str",
  "createdTime": "yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'",
  "accessTokenClient": "str",
  "refreshToken": "str",
  "accessToken": "str",
  "apiKey": "str"
}

Endpoints

Base URL: https://api.withleaf.io/services/usermanagement/api
ActionMethodPath
Get credentialsGET/users/{leafUserId}/stara-credentials
Create credentialsPOST/users/{leafUserId}/stara-credentials
Delete credentialsDELETE/users/{leafUserId}/stara-credentials
Get credential eventsGET/users/{leafUserId}/stara-credentials/events

Troubleshooting

Use the events endpoint to inspect credential health:
curl -X GET \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    'https://api.withleaf.io/services/usermanagement/api/users/{leafUserId}/stara-credentials/events'
Event logs are retained for 30 days. Once the credential is deleted or disassociated from the Leaf user, the logs are no longer available.
Common issues:
  • No grower/farm hierarchy: Stara only exposes fields. If you expect grower or farm-level data, it won’t be available from this provider.
  • Status changes to invalid: Tokens may have expired. Re-authenticate the grower through Stara.

What to do next

Last modified on March 19, 2026