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 inPENDING 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
Reading shared data
Once a sender has granted youREAD 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.
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:apiOwnerUsernameis the sender’s username, not yours.shared: trueandsourceApiOwner: <sender>are the markers the receiver checks to distinguish shared rows from owned rows. They are omitted on owned rows (a row whoseapiOwnerUsernameequals the caller).- Every per-provider credential key is present with a
nullvalue. 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 theshared 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:
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:
- There is an
ApiOwnerSharingRelationbetweenSandRin theALLOWEDstatus (both sides accepted). Shas granted at least oneREADpermission on that Leaf user (eitherFIELDSorOPERATIONS) toR.- Your bearer token was issued after the most recent
invalidate-tokenscall on the relation (otherwise the relation is silently dropped from the receiver’s view; refresh your token to recover access).
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
- Leaf Users API Reference — the read endpoints that honour the
sharedparameter. - Leaf Link for embedding provider connection and file upload widgets.
- Magic Link for generating shareable authentication URLs.
- Provider Organizations for controlling sync scope before sharing data.

