> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trae.cn/llms.txt?lang=zh
> Use this file to discover all available pages before exploring further.

获取指定时间范围内，企业的 OpenAPI 调用日志。

## 所需权限 {#b7a721fe}

`audit`

## 请求说明 {#a7892641}

* 请求方式：`GET`
* 请求地址：`{域名}/openapi/v1/audit/openapi-logs`

## 注意事项 {#hkLwa1mRm}

时间跨度最大为 90 天。

## 请求参数 {#请求参数}

### 请求头参数 {#请求头参数}

<!-- @cols-width: 172,122,596 -->
| **Header 参数**  | **是否必填**  | **描述**  |
| --- | --- | --- |
| `Authorization`  | 是  | 固定取值为 `Bearer {access_token}`。关于如何获取访问令牌，参考[鉴权](enterprise_authentication)。  |

### 查询参数 {#6d5dc98e}

<!-- @cols-width: 146,146,146,146,282 -->
| **参数**  | **类型**  | **是否必填**  | **默认值**  | **描述**  |
| --- | --- | --- | --- | --- |
| `start_time`  | int  | 是  | \-  | 开始时间，Unix 秒级时间戳。  |
| `end_time`  | int  | 是  | \-  | 结束时间，Unix 秒级时间戳。  |
| `page`  | int  | 否  | `1`  | 需要获取的页数。  |
| `page_size`  | int  | 否  | `50`  | 每页返回的日志条数。取值范围：[1, 200]。  |
| `source_ip`  | string  | 否  | \-  | 按来源 IP 过滤日志。  |
| `api_path`  | string  | 否  | \-  | 按 API 路径过滤日志。  |

## 响应参数 {#228eaa1d}

该接口独有的响应参数如下，参数位于 `data.items[]` 数组中。通用响应参数参考[此文档](/enterprise_general-response-schema)。

<!-- @cols-width: 244,244,244 -->
| **参数**  | **类型**  | **描述**  |
| --- | --- | --- |
| `log_id`  | string  | 日志 ID。  |
| `app_id`  | string  | 脱敏后的应用 ID。  |
| `api_path`  | string  | 请求路径。  |
| `http_method`  | string  | HTTP 方法。  |
| `source_ip`  | string  | 来源 IP。  |
| `status_code`  | int  | HTTP 响应状态码。  |
| `operation_time`  | int64  | 调用时间（秒时间戳）。  |

## 示例 {#示例}

### 请求示例 {#0349f0cc}

```Bash
curl -X GET "https://{domain}/openapi/v1/audit/openapi-logs?start_time=1700000000&end_time=1700086400&page=1&page_size=50" \
  -H "Authorization: Bearer {access_token}"
```

### 响应示例 {#bc67d506}

```JSON
{
  "code": 0,
  "message": "success",
  "request_id": "req_xxx",
  "data": {
    "items": [
      {
        "log_id": "123",
        "app_id": "AK1234****5678",
        "api_path": "/openapi/v1/users",
        "http_method": "GET",
        "source_ip": "1.2.3.4",
        "status_code": 200,
        "operation_time": 1700000000
      }
    ],
    "pagination": {
      "page": 1,
      "page_size": 50,
      "total": 100,
      "total_pages": 2
    }
  }
}
```

## 错误码 {#错误码}

若该接口的请求返回错误码，参考[错误码](/enterprise_error-codes)文档进行排查。
