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

# ネットワークエラー

> アプリケーションの 5xx(オプションで 4xx)エッジエラーを集計した内訳を取得します。

指定した期間におけるアプリケーションのエッジエラー数を集計し、ステータスコード、時間バケット、リクエストパス、HTTP メソッドごとにグループ化して返します。デフォルトでは 5xx レスポンスのみが対象です。4xx レスポンスもカウントするには `include_4xx=true` を指定してください。

<Info>
  キャッシュミス時のレート制限: オーナーごとに60秒あたり15リクエスト。該当するエラーがない場合、または期間がアプリケーションの作成日より前の場合は、空の内訳を返します。
</Info>

<ParamField header="Authorization" type="string" placeholder="API Key" required>
  アカウントの API キーです。これは[アカウント設定](https://squarecloud.app/ja/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 形式の開始タイムスタンプ。
</ParamField>

<ParamField query="end" type="string" placeholder="ISO 8601 timestamp" required>
  ISO 8601 形式の終了タイムスタンプ。`start` より後である必要があります。
</ParamField>

<ParamField query="include_4xx" type="string" placeholder="false">
  5xx エラーに加えて 4xx レスポンスを含めるかどうか。`true` または `false` を指定します。デフォルトは `false` です。
</ParamField>

### レスポンス

<ResponseField name="status" type="string">
  呼び出しが成功したかどうかを示します。成功した場合は `success`、失敗した場合は `error` です。
</ResponseField>

<ResponseField name="response" type="object">
  期間内の集計されたエラー内訳。

  <Expandable title="レスポンスオブジェクトを切り替え">
    <ResponseField name="summary" type="object">
      期間内の概要合計。

      <Expandable title="summary オブジェクトを切り替え">
        <ResponseField name="total" type="integer">期間内のエラーレスポンスの総数。</ResponseField>

        <ResponseField name="by_class" type="object">
          HTTP ステータスクラスごとに分類した合計。

          <Expandable title="by_class オブジェクトを切り替え">
            <ResponseField name="4xx" type="integer">4xx レスポンスの合計(`include_4xx=true` の場合のみ設定されます)。</ResponseField>
            <ResponseField name="5xx" type="integer">5xx レスポンスの合計。</ResponseField>
          </Expandable>
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="by_status" type="array">
      観測された個々の HTTP ステータスコードごとにグループ化したリクエスト数。

      <Expandable title="by_status 項目を切り替え">
        <ResponseField name="status" type="integer">HTTP ステータスコード(例: `502`、`504`)。</ResponseField>
        <ResponseField name="requests" type="integer">このステータスコードを返したリクエストの総数。</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="timeseries" type="array">
      分析期間全体にわたる時間バケット単位のカウント。

      <Expandable title="timeseries 項目を切り替え">
        <ResponseField name="date" type="string">ISO 8601 形式のバケット開始タイムスタンプ。</ResponseField>
        <ResponseField name="buckets" type="object">HTTP ステータスコードをキーとし、このバケットで観測されたカウントを値とするオブジェクト。</ResponseField>
        <ResponseField name="total" type="integer">このバケットで観測されたエラーの総数。</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="top_paths" type="array">
      期間中に最も多くのエラーを発生させたパス。

      <Expandable title="top_paths 項目を切り替え">
        <ResponseField name="path" type="string">リクエストパス。</ResponseField>
        <ResponseField name="method" type="string">HTTP メソッド。</ResponseField>
        <ResponseField name="total" type="integer">このパス/メソッドのエラー総数。</ResponseField>
        <ResponseField name="by_status" type="object">このパス/メソッドで観測された HTTP ステータスコードごとのカウント。</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="by_method" type="array">
      HTTP メソッドごとにグループ化した集計エラー総数。

      <Expandable title="by_method 項目を切り替え">
        <ResponseField name="method" type="string">HTTP メソッド。</ResponseField>
        <ResponseField name="total" type="integer">このメソッドのエラー総数。</ResponseField>
        <ResponseField name="by_status" type="object">このメソッドで観測された HTTP ステータスコードごとのカウント。</ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json theme={null}
  {
    "status": "success",
    "response": {
      "summary": {
        "total": 42,
        "by_class": {
          "4xx": 0,
          "5xx": 42
        }
      },
      "by_status": [
        { "status": 502, "requests": 30 },
        { "status": 504, "requests": 12 }
      ],
      "timeseries": [
        {
          "date": "2025-12-01T12:00:00.000Z",
          "buckets": { "502": 5, "504": 2 },
          "total": 7
        }
      ],
      "top_paths": [
        {
          "path": "/api/users",
          "method": "GET",
          "total": 18,
          "by_status": { "502": 15, "504": 3 }
        }
      ],
      "by_method": [
        {
          "method": "GET",
          "total": 30,
          "by_status": { "502": 22, "504": 8 }
        }
      ]
    }
  }
  ```
</ResponseExample>
