Skip to main content
Leaf Connect lets one API owner grant read access to their Leaf users (and the fields and field operations attached to them) 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

RelationRole is either SENDER or RECEIVER, depending on which side is making the request. Relation statuses: PENDING, ALLOWED, BLOCKED.

Leaf user permissions

Available permission resources

Example: granting field and operation access

Response:

Reading shared data

Once a sender has granted you READ permission on a Leaf user, you can browse that user (and their fields and operations) through the same endpoints you already use for your own data. The receiver-side query parameter that controls whether shared data appears is shared, available on the Leaf Users endpoints today.
Security and privacy guarantee. Provider secrets never cross the API owner boundary. When a Leaf user is shared with you via Leaf Connect, the response includes the identity profile (id, name, email, phone, address, external id) but every per-provider credential object is stripped to null — no John Deere / Climate FieldView / Trimble / CNHi / AgLeader / Raven / Stara / AgVance / Geofolia / Panorama refresh tokens, access tokens, OAuth client IDs, OAuth client secrets, subscription keys, or provider account IDs. The strip is enforced at the response-projection layer (see Shape of a shared row), and writes on a shared Leaf user are rejected with 405 SharedLeafUserReadOnly (see Receivers cannot mutate shared rows).

The shared query parameter

Both GET /users and GET /users/{id} accept a tri-state shared parameter: The parameter is case-insensitive (INCLUDE, Include, eXcLuDe, …). Shared data is always opt-in: omitting shared — or sending shared=exclude — is exactly the legacy single-tenant behaviour. No existing consumer sees new fields or new rows unless they explicitly ask for them.

Shape of a shared row

Rows that came from a Leaf Connect grant carry two extra fields and have every per-provider credentials object stripped:
  • apiOwnerUsername is the sender’s username, not yours.
  • shared: true and sourceApiOwner: <sender> are the markers the receiver checks to distinguish shared rows from owned rows. They are omitted on owned rows (a row whose apiOwnerUsername equals the caller).
  • Every per-provider credential key is present with a null value. Provider tokens never cross the API owner boundary; only the Leaf user identity flows through.

What flows through vs what stays private

The split is deliberate and enforced server-side regardless of the shared mode you requested:
The strip is enforced via an explicit ignore list passed to the response projection (SafeLegacyCredentialsConverter.populateStripped), not by any per-field policy you can disable. New provider credential objects added to Leaf in the future are wired into the same ignore list before they’re added to the Leaf user schema. There is no flag, header, or scope that opens the strip on the receiver side.
Want richer data on a shared Leaf user? Ask the sender to also grant the resource you need (FIELDS and / or OPERATIONS) on that Leaf user. The receiver-side /fields, /operations, and /files endpoints honour the same shared parameter and will surface the sender’s data within those grants — still without exposing any provider credential.

Example: listing your own Leaf users plus those shared with you

Listing only the Leaf users shared with you

Receivers cannot mutate shared rows

PATCH /users/{id}, PUT /users, and DELETE /users/{id} are read-only for the receiver: when the target ID belongs to a Leaf user shared with you via Leaf Connect, they return 405 Method Not Allowed:
Only the sending API owner can modify or delete the underlying Leaf user. The 405 only fires on IDs that are actually shared to you; unrelated IDs (an ID that does not belong to your API owner and was not shared to you) keep returning 404 Not Found, so a receiver cannot probe for the existence of unrelated Leaf users.

Invalid shared value

If you send a value other than exclude, only, or include (case-insensitive), the request fails with 400 Bad Request:

When does a Leaf user appear under shared=only / shared=include?

A Leaf user owned by sender S is visible to receiver R when all of these are true:
  1. There is an ApiOwnerSharingRelation between S and R in the ALLOWED status (both sides accepted).
  2. S has granted at least one READ permission on that Leaf user (either FIELDS or OPERATIONS) to R.
  3. Your bearer token was issued after the most recent invalidate-tokens call on the relation (otherwise the relation is silently dropped from the receiver’s view; refresh your token to recover access).
If any condition is missing, shared=only returns an empty page and shared=include returns only your own Leaf users — no error is raised, the row simply does not appear.

What to do next

Last modified on November 27, 2026