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

# AuditLogs

## Overview

### Available Operations

* [list](#list) - List all Audit Logs
* [export](#export) - Initiate an asynchronous export of audit logs based on the provided filters. The export file will be generated and available for download. Use 'Get details of Audit Logs export history by ID' API to retrieve the download URL.
* [list\_export\_history](#list_export_history) - List all Audit Logs export history
* [get\_export\_history\_by\_id](#get_export_history_by_id) - Get details of Audit Logs export history by ID
* [get\_by\_id](#get_by_id) - Get audit log by ID

## list

List all Audit Logs Returns array of audit logs for given team and filters

### Example Usage

```python
from datetime import date
from squadcast import SquadcastSDK


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

    res = squadcast_sdk.audit_logs.list(page_size=832442, page_number=555332, start_date=date.fromisoformat("2023-03-04"), end_date=date.fromisoformat("2024-08-07"))

    while res is not None:
        # Handle items

        res = res.next()

```

### Parameters

| Parameter     | Type                                                                                                                           | Required             | Description                                                         |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------------------------------- |
| `page_size`   | *int*                                                                                                                          | :heavy\_check\_mark: | N/A                                                                 |
| `page_number` | *int*                                                                                                                          | :heavy\_check\_mark: | N/A                                                                 |
| `start_date`  | [datetime](https://docs.python.org/3/library/datetime.html#datetime-objects)                                                   | :heavy\_check\_mark: | N/A                                                                 |
| `end_date`    | [datetime](https://docs.python.org/3/library/datetime.html#datetime-objects)                                                   | :heavy\_check\_mark: | N/A                                                                 |
| `action`      | List\[*str*]                                                                                                                   | :heavy\_minus\_sign: | N/A                                                                 |
| `resource`    | List\[*str*]                                                                                                                   | :heavy\_minus\_sign: | N/A                                                                 |
| `actor`       | List\[*str*]                                                                                                                   | :heavy\_minus\_sign: | N/A                                                                 |
| `team`        | List\[*str*]                                                                                                                   | :heavy\_minus\_sign: | N/A                                                                 |
| `client`      | List\[[models.Client](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/client.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.AuditLogsListAuditLogsResponse**](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/auditlogslistauditlogsresponse.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    | \*/\*            |

## export

Export Audit logs Initiates export of audit logs based on provided filters

### Example Usage

```python
from datetime import date
from squadcast import SquadcastSDK


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

    res = squadcast_sdk.audit_logs.export(filters={
        "start_date": date.fromisoformat("2025-07-29"),
        "end_date": date.fromisoformat("2023-09-09"),
    }, name="<value>", export_type="json")

    # Handle response
    print(res)

```

### Parameters

| Parameter     | Type                                                                                                                           | Required             | Description                                                         |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------------------------------- |
| `filters`     | [models.Filters](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/filters.md)                          | :heavy\_check\_mark: | N/A                                                                 |
| `name`        | *str*                                                                                                                          | :heavy\_check\_mark: | N/A                                                                 |
| `export_type` | [models.ExportType](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/exporttype.md)                    | :heavy\_check\_mark: | N/A                                                                 |
| `description` | *Optional\[str]*                                                                                                               | :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.V3AuditLogsExportAuditLogsResponse**](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/v3auditlogsexportauditlogsresponse.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    | \*/\*            |

## list\_export\_history

List all Audit Logs export history Returns array of audit logs export history

### Example Usage

```python
from squadcast import SquadcastSDK


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

    res = squadcast_sdk.audit_logs.list_export_history(page_size=159672, page_number=351281)

    while res is not None:
        # Handle items

        res = res.next()

```

### Parameters

| Parameter     | Type                                                                                                                           | Required             | Description                                                         |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------------------------------- |
| `page_size`   | *int*                                                                                                                          | :heavy\_check\_mark: | N/A                                                                 |
| `page_number` | *int*                                                                                                                          | :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.AuditLogsListAuditLogsExportHistoryResponse**](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/auditlogslistauditlogsexporthistoryresponse.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\_export\_history\_by\_id

Get details of Audit Logs export history by ID Returns audit log export history details for the specified ID

### Example Usage

```python
from squadcast import SquadcastSDK


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

    res = squadcast_sdk.audit_logs.get_export_history_by_id(id="<id>")

    # Handle response
    print(res)

```

### Parameters

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

Get audit log by ID Returns audit log details for the specified ID

### Example Usage

```python
from squadcast import SquadcastSDK


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

    res = squadcast_sdk.audit_logs.get_by_id(id="<id>")

    # Handle response
    print(res)

```

### Parameters

| Parameter | Type                                                                                                                           | Required             | Description                                                         |
| --------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------------------------------- |
| `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.V3AuditLogsGetAuditLogByIDResponse**](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/models/v3auditlogsgetauditlogbyidresponse.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    | \*/\*            |
