> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wisdom.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Add Scope Role Assignments for Sharing

The `addScopeRoleAssignmentsForSharing` mutation grants access to a specific resource (like a Dashboard) by assigning roles to users. This allows you to share Dashboards with individual team members or groups.

## Signature

```graphql theme={null}
addScopeRoleAssignmentsForSharing(
  scopeId: ID!
  scopeRoleAssignments: [ScopeRoleAssignmentInput!]!
  scopeType: ScopeType!
  message: String
): ResponseStatus!
```

## Arguments

<ParamField path="scopeId" type="ID!" required>
  The unique identifier of the resource you want to share (e.g., a Dashboard ID).
</ParamField>

<ParamField path="scopeRoleAssignments" type="[ScopeRoleAssignmentInput!]!" required>
  Array of user-role assignments defining who gets access and what level of access they receive. See [ScopeRoleAssignmentInput](/integrations/graphql-api/objects/scope-role-assignment-input) for the input structure.
</ParamField>

<ParamField path="scopeType" type="ScopeType!" required>
  The type of resource being shared. For Dashboards, this should be `DASHBOARD`.
</ParamField>

<ParamField path="message" type="String">
  Optional personal message to include in the sharing notification email sent to recipients.
</ParamField>

## Response

Returns a `ResponseStatus` object indicating the success or failure of the operation:

```json theme={null}
{
  "code": "OK",
  "message": "Role added successfully"
}
```

## Usage example

The following example shows how to share a Dashboard with a colleague:

```graphql theme={null}
mutation AddScopeRoleAssignments($scopeId: ID!, $scopeRoleAssignments: [ScopeRoleAssignmentInput!]!, $scopeType: ScopeType!, $message: String) {
  addScopeRoleAssignmentsForSharing(
    scopeId: $scopeId
    scopeRoleAssignments: $scopeRoleAssignments
    scopeType: $scopeType
    message: $message
  ) {
    code
    message
  }
}
```

<RequestExample>
  ```bash Request theme={null}
  curl -X POST \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <jwt_token>" \
    -d '{
      "query": "mutation AddScopeRoleAssignments($scopeId: ID!, $scopeRoleAssignments: [ScopeRoleAssignmentInput!]!, $scopeType: ScopeType!, $message: String) { addScopeRoleAssignmentsForSharing(scopeId: $scopeId, scopeRoleAssignments: $scopeRoleAssignments, scopeType: $scopeType, message: $message) { code message } }",
      "variables": {
        "scopeId": "story_123456789",
        "scopeRoleAssignments": [
          {
            "roleId": "00000000-0000-0000-0000-000000000009",
            "principalId": "user_987654321"
          }
        ],
        "scopeType": "DASHBOARD",
        "message": "Please review and edit this sales dashboard"
      }
    }' \
    https://{ACCOUNT}.askwisdom.ai/graphql
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "data": {
      "addScopeRoleAssignmentsForSharing": {
        "code": "OK",
        "message": "Role added successfully"
      }
    }
  }
  ```
</ResponseExample>

## Next steps

<CardGroup cols={2}>
  <Card title="Remove Scope Role Assignments for Sharing" icon="user-minus" href="/integrations/graphql-api/mutations/dashboard/remove-scope-role-assignments-for-sharing">
    Remove sharing access from users
  </Card>

  <Card title="Create Dashboard" icon="plus" href="/integrations/graphql-api/mutations/dashboard/create-dashboard">
    Create a new Dashboard to share
  </Card>

  <Card title="Dashboard Object" icon="folder" href="/integrations/graphql-api/objects/dashboard">
    Dashboard object schema and properties
  </Card>
</CardGroup>
