V2
Base URL: https://api.asgardeo.io/t/{organization-name}/api/server/v2
The User Sharing API (v2) (version 1.0.0).
Download the OpenAPI definition (YAML)
Security schemes
OAuth2: oauth2
authorizationCode flow, token URL https://api.asgardeo.io/t/{organization-name}/oauth2/token, authorization URL https://api.asgardeo.io/t/{organization-name}/oauth2/authorize
4 scopes
| Scope | Description |
|---|---|
internal_user_share | Share users across organizations. |
internal_user_unshare | Unshare users from organizations. |
internal_user_shared_access_view | View shared organizations and roles for a user. |
internal_user_shared_access_update | Update shared attributes (e.g., roles) for shared users. |
User Sharing
Share users with specific organizations
POST /users/share
Share one or more users with a selected set of organizations, optionally assigning roles to each shared user in each target organization.
This endpoint is treated as a processing function:
it triggers a sharing process and responds with 202 Accepted.
Scope required: internal_user_share
Request body (required): application/json
Schema: UserShareSelectedRequestBody
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
userCriteria | UserCriteria | Yes | Criteria for selecting users to share/unshare. |
organizations | array of UserOrgShareConfig | Yes | List of organizations to share users with, along with policies and optional role assignments. |
Responses
| Code | Description | Schema |
|---|---|---|
202 | User sharing process triggered successfully. | ProcessSuccessResponse |
400 | Bad Request | Error |
500 | Internal Server Error | Error |
Perform incremental role assignment operations for already shared users
PATCH /users/share
Perform incremental updates to the shared attributes (eg: role assignments) update of already shared users.
This endpoint supports SCIM-like PATCH semantics:
op: "add"→ assign additional roles.op: "remove"→ remove specific roles.
Note: Only role assignments updates are managed here as of now. Sharing/unsharing organizations is handled via
/users/share,/users/share-with-all,/users/unshare, and/users/unshare-with-all.
Scope required: internal_user_shared_access_update
Request body (required): application/json
Schema: UserSharingPatchRequest
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
userCriteria | UserCriteria | Yes | Criteria for selecting users to share/unshare. |
Operations | array of UserSharingPatchOperation | Yes |
Responses
| Code | Description | Schema |
|---|---|---|
202 | Role assignment patch operation processed successfully. | ProcessSuccessResponse |
400 | Bad Request | Error |
404 | Not Found | Error |
500 | Internal Server Error | Error |
Share users with all organizations
POST /users/share-with-all
Share one or more users with all organizations according to the specified policy.
A common roleAssignment can be provided to assign roles in all matching organizations.
This endpoint is treated as a processing function and responds with 202 Accepted.
Scope required: internal_user_share
Request body (required): application/json
Schema: UserShareAllRequestBody
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
userCriteria | UserCriteria | Yes | Criteria for selecting users to share/unshare. |
policy | string | Yes | Global sharing policy. Possible values:
|
roleAssignment | RoleAssignment | Optional global role assignment configuration that applies to all organizations covered by this policy. If omitted, default behavior is no roles. |
Responses
| Code | Description | Schema |
|---|---|---|
202 | Share-all process triggered successfully. | ProcessSuccessResponse |
400 | Bad Request | Error |
500 | Internal Server Error | Error |
Unshare users from specific organizations
POST /users/unshare
Unshare one or more users from a selected set of organizations.
Note: This only removes the user from the specified organizations. If the user was shared with a parent org plus its children via a broader policy, you must explicitly include all relevant organization IDs when unsharing.
This endpoint is treated as a processing function and responds with 202 Accepted.
Scope required: internal_user_unshare
Request body (required): application/json
Schema: UserUnshareSelectedRequestBody
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
userCriteria | UserCriteria | Yes | Criteria for selecting users to share/unshare. |
orgIds | array of string | Yes | List of organization IDs from which users should be unshared. |
Responses
| Code | Description | Schema |
|---|---|---|
202 | Unsharing process triggered successfully. | ProcessSuccessResponse |
400 | Bad Request | Error |
500 | Internal Server Error | Error |
Unshare users from all organizations
POST /users/unshare-with-all
Completely remove all shared access for one or more users from all organizations.
This endpoint is treated as a processing function and responds with 202 Accepted.
Scope required: internal_user_unshare
Request body (required): application/json
Schema: UserUnshareAllRequestBody
1 property
| Name | Type | Required | Description |
|---|---|---|---|
userCriteria | UserCriteria | Yes | Criteria for selecting users to share/unshare. |
Responses
| Code | Description | Schema |
|---|---|---|
202 | Unshare-all process triggered successfully. | ProcessSuccessResponse |
400 | Bad Request | Error |
500 | Internal Server Error | Error |
User Accessible Organizations
List organizations where the user has shared access
GET /users/{userId}/share
Retrieve the list of organizations where the specified user has shared access, including per-organization effective role assignments.
The response shape depends on how the user was shared:
- If user has been shared via
ALL_EXISTING_AND_FUTURE_ORGSpolicy → top-levelsharingModeis returned, and no per-orgsharingModeis present on each organization entry. - If user has been shared via
SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN→ no top-levelsharingModeis returned, and each organization entry includes its ownsharingMode. - If user has not been shared under any future applicable policies mentioned above, the response will simply include the list of shared organizations without any
sharingModeinformation.
This follows the same pattern as GET /applications/{applicationId}/share.
Scope required: internal_user_shared_access_view
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
userId | path | string | Yes | The ID of the user. |
before | query | string | Base64 encoded cursor value for backward pagination. | |
after | query | string | Base64 encoded cursor value for forward pagination. | |
filter | query | string | Condition to filter the retrieval of records.
Supports | |
limit | query | integer | Maximum number of records to return. If you do not specify this parameter, this will return all shared organizations. | |
recursive | query | boolean | Determines whether a recursive search should happen. If set to true, includes shared organizations in all levels of the hierarchy; if set to false, includes only shared organizations in the next level of the hierarchy. | |
attributes | query | string | Specifies the required parameters in the response.
Supported values: |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Successful response with the user's shared organizations. | one of: UserSharedOrgsAllResponse, UserSharedOrgsSelectedResponse |
400 | Bad Request | Error |
500 | Internal Server Error | Error |
Schemas
UserCriteria
Type: object
Criteria for selecting users to share/unshare.
1 property
| Name | Type | Required | Description |
|---|---|---|---|
userIds | array of string | Yes | List of user IDs. |
UserShareSelectedRequestBody
Type: object
Request body for sharing users with a selected set of organizations.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
userCriteria | UserCriteria | Yes | Criteria for selecting users to share/unshare. |
organizations | array of UserOrgShareConfig | Yes | List of organizations to share users with, along with policies and optional role assignments. |
UserOrgShareConfig
Type: object
Per-organization sharing configuration for selected organizations.
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
orgId | string | Yes | Organization ID to share the users with. |
policy | string | Yes | Sharing scope for this organization. Possible values:
|
roleAssignment | RoleAssignment | Optional role assignment configuration for this organization.
If omitted, the default behavior is to assign no roles (equivalent to |
UserShareAllRequestBody
Type: object
Request body for sharing users with all organizations controlled by the selected policy.
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
userCriteria | UserCriteria | Yes | Criteria for selecting users to share/unshare. |
policy | string | Yes | Global sharing policy. Possible values:
|
roleAssignment | RoleAssignment | Optional global role assignment configuration that applies to all organizations covered by this policy. If omitted, default behavior is no roles. |
UserUnshareSelectedRequestBody
Type: object
Request body for unsharing users from selected organizations.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
userCriteria | UserCriteria | Yes | Criteria for selecting users to share/unshare. |
orgIds | array of string | Yes | List of organization IDs from which users should be unshared. |
UserUnshareAllRequestBody
Type: object
Request body for unsharing users from all organizations.
1 property
| Name | Type | Required | Description |
|---|---|---|---|
userCriteria | UserCriteria | Yes | Criteria for selecting users to share/unshare. |
UserSharingPatchRequest
Type: object
PATCH request for performing incremental role assignment operations on already shared users.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
userCriteria | UserCriteria | Yes | Criteria for selecting users to share/unshare. |
Operations | array of UserSharingPatchOperation | Yes |
UserSharingPatchOperation
Type: object
A single PATCH operation (SCIM-like) for user sharing.
Currently supported:
op: "add"→ Add roles.op: "remove"→ Remove roles.
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
op | string | Yes | Operation type. Supported values: |
path | string | Yes | JSON-like path in the format:
|
value | array of RoleShareConfig | List of roles to add/remove under the specified path. |
RoleAssignment
Type: object
Role assignment configuration for shared users.
This controls which roles are assigned to the user in the target organization.
NONE→ Do not assign any roles via user sharing.SELECTED→ Assign only the roles listed underroles.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
mode | string | Mode of role assignment. Allowed values: | |
roles | array of RoleShareConfig | List of roles to assign when |
RoleShareConfig
Type: object
Role to be assigned to the shared user in the sub-organization.
4 properties
| Name | Type | Required | Description |
|---|---|---|---|
displayName | string | Yes | Human-readable name of the role. |
audience | object | Yes | |
audience.display | string | Yes | Display name of the audience (organization or application). |
audience.type | string | Yes | Type of the role audience:
|
SharingModeAll
Type: object
Top-level sharing mode present when the user is shared with ALL organizations.
Policy is always ALL_EXISTING_AND_FUTURE_ORGS.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
policy | string | Yes | Global sharing policy covering all existing and future organizations. Allowed values: |
roleAssignment | RoleAssignment | Yes | Role assignment configuration for shared users. This controls which roles are assigned to the user in the target organization.
|
SharingModeSelected
Type: object
Per-org sharing mode present when the user is shared with SELECTED organizations.
Policy is always SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
policy | string | Yes | Sharing policy scoped to a selected organization and its children. Allowed values: |
roleAssignment | RoleAssignment | Yes | Role assignment configuration for shared users. This controls which roles are assigned to the user in the target organization.
|
UserSharedOrganizationBase
Type: object
Common fields for a shared organization entry.
12 properties
| Name | Type | Required | Description |
|---|---|---|---|
orgId | string | ID of the child organization. | |
orgName | string | Name of the child organization. | |
orgHandle | string | Unique, human-readable handle of the organization. | |
orgStatus | string | Current status of the organization. | |
orgRef | string | API reference of the organization resource. | |
hasChildren | boolean | Indicates whether the organization has child organizations. | |
depthFromRoot | integer | Depth of the organization in the hierarchy, where root is 0. | |
parentOrgId | string | ID of the parent (sharing initiated) organization. | |
parentUserId | string | ID of the user in the parent (sharing initiated) organization. | |
sharedUserId | string | ID of the shared user object in the target organization. | |
sharedType | string | Shared type of the user. | |
roles | array of RoleShareConfig | Effective roles assigned to this user in this organization via user sharing. |
UserSharedOrganizationAllEntry
Type: UserSharedOrganizationBase
Organization entry when user is shared via ALL_EXISTING_AND_FUTURE_ORGS policy. No per-org sharingMode is present.
12 properties
| Name | Type | Required | Description |
|---|---|---|---|
orgId | string | ID of the child organization. | |
orgName | string | Name of the child organization. | |
orgHandle | string | Unique, human-readable handle of the organization. | |
orgStatus | string | Current status of the organization. | |
orgRef | string | API reference of the organization resource. | |
hasChildren | boolean | Indicates whether the organization has child organizations. | |
depthFromRoot | integer | Depth of the organization in the hierarchy, where root is 0. | |
parentOrgId | string | ID of the parent (sharing initiated) organization. | |
parentUserId | string | ID of the user in the parent (sharing initiated) organization. | |
sharedUserId | string | ID of the shared user object in the target organization. | |
sharedType | string | Shared type of the user. | |
roles | array of RoleShareConfig | Effective roles assigned to this user in this organization via user sharing. |
UserSharedOrganizationSelectedEntry
Type: UserSharedOrganizationBase
Organization entry when user is shared via SELECTED org policy. Includes per-org sharingMode with policy SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN.
13 properties
| Name | Type | Required | Description |
|---|---|---|---|
orgId | string | ID of the child organization. | |
orgName | string | Name of the child organization. | |
orgHandle | string | Unique, human-readable handle of the organization. | |
orgStatus | string | Current status of the organization. | |
orgRef | string | API reference of the organization resource. | |
hasChildren | boolean | Indicates whether the organization has child organizations. | |
depthFromRoot | integer | Depth of the organization in the hierarchy, where root is 0. | |
parentOrgId | string | ID of the parent (sharing initiated) organization. | |
parentUserId | string | ID of the user in the parent (sharing initiated) organization. | |
sharedUserId | string | ID of the shared user object in the target organization. | |
sharedType | string | Shared type of the user. | |
roles | array of RoleShareConfig | Effective roles assigned to this user in this organization via user sharing. | |
sharingMode | SharingModeSelected | Yes | Per-org sharing mode present when the user is shared with SELECTED organizations.
Policy is always |
UserSharedOrgsAllResponse
Type: object
Response when the user is shared with ALL organizations.
- Top-level
sharingModeis present with policyALL_EXISTING_AND_FUTURE_ORGS. - Per-org
sharingModeis absent on each organization entry.
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
links | array of Link | ||
sharingMode | SharingModeAll | Yes | Top-level sharing mode present when the user is shared with ALL organizations.
Policy is always |
organizations | array of UserSharedOrganizationAllEntry | Yes |
UserSharedOrgsSelectedResponse
Type: object
Response when the user is shared with SELECTED organizations.
- Top-level
sharingModeis absent. - Each organization entry includes its own
sharingModewith policySELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
links | array of Link | ||
organizations | array of UserSharedOrganizationSelectedEntry | Yes |
ProcessSuccessResponse
Type: object
Indicates that a sharing / unsharing / patch process has been triggered.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
status | string | ||
details | string |
Error
Type: object
Error response model with a code, message, description, and trace ID.
4 properties
| Name | Type | Required | Description |
|---|---|---|---|
code | string | Yes | |
message | string | Yes | |
description | string | ||
traceId | string | Yes |
Was this page helpful?