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

# List Role Users

> List all users assigned to a role

## Path Parameters

<ParamField path="organizationId" type="string" required>
  Organization ID
</ParamField>

<ParamField path="roleId" type="string" required>
  Role ID
</ParamField>

## Response

Returns an array of User objects assigned to the role.

```json theme={null}
{
  "data": [
    {
      "id": "user123",
      "email": "jane.doe@example.com",
      "name": "Jane Doe",
      "status": "active",
      "createdAt": "2024-03-20T10:00:00Z"
    },
    {
      "id": "user456",
      "email": "john.smith@example.com",
      "name": "John Smith",
      "status": "active",
      "createdAt": "2024-03-21T10:00:00Z"
    }
  ]
}
```

## Error Responses

### Role Not Found

```json theme={null}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "Role not found"
  }
}
```

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.metabind.ai/app/v1/organizations/org123/roles/role123/users" \
    -H "Authorization: Bearer YOUR_JWT"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.metabind.ai/app/v1/organizations/org123/roles/role123/users',
    {
      headers: {
        'Authorization': 'Bearer YOUR_JWT'
      }
    }
  );

  const { data: users } = await response.json();
  console.log(`${users.length} users have this role`);
  ```

  ```swift Swift theme={null}
  let url = URL(string: "https://api.metabind.ai/app/v1/organizations/org123/roles/role123/users")!
  var request = URLRequest(url: url)
  request.setValue("Bearer YOUR_JWT", forHTTPHeaderField: "Authorization")

  let (data, _) = try await URLSession.shared.data(for: request)
  let result = try JSONDecoder().decode(UserListResponse.self, from: data)
  ```

  ```kotlin Kotlin theme={null}
  val response = client.get("https://api.metabind.ai/app/v1/organizations/org123/roles/role123/users") {
      header("Authorization", "Bearer YOUR_JWT")
  }

  val result = response.body<UserListResponse>()
  println("${result.data.size} users have this role")
  ```
</CodeGroup>
