> ## 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.

# 获取应用日志

> 获取应用最新的 1000 行日志。该接口的速率限制为每 5 秒 1 次请求。

<Warning>
  该接口有严格的速率限制。超出**任意**一项限制都会返回 `429 Too Many Requests`：

  * 每个用户、每个应用**每 5 秒 1 次请求**。
  * 每个用户跨所有应用**每 10 秒 20 次请求**，之后进入 **30 秒的冷却期**。

  当你收到 `429` 时，停止轮询该应用，并至少等待冷却时间（约 30 秒）后再重试。
</Warning>

<Tip>
  仅在需要日志的**某一时刻快照**时使用该接口（打开日志标签页或手动刷新）。对于**实时、连续的日志**，请使用 [实时日志](/zh/api-reference/endpoint/apps/realtime)（SSE）接口，它会实时流式传输日志且不会触发此速率限制。
</Tip>

<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>

### 响应

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

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

  <Expandable title="展开对象">
    <ResponseField name="logs" type="string">
      应用最新的日志。
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json theme={null}
  {
      "status": "success",
      "response": {
          "logs": "Working!"
      }
  }
  ```
</ResponseExample>
