Before diving into this content, it might be helpful to read the following:
There are a few limitations that will be lifted soon:
- The LangSmith SDKs do not support these organization management actions yet.
- Service Keys don’t have access to newly-added workspaces yet (we’re adding support soon). We recommend using a PAT of an Organization Admin for now, which by default has the required permissions for these actions.
X-Organization-Id
header should be present on all requests, and X-Tenant-Id
header should be present on requests that are scoped to a particular workspace.
Workspaces
User management
RBAC
Membership management
List roles
under RBAC should be used for retrieving role IDs of these operations. List [organization|workspace] members
endpoints (below) response "id"
s should be used as identity_id
in these operations.
Organization level:
- List organization members
- Invite a user to the organization and one or more workspaces . This should be used when the user is not already a member in the organization.
- Update a user’s organization role
- Remove someone from the organization
- List workspace members
- Add a member to a workspace that is already part of the organization
- Update a user’s workspace role
- Remove someone from a workspace
These params should be omitted:
read_only
(deprecated), password
and full_name
(basic auth only)API keys
Use the
X-Tenant-Id
header to specify which workspace to target. If the header is not present, operations will default to the workspace the API key was initially created in.Security settings
“Shared resources” in this context refer to public prompts, shared runs, and shared datasets.
- Update organization sharing settings
- use
unshare_all
to unshare ALL shared resources in the organization - usedisable_public_sharing
to prevent future sharing of resources
- use
User-only endpoints
These endpoints are user-scoped and require a logged-in user’s JWT, so they should only be executed through the UI./api-key/current
endpoints: these are related a user’s PATs/sso/email-verification/send
(Cloud-only): this endpoint is related to SAML SSO
Sample code
The sample code below goes through a few common workflows related to organization management. Make sure to make necessary replacements wherever<replace_me>
is in the code.