Skip to main content
Leaf Connect lets one API owner grant read access to their field boundaries and field operations to another API owner. Access is controlled per Leaf user, so you share exactly the data you choose.

How it works

Sharing data between two API owners involves three steps: 1. Create a sharing relation. The data owner (sender) creates a relation naming the receiver API owner. This relation starts in PENDING status. 2. Receiver accepts. The receiver changes the relation status to ALLOWED. Either side can later change it to BLOCKED. If the sender blocks the relation, the receiver cannot reactivate it. 3. Grant permissions per Leaf user. The sender grants READ access on specific resources (FIELDS, OPERATIONS) for individual Leaf users. The receiver can then query the standard field and operations endpoints to see the shared data.
Permissions are READ only. The receiver cannot modify shared data. Company-level sharing is not supported, but you can grant or revoke permissions when adding or removing a Leaf user from a company.

Endpoints

Base URL: https://api.withleaf.io/services/usermanagement/api

Sharing relations

ActionMethodPath
Get relations by roleGET/api-owners/sharing-relation/{RelationRole}
Get relation statusGET/api-owners/sharing-relation/{RelationRole}/{targetApiOwner}/status
Create relationPOST/api-owners/sharing-relation/receiver
Update relation statusPATCH/api-owners/sharing-relation/{RelationRole}/{targetApiOwner}
Invalidate receiver’s tokensPOST/api-owners/sharing-relation/{RelationRole}/{targetApiOwner}/invalidate-tokens
RelationRole is either SENDER or RECEIVER, depending on which side is making the request. Relation statuses: PENDING, ALLOWED, BLOCKED.

Leaf user permissions

ActionMethodPath
Get permissionsGET/api-owners/sharing-relation/{RelationRole}/{TargetApiOwner}/users-permissions/{leafUserId}
Create permissionsPOST/api-owners/sharing-relation/receiver/{ReceiverApiOwner}/users-permissions/{leafUserId}
Update permissionsPATCH/api-owners/sharing-relation/receiver/{ReceiverApiOwner}/users-permissions/{leafUserId}/{RESOURCE}
Delete permissionsDELETE/api-owners/sharing-relation/{RelationRole}/{ReceiverApiOwner}/users-permissions/{leafUserId}

Available permission resources

ResourceActionsTypes
FIELDSREAD(none)
OPERATIONSREADAPPLIED, HARVESTED, PLANTED

Example: granting field and operation access

curl -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -d '{"permissions": {"FIELDS": {"actions": ["READ"]}, "OPERATIONS": {"actions": ["READ"], "types": ["PLANTED", "HARVESTED"]}}}' \
  'https://api.withleaf.io/services/usermanagement/api/api-owners/sharing-relation/receiver/{ReceiverApiOwner}/users-permissions/{leafUserId}'
Response:
{
  "leafUserId": "leaf-user-id",
  "permissions": {
    "FIELDS": { "actions": ["READ"] },
    "OPERATIONS": { "actions": ["READ"], "types": ["PLANTED", "HARVESTED"] }
  }
}

What to do next

Last modified on March 19, 2026