> For the complete documentation index, see [llms.txt](https://developers.incidents.cloud.solarwinds.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/sdks/users.md).

# Users

## Overview

### Available Operations

* [get\_all](#get_all) - Get All Users
* [add](#add) - Add User
* [update\_org\_level\_permissions](#update_org_level_permissions) - Update Org Level Permissions
* [delete](#delete) - Delete User
* [get\_roles](#get_roles) - Get User Roles
* [remove\_from\_org](#remove_from_org) - Remove User From Org
* [get\_by\_id](#get_by_id) - Get User By ID
* [update\_by\_id](#update_by_id) - Update User by userID

## get\_all

Returns all the users of the organization. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `read` scope.

### Example Usage

```python
from squadcast import SquadcastSDK


with SquadcastSDK(
    refresh_token_auth="<YOUR_REFRESH_TOKEN_AUTH_HERE>",
) as squadcast_sdk:

    res = squadcast_sdk.users.get_all()

    # Handle response
    print(res)

```

### Parameters

| Parameter | Type                                                                                                                           | Required             | Description                                                         |
| --------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------------------------------- |
| `retries` | [Optional\[utils.RetryConfig\]](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/utils/retryconfig.md) | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. |

### Response

[**models.UsersGetAllUsersResponse**](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/usersgetallusersresponse.md)

### Errors

| Error Type                      | Status Code | Content Type     |
| ------------------------------- | ----------- | ---------------- |
| errors.BadRequestError          | 400         | application/json |
| errors.UnauthorizedError        | 401         | application/json |
| errors.PaymentRequiredError     | 402         | application/json |
| errors.ForbiddenError           | 403         | application/json |
| errors.NotFoundError            | 404         | application/json |
| errors.ConflictError            | 409         | application/json |
| errors.UnprocessableEntityError | 422         | application/json |
| errors.InternalServerError      | 500         | application/json |
| errors.BadGatewayError          | 502         | application/json |
| errors.ServiceUnavailableError  | 503         | application/json |
| errors.GatewayTimeoutError      | 504         | application/json |
| errors.SDKDefaultError          | 4XX, 5XX    | \*/\*            |

## add

Add user to the organization with given role if not exists. Returns the user object in response. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `user-write` scope.

### Example Usage

```python
from squadcast import SquadcastSDK


with SquadcastSDK(
    refresh_token_auth="<YOUR_REFRESH_TOKEN_AUTH_HERE>",
) as squadcast_sdk:

    res = squadcast_sdk.users.add(email="Clovis_Reynolds@hotmail.com", role="account_owner", first_name="Yvonne", last_name="Kozey")

    # Handle response
    print(res)

```

### Parameters

| Parameter    | Type                                                                                                                                      | Required             | Description                                                         |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------- |
| `email`      | *str*                                                                                                                                     | :heavy\_check\_mark: | N/A                                                                 |
| `role`       | [models.V3UsersAddUserRequestRole](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/v3usersadduserrequestrole.md) | :heavy\_check\_mark: | N/A                                                                 |
| `first_name` | *str*                                                                                                                                     | :heavy\_check\_mark: | N/A                                                                 |
| `last_name`  | *str*                                                                                                                                     | :heavy\_check\_mark: | N/A                                                                 |
| `retries`    | [Optional\[utils.RetryConfig\]](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/utils/retryconfig.md)            | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. |

### Response

[**models.UsersAddUserResponse**](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/usersadduserresponse.md)

### Errors

| Error Type                      | Status Code | Content Type     |
| ------------------------------- | ----------- | ---------------- |
| errors.BadRequestError          | 400         | application/json |
| errors.UnauthorizedError        | 401         | application/json |
| errors.PaymentRequiredError     | 402         | application/json |
| errors.ForbiddenError           | 403         | application/json |
| errors.NotFoundError            | 404         | application/json |
| errors.ConflictError            | 409         | application/json |
| errors.UnprocessableEntityError | 422         | application/json |
| errors.InternalServerError      | 500         | application/json |
| errors.BadGatewayError          | 502         | application/json |
| errors.ServiceUnavailableError  | 503         | application/json |
| errors.GatewayTimeoutError      | 504         | application/json |
| errors.SDKDefaultError          | 4XX, 5XX    | \*/\*            |

## update\_org\_level\_permissions

Update Org Level Permissions

### Example Usage

```python
from squadcast import SquadcastSDK


with SquadcastSDK(
    refresh_token_auth="<YOUR_REFRESH_TOKEN_AUTH_HERE>",
) as squadcast_sdk:

    res = squadcast_sdk.users.update_org_level_permissions(data=[])

    # Handle response
    print(res)

```

### Parameters

| Parameter | Type                                                                                                                                                                     | Required             | Description                                                         |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------------------------------- |
| `data`    | List\[[models.V3UsersUpdateUserAbilitiesRequestData](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/v3usersupdateuserabilitiesrequestdata.md)] | :heavy\_check\_mark: | N/A                                                                 |
| `retries` | [Optional\[utils.RetryConfig\]](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/utils/retryconfig.md)                                           | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. |

### Response

[**models.UsersUpdateOrgLevelPermissionsResponse**](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/usersupdateorglevelpermissionsresponse.md)

### Errors

| Error Type                      | Status Code | Content Type     |
| ------------------------------- | ----------- | ---------------- |
| errors.BadRequestError          | 400         | application/json |
| errors.UnauthorizedError        | 401         | application/json |
| errors.PaymentRequiredError     | 402         | application/json |
| errors.ForbiddenError           | 403         | application/json |
| errors.NotFoundError            | 404         | application/json |
| errors.ConflictError            | 409         | application/json |
| errors.UnprocessableEntityError | 422         | application/json |
| errors.InternalServerError      | 500         | application/json |
| errors.BadGatewayError          | 502         | application/json |
| errors.ServiceUnavailableError  | 503         | application/json |
| errors.GatewayTimeoutError      | 504         | application/json |
| errors.SDKDefaultError          | 4XX, 5XX    | \*/\*            |

## delete

This API replaces the swap\_user for all the entities in Squadcast with user\_id provided and deletes the user.

### Example Usage

```python
from squadcast import SquadcastSDK


with SquadcastSDK(
    refresh_token_auth="<YOUR_REFRESH_TOKEN_AUTH_HERE>",
) as squadcast_sdk:

    res = squadcast_sdk.users.delete(user_id="<id>", swap_user_id="<id>", suppress_incidents=True, reassign_incidents=True)

    # Handle response
    print(res)

```

### Parameters

| Parameter            | Type                                                                                                                           | Required             | Description                                                         |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------------------------------- |
| `user_id`            | *str*                                                                                                                          | :heavy\_check\_mark: | N/A                                                                 |
| `swap_user_id`       | *str*                                                                                                                          | :heavy\_check\_mark: | N/A                                                                 |
| `suppress_incidents` | *bool*                                                                                                                         | :heavy\_check\_mark: | N/A                                                                 |
| `reassign_incidents` | *bool*                                                                                                                         | :heavy\_check\_mark: | N/A                                                                 |
| `retries`            | [Optional\[utils.RetryConfig\]](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/utils/retryconfig.md) | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. |

### Response

[**models.UsersDeleteUserResponse**](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/usersdeleteuserresponse.md)

### Errors

| Error Type                      | Status Code | Content Type     |
| ------------------------------- | ----------- | ---------------- |
| errors.BadRequestError          | 400         | application/json |
| errors.UnauthorizedError        | 401         | application/json |
| errors.PaymentRequiredError     | 402         | application/json |
| errors.ForbiddenError           | 403         | application/json |
| errors.NotFoundError            | 404         | application/json |
| errors.ConflictError            | 409         | application/json |
| errors.UnprocessableEntityError | 422         | application/json |
| errors.InternalServerError      | 500         | application/json |
| errors.BadGatewayError          | 502         | application/json |
| errors.ServiceUnavailableError  | 503         | application/json |
| errors.GatewayTimeoutError      | 504         | application/json |
| errors.SDKDefaultError          | 4XX, 5XX    | \*/\*            |

## get\_roles

Returns all available user roles. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `read` scope.

### Example Usage

```python
from squadcast import SquadcastSDK


with SquadcastSDK(
    refresh_token_auth="<YOUR_REFRESH_TOKEN_AUTH_HERE>",
) as squadcast_sdk:

    res = squadcast_sdk.users.get_roles()

    # Handle response
    print(res)

```

### Parameters

| Parameter | Type                                                                                                                           | Required             | Description                                                         |
| --------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------------------------------- |
| `retries` | [Optional\[utils.RetryConfig\]](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/utils/retryconfig.md) | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. |

### Response

[**models.UsersGetUserRolesResponse**](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/usersgetuserrolesresponse.md)

### Errors

| Error Type                      | Status Code | Content Type     |
| ------------------------------- | ----------- | ---------------- |
| errors.BadRequestError          | 400         | application/json |
| errors.UnauthorizedError        | 401         | application/json |
| errors.PaymentRequiredError     | 402         | application/json |
| errors.ForbiddenError           | 403         | application/json |
| errors.NotFoundError            | 404         | application/json |
| errors.ConflictError            | 409         | application/json |
| errors.UnprocessableEntityError | 422         | application/json |
| errors.InternalServerError      | 500         | application/json |
| errors.BadGatewayError          | 502         | application/json |
| errors.ServiceUnavailableError  | 503         | application/json |
| errors.GatewayTimeoutError      | 504         | application/json |
| errors.SDKDefaultError          | 4XX, 5XX    | \*/\*            |

## remove\_from\_org

Remove user from organization. Upon sccess the user will be removed from the organization. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `user-write` scope.

### Example Usage

```python
from squadcast import SquadcastSDK


with SquadcastSDK(
    refresh_token_auth="<YOUR_REFRESH_TOKEN_AUTH_HERE>",
) as squadcast_sdk:

    res = squadcast_sdk.users.remove_from_org(user_id="<id>")

    # Handle response
    print(res)

```

### Parameters

| Parameter | Type                                                                                                                           | Required             | Description                                                         |
| --------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------------------------------- |
| `user_id` | *str*                                                                                                                          | :heavy\_check\_mark: | (Required) user id                                                  |
| `retries` | [Optional\[utils.RetryConfig\]](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/utils/retryconfig.md) | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. |

### Response

[**bytes**](https://github.com/solarwinds/squadcast-sdk-python/tree/main/squadcastv1/docs/models/.md/README.md)

### Errors

| Error Type                      | Status Code | Content Type     |
| ------------------------------- | ----------- | ---------------- |
| errors.BadRequestError          | 400         | application/json |
| errors.UnauthorizedError        | 401         | application/json |
| errors.PaymentRequiredError     | 402         | application/json |
| errors.ForbiddenError           | 403         | application/json |
| errors.NotFoundError            | 404         | application/json |
| errors.ConflictError            | 409         | application/json |
| errors.UnprocessableEntityError | 422         | application/json |
| errors.InternalServerError      | 500         | application/json |
| errors.BadGatewayError          | 502         | application/json |
| errors.ServiceUnavailableError  | 503         | application/json |
| errors.GatewayTimeoutError      | 504         | application/json |
| errors.SDKDefaultError          | 4XX, 5XX    | \*/\*            |

## get\_by\_id

Returns a users details of the given `userID` in the request param. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `read` scope.

### Example Usage

```python
from squadcast import SquadcastSDK


with SquadcastSDK(
    refresh_token_auth="<YOUR_REFRESH_TOKEN_AUTH_HERE>",
) as squadcast_sdk:

    res = squadcast_sdk.users.get_by_id(user_id="<id>")

    # Handle response
    print(res)

```

### Parameters

| Parameter | Type                                                                                                                           | Required             | Description                                                         |
| --------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------------------------------- |
| `user_id` | *str*                                                                                                                          | :heavy\_check\_mark: | (Required) user id                                                  |
| `retries` | [Optional\[utils.RetryConfig\]](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/utils/retryconfig.md) | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. |

### Response

[**models.UsersGetUserByIDResponse**](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/usersgetuserbyidresponse.md)

### Errors

| Error Type                      | Status Code | Content Type     |
| ------------------------------- | ----------- | ---------------- |
| errors.BadRequestError          | 400         | application/json |
| errors.UnauthorizedError        | 401         | application/json |
| errors.PaymentRequiredError     | 402         | application/json |
| errors.ForbiddenError           | 403         | application/json |
| errors.NotFoundError            | 404         | application/json |
| errors.ConflictError            | 409         | application/json |
| errors.UnprocessableEntityError | 422         | application/json |
| errors.InternalServerError      | 500         | application/json |
| errors.BadGatewayError          | 502         | application/json |
| errors.ServiceUnavailableError  | 503         | application/json |
| errors.GatewayTimeoutError      | 504         | application/json |
| errors.SDKDefaultError          | 4XX, 5XX    | \*/\*            |

## update\_by\_id

Update User by userID. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `user-write` scope.

### Example Usage

```python
from squadcast import SquadcastSDK


with SquadcastSDK(
    refresh_token_auth="<YOUR_REFRESH_TOKEN_AUTH_HERE>",
) as squadcast_sdk:

    res = squadcast_sdk.users.update_by_id(user_id="<id>", role="user")

    # Handle response
    print(res)

```

### Parameters

| Parameter | Type                                                                                                                                            | Required             | Description                                                         |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------- |
| `user_id` | *str*                                                                                                                                           | :heavy\_check\_mark: | (Required) user id                                                  |
| `role`    | [models.V3UsersUpdateUserRequestRole](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/v3usersupdateuserrequestrole.md) | :heavy\_check\_mark: | N/A                                                                 |
| `retries` | [Optional\[utils.RetryConfig\]](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/utils/retryconfig.md)                  | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. |

### Response

[**models.UsersUpdateUserByIDResponse**](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/usersupdateuserbyidresponse.md)

### Errors

| Error Type                      | Status Code | Content Type     |
| ------------------------------- | ----------- | ---------------- |
| errors.BadRequestError          | 400         | application/json |
| errors.UnauthorizedError        | 401         | application/json |
| errors.PaymentRequiredError     | 402         | application/json |
| errors.ForbiddenError           | 403         | application/json |
| errors.NotFoundError            | 404         | application/json |
| errors.ConflictError            | 409         | application/json |
| errors.UnprocessableEntityError | 422         | application/json |
| errors.InternalServerError      | 500         | application/json |
| errors.BadGatewayError          | 502         | application/json |
| errors.ServiceUnavailableError  | 503         | application/json |
| errors.GatewayTimeoutError      | 504         | application/json |
| errors.SDKDefaultError          | 4XX, 5XX    | \*/\*            |
