> 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/squadssdk.md).

# Squads

## Overview

### Available Operations

* [list](#list) - Get All Squads
* [get\_by\_id](#get_by_id) - Get Squad By ID
* [update\_v4](#update_v4) - Update Squad
* [remove\_member](#remove_member) - Remove Squad Member
* [delete](#delete) - Delete Squad

## list

This endpoint is used to get all the squads details of your organization. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `squad-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.squads.list(owner_id="<id>")

    # Handle response
    print(res)

```

### Parameters

| Parameter  | Type                                                                                                                           | Required             | Description                                                         |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------------------------------- |
| `owner_id` | *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.SquadsGetAllSquadsResponse**](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/squadsgetallsquadsresponse.md)

### Errors

| Error Type             | Status Code                       | Content Type     |
| ---------------------- | --------------------------------- | ---------------- |
| errors.CommonV4Error   | 400, 401, 402, 403, 404, 409, 422 | application/json |
| errors.CommonV4Error   | 500, 502, 503, 504                | application/json |
| errors.SDKDefaultError | 4XX, 5XX                          | \*/\*            |

## get\_by\_id

This endpoint is used to get the squads details by id. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `squad-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.squads.get_by_id(squad_id="<id>")

    # Handle response
    print(res)

```

### Parameters

| Parameter  | Type                                                                                                                           | Required             | Description                                                         |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------------------------------- |
| `squad_id` | *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.SquadsGetSquadByIDResponse**](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/squadsgetsquadbyidresponse.md)

### Errors

| Error Type             | Status Code                       | Content Type     |
| ---------------------- | --------------------------------- | ---------------- |
| errors.CommonV4Error   | 400, 401, 402, 403, 404, 409, 422 | application/json |
| errors.CommonV4Error   | 500, 502, 503, 504                | application/json |
| errors.SDKDefaultError | 4XX, 5XX                          | \*/\*            |

## update\_v4

This endpoint is used to update squad.

The role will be considered only if your organization is on the OBAC permission model; otherwise, the role field will be ignored, and only the member will be added to the squad. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `squad-create` scope.

### Example Usage

```python
from squadcast import SquadcastSDK


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

    res = squadcast_sdk.squads.update_v4(squad_id="<id>")

    # Handle response
    print(res)

```

### Parameters

| Parameter  | Type                                                                                                                                 | Required             | Description                                                         |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------------------------------- |
| `squad_id` | *str*                                                                                                                                | :heavy\_check\_mark: | N/A                                                                 |
| `name`     | *Optional\[str]*                                                                                                                     | :heavy\_minus\_sign: | N/A                                                                 |
| `members`  | List\[[models.V4SquadsSquadMember](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/v4squadssquadmember.md)] | :heavy\_minus\_sign: | 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.SquadsUpdateSquadResponse**](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/squadsupdatesquadresponse.md)

### Errors

| Error Type             | Status Code                       | Content Type     |
| ---------------------- | --------------------------------- | ---------------- |
| errors.CommonV4Error   | 400, 401, 402, 403, 404, 409, 422 | application/json |
| errors.CommonV4Error   | 500, 502, 503, 504                | application/json |
| errors.SDKDefaultError | 4XX, 5XX                          | \*/\*            |

## remove\_member

This endpoint is used to update squad member's role.

If you're attempting to remove a member whose role is 'owner', and that 'owner' is the last squad owner, then the 'replaceWith' query parameter is required. Setting 'replaceWith' to 'member' will promote another member as the owner, and the specified member will be removed.

Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `squad-create` scope.

### Example Usage

```python
from squadcast import SquadcastSDK


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

    res = squadcast_sdk.squads.remove_member(squad_id="<id>", member_id="<id>", replace_with="<value>")

    # Handle response
    print(res)

```

### Parameters

| Parameter      | Type                                                                                                                           | Required             | Description                                                         |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------------------------------- |
| `squad_id`     | *str*                                                                                                                          | :heavy\_check\_mark: | N/A                                                                 |
| `member_id`    | *str*                                                                                                                          | :heavy\_check\_mark: | N/A                                                                 |
| `replace_with` | *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.V4SquadsRemoveSquadMemberResponse**](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/v4squadsremovesquadmemberresponse.md)

### Errors

| Error Type             | Status Code                       | Content Type     |
| ---------------------- | --------------------------------- | ---------------- |
| errors.CommonV4Error   | 400, 401, 402, 403, 404, 409, 422 | application/json |
| errors.CommonV4Error   | 500, 502, 503, 504                | application/json |
| errors.SDKDefaultError | 4XX, 5XX                          | \*/\*            |

## delete

This endpoint is used to delete the squad. Squad should not be assigned to any incident or part of any escalation policy. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `squad-update` scope.

### Example Usage

```python
from squadcast import SquadcastSDK


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

    res = squadcast_sdk.squads.delete(squad_id="<id>")

    # Handle response
    print(res)

```

### Parameters

| Parameter  | Type                                                                                                                           | Required             | Description                                                         |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------------------------------- |
| `squad_id` | *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

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

### Errors

| Error Type             | Status Code                       | Content Type     |
| ---------------------- | --------------------------------- | ---------------- |
| errors.CommonV4Error   | 400, 401, 402, 403, 404, 409, 422 | application/json |
| errors.CommonV4Error   | 500, 502, 503, 504                | application/json |
| errors.SDKDefaultError | 4XX, 5XX                          | \*/\*            |
