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

# 网络日志

> 获取应用各域名的逐请求边缘日志。

返回应用主域名及任何已配置的自定义域名的逐请求边缘日志（HTTP、国家/地区、状态、字节数）。最大保留窗口为 7 天；起始时间会被限制到应用的创建日期。

<Info>
  仅在 **Pro** 和 **Enterprise** 套餐上可用。缓存未命中速率限制：每个所有者每 60 秒 10 次请求。
</Info>

<ParamField header="Authorization" type="string" placeholder="API Key" required>
  你账户的 API 密钥。你可以在[账户设置](https://squarecloud.app/zh/account/security)中找到它。
</ParamField>

### 参数

<ParamField path="app_id" type="string" placeholder="Application ID" required>
  应用的 ID。你可以在应用仪表盘的 URL 中找到它。
</ParamField>

<ParamField query="start" type="string" placeholder="ISO 8601 timestamp" required>
  ISO 8601 起始时间戳。不能早于应用的创建日期，也不能早于 7 天前。
</ParamField>

<ParamField query="end" type="string" placeholder="ISO 8601 timestamp" required>
  ISO 8601 结束时间戳。必须晚于 `start`。
</ParamField>

### 响应

<ResponseField name="status" type="string">
  指示调用是否成功。成功时为 `success`，否则为 `error`。
</ResponseField>

<ResponseField name="response" type="array">
  响应的内容。

  <Expandable title="展开对象">
    <ResponseField name="timestamp" type="string">
      请求的时间戳，ISO 格式。
    </ResponseField>

    <ResponseField name="client" type="object">
      发起请求的客户端的相关信息。

      <Expandable title="展开 client 对象">
        <ResponseField name="ip" type="string | null">客户端的 IP 地址。</ResponseField>
        <ResponseField name="country" type="string | null">客户端的国家/地区代码。</ResponseField>
        <ResponseField name="location" type="string | null">客户端的大致位置。</ResponseField>
        <ResponseField name="asn" type="string">客户端的 ASN。</ResponseField>
        <ResponseField name="agent" type="string | null">客户端的 user agent。</ResponseField>
        <ResponseField name="category" type="string | null">客户端类别（例如 bot、human）。</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="request" type="object">
      传入请求的相关信息。

      <Expandable title="展开 request 对象">
        <ResponseField name="mitigated" type="boolean">该请求是否被边缘防护措施拦截。</ResponseField>
        <ResponseField name="method" type="string">使用的 HTTP 方法。</ResponseField>
        <ResponseField name="host" type="string">Host 头的值。</ResponseField>
        <ResponseField name="path" type="string">请求路径。</ResponseField>
        <ResponseField name="query" type="string | null">查询字符串。</ResponseField>
        <ResponseField name="protocol" type="string">使用的协议（例如 HTTP/2）。</ResponseField>
        <ResponseField name="referer" type="string | null">Referer 头的值。</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="response" type="object">
      在边缘处提供的响应的相关信息。

      <Expandable title="展开 response 对象">
        <ResponseField name="status" type="integer">返回的 HTTP 状态码。</ResponseField>
        <ResponseField name="contentType" type="string | null">响应内容类型。</ResponseField>
        <ResponseField name="cache" type="string | null">缓存状态（例如 HIT、MISS）。</ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json theme={null}
  {
    "status": "success",
    "response": [
      {
        "timestamp": "2025-12-01T12:00:00.000Z",
        "client": {
          "ip": "203.0.113.45",
          "country": "BR",
          "location": "São Paulo",
          "asn": "12345 - Example ISP",
          "agent": "Mozilla/5.0",
          "category": null
        },
        "request": {
          "mitigated": false,
          "method": "GET",
          "host": "my-app.squareweb.app",
          "path": "/api/users",
          "query": "?limit=10",
          "protocol": "HTTP/2",
          "referer": null
        },
        "response": {
          "status": 200,
          "contentType": "application/json",
          "cache": "MISS"
        }
      }
    ]
  }
  ```
</ResponseExample>
