# Lighthouse タスクの設定

**API:** Data API

**Endpoint:** `POST /v1/beta/dataforseo/on_page/lighthouse/task_post`

**Tags:** DataForSEO

Lighthouse 監査を待たずにキューに登録し、タスク `id` を返します。監査がツール呼び出しの待ち時間を超える場合に使用します。結果は `get_dataforseo_on_page_lighthouse_task_get_json` で取得し、何が準備できているかは `get_dataforseo_on_page_lighthouse_ready` で確認します。DataForSEO のエンベロープに包まれます。データは `tasks[0].result`、結果は `tasks[0].status_code` に格納され、拒否されたリクエストでも HTTP 200 が返ります。⚠️ 最終的に同じ 245 KB のレポートが返るため、コンテキストのコストは先送りされるだけで回避されません。後回しにせず、ここで `categories` か `audits` を使って絞り込んでください。

### 料金の参考情報

- 計測方法：報告されたレスポンスコスト。
- 参考リクエスト見積もり：0.0051 USD。
- 参照用の顧客乗数：1.0。確定済みの顧客金額に再適用しないでください。

参照用のメタデータのみであり、アカウントへの見積もり、保証された価格、支出上限ではありません。リソースクレジットは Felo クレジットではありません。最終的な請求は Felo の請求記録に従います。

## Base URL

- `https://openapi.felo.ai`

## Authentication

- `FeloBearerAuth` (http bearer, bearer format Felo API Key)
- `FeloApiKey` (apiKey in header `X-API-Key`)

## Request body

Required: **no**

### application/json

Schema:

```json
{
  "type": "array",
  "items": {
    "type": [
      "object",
      "null"
    ],
    "oneOf": [
      {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "<em>ターゲット URL</em><br><strong>必須フィールド</strong><br>ターゲットページは絶対 URL（http:// または https:// を含む）で指定する必要があります<br>例：<br><code>https://dataforseo.com/</code>"
          },
          "for_mobile": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "<em>モバイルエミュレーションを適用</em><br>任意フィールド<br><code>true</code> に設定すると、Lighthouse はモバイルデバイスと画面のエミュレーションを使用して、モバイル環境でページをテストします<br><code>false</code> に設定すると、デスクトップ向けの結果が返されます<br>デフォルト値：<code>false</code>"
          },
          "categories": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "<em>Lighthouse 監査のカテゴリ</em><br>任意フィールド<br>各カテゴリは監査と監査グループの集合で、そのセクションに重み付けとスコアリングを適用します（<a href=\"https://github.com/GoogleChrome/lighthouse/blob/master/docs/architecture.md#auditreport-terminology\" target=\"_blank\" rel=\"noopener noreferrer\">公式の定義を参照</a>）<strong>このフィールドを無視すると、<code>audits</code> を指定しない限り、すべてのカテゴリのデータが返されます</strong><br>このフィールドを使用すると、ここで指定した特定のカテゴリのデータを取得できます<p>可能な値：<br><code>seo</code>、<code>performance</code>、<code>best_practices</code>、<code>accessibility</code>"
          },
          "audits": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "<em>Lighthouse の監査</em><br>任意フィールド<br>監査は、Lighthouse が特定の機能/最適化/指標ごとに実行して数値スコアを算出する個別のテストです（<a href=\"https://github.com/GoogleChrome/lighthouse/blob/master/docs/architecture.md#components--terminology\" rel=\"noopener noreferrer\" target=\"_blank\">公式の定義を参照</a>）<strong>このフィールドを無視すると、すべての監査のデータが返されます</strong><br>このフィールドを使用すると、ここで指定した特定の監査のデータを取得できます<p><strong>注意</strong>：一部の監査は特定のカテゴリに属さず、独立したページ品質の測定値です<p>一般に、次のようないくつかの使用例があります：<p>1. <code>categories</code> を無視する場合、このフィールドを使用して指定した監査のデータのみを取得できます<br>たとえば、<code>\"categories\"</code> を無視し、<code>\"audits\": [\"metrics/cumulative-layout-shift\",\"metrics/largest-contentful-paint\",\"metrics/total-blocking-time\"]</code> を指定すると、これらの監査のデータのみが返されます<p>2. カテゴリを指定する場合、このフィールドを使用して、指定したカテゴリに属さない監査を追加で受け取ることができます<br>たとえば、<code>\"categories\": [\"seo\"]</code> と <code>\"audits\": [\"metrics/cumulative-layout-shift\",\"metrics/largest-contentful-paint\",\"metrics/total-blocking-time\"]</code> を指定すると、\"performance\" の下のこれらの監査のみと、\"seo\" の下のすべての監査が返されます<p>利用可能なすべての監査のリストは<a href=\"/v3/on_page/lighthouse/audits/\">こちら</a>で確認できます"
          },
          "version": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>Lighthouse のバージョン</em><br>任意フィールド<br>バージョン番号を指定すると、特定の Lighthouse バージョンの結果を取得できます<br>利用可能なバージョンのリストは、<a href=\"/v3/on_page/lighthouse/versions/\" target=\"_blank\" rel=\"noopener noreferrer\">Lighthouse Versions エンドポイント</a>から取得できます"
          },
          "language_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>Lighthouse の言語名</em><br>任意フィールド<br><code>https://api.dataforseo.com/v3/on_page/lighthouse/languages</code> に個別にリクエストすると、検索エンジンの利用可能な言語とその <code>language_name</code> のリストを取得できます<br>デフォルト値：<br><code class=\"long-string\">English</code>"
          },
          "language_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>Lighthouse の言語コード</em><br>任意フィールド<br><code>https://api.dataforseo.com/v3/on_page/lighthouse/languages</code> に個別にリクエストすると、検索エンジンの利用可能な言語とその <code>language_code</code> のリストを取得できます<br>デフォルト値：<br><code class=\"long-string\">en</code>"
          },
          "custom_user_agent": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>カスタムユーザーエージェント</em><br>任意フィールド<br>Lighthouse 監査を実行するときにブラウザーが使用するカスタムユーザーエージェントを指定します；<br>最大 254 文字まで指定できます；"
          },
          "browser_screen_width": {
            "type": [
              "integer",
              "null"
            ],
            "description": "<em>ブラウザースクリーンの幅</em><br>任意フィールド<br>特定のデバイスをエミュレートするために、Lighthouse 監査に使用するブラウザーのスクリーンの幅を設定します；<br><code>240–9999</code> の範囲で指定できます；",
            "format": "int64"
          },
          "browser_screen_height": {
            "type": [
              "integer",
              "null"
            ],
            "description": "<em>ブラウザースクリーンの高さ</em><br>任意フィールド<br>特定のデバイスをエミュレートするために、Lighthouse 監査に使用するブラウザーのスクリーンの高さを設定します；<br><code>240–9999</code> の範囲で指定できます；"
          },
          "browser_screen_scale_factor": {
            "type": [
              "number",
              "null"
            ],
            "description": "<em>ブラウザースクリーンのスケール係数</em><br>任意フィールド<br>Lighthouse 監査に使用するブラウザーのデバイスピクセル比を設定します；<br><code>0.5–3</code> の範囲で指定できます；"
          },
          "browser_network_throttling_method": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>ブラウザーのネットワークスロットリング方法</em><br>任意フィールド<br>Lighthouse 監査中にスロットリングを適用する方法を定義します；<br>可能な値：<br><code>simulate</code> - 明示的なスロットリングを適用せずに推定パフォーマンス指標を計算します；<br><code>devtools</code> - <code>browser_network_throttling</code> と <code>browser_cpu_throttling_multiplier</code> で指定されたスロットリング設定を適用します；<br><code>provided</code> - クロール環境のネットワーク条件を使用します；"
          },
          "browser_cpu_throttling_multiplier": {
            "type": [
              "number",
              "null"
            ],
            "description": "<em>ブラウザーの CPU スロットリング倍率</em><br><strong><code>browser_network_throttling_method</code> が <code>devtools</code> に設定されている場合は必須；</strong><br>Lighthouse 監査中にデバイスのパフォーマンス条件をシミュレートするため、CPU スロットリング倍率を設定します；<br><code>1–4</code> の範囲で指定できます；<br><strong>注意：</strong>このパラメーターは、<code>browser_network_throttling_method</code> が <code>devtools</code> に設定されている場合にのみ適用されます；"
          },
          "browser_network_throttling": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>ブラウザーのネットワークスロットリング</em><br><strong><code>browser_network_throttling_method</code> が <code>devtools</code> に設定されている場合は必須；</strong><br>Lighthouse 監査中に接続速度の条件をシミュレートするため、ネットワークスロットリングプロファイルを設定します；<br>可能な値：<code>no_throttling</code>、<code>fast_4g</code>、<code>slow_4g</code>、<code>regular_3g</code>、<code>pc</code>；<br><strong>注意：</strong>このパラメーターは、<code>browser_network_throttling_method</code> が <code>devtools</code> に設定されている場合にのみ適用されます；"
          },
          "tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>ユーザー定義のタスク識別子</em><br>任意フィールド<br><em>文字数上限は 255 です</em><br>このパラメーターを使ってタスクを識別し、結果と照合できます<br>指定した <code>tag</code> の値は、レスポンスの <code>data</code> オブジェクトに含まれます"
          },
          "pingback_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>完了したタスクの通知 URL</em><br>任意フィールド<br>タスクが完了すると、指定した URL に GET リクエストを送信して通知します<br>‘$id’ 文字列を <code>$id</code> 変数として、‘$tag’ を URL エンコードされた <code>$tag</code> 変数として使用できます。リクエストを送信する前に必要な値を設定します。<br>例：<br><code>http://your-server.com/pingscript?id=$id</code><br><code>http://your-server.com/pingscript?id=$id&amp;tag=$tag</code><br><strong>注意：</strong><code>pingback_url</code> 内の特殊文字は URL エンコードされます；<br>たとえば、<code>#</code> 文字は <code>%23</code> にエンコードされます。詳細は<a href=\"https://dataforseo.com/help-center/pingbacks-postbacks-with-dataforseo-api\" target=\"_blank\" rel=\"noopener noreferrer\">ヘルプセンター</a>をご覧ください"
          }
        },
        "example": [
          {
            "url": "https://dataforseo.com",
            "for_mobile": true,
            "tag": "some_string_123",
            "pingback_url": "https://your-server.com/pingscript?id=$id&tag=$tag"
          }
        ]
      }
    ]
  },
  "example": [
    {
      "url": "https://dataforseo.com",
      "for_mobile": true,
      "tag": "some_string_123",
      "pingback_url": "https://your-server.com/pingscript?id=$id&tag=$tag"
    }
  ]
}
```

## Responses

### 200 — 操作成功

Headers:
- `X-Request-Id` (string) — Felo サポートに問い合わせる際に伝えるリクエスト識別子。

**application/json**

Schema: object | null

```json
{
  "type": [
    "object",
    "null"
  ],
  "oneOf": [
    {
      "$ref": "#/components/schemas/Response36Afe1097B20_OnPageLighthouseTaskPostResponseInfo"
    }
  ]
}
```

### 400 — リクエストを処理できませんでした。リクエストパラメータを確認してください。

### 401 — 有効な Felo API キーが必要です。

### 402 — 請求要件が満たされていないため、リクエストを続行できません。

### 403 — このアカウントにはこの操作を行う権限がありません。

### 429 — リクエストまたは支出の上限に達しました。

### 502 — サービスがリクエストを完了できませんでした。

### 503 — API または請求サービスが一時的に利用できません。

### 504 — リクエストの処理中にサービスがタイムアウトしました。

### default — エラーレスポンス。上流のパススルーレスポンスはプロバイダーの形式を使用する場合があります

**application/json**

Schema:

```json
{}
```

## Schema definitions

### Response36Afe1097B20_BaseResponseInfo

`#/components/schemas/Response36Afe1097B20_BaseResponseInfo`

```json
{
  "properties": {
    "version": {
      "type": [
        "string",
        "null"
      ],
      "description": "API の現在のバージョン"
    },
    "status_code": {
      "type": [
        "integer",
        "null"
      ],
      "description": "一般的なステータスコード\nレスポンスコードの完全な一覧はこちらです"
    },
    "status_message": {
      "type": [
        "string",
        "null"
      ],
      "description": "一般的な情報メッセージ\n一般的な情報メッセージの完全な一覧はこちらです"
    },
    "time": {
      "type": [
        "string",
        "null"
      ],
      "description": "合計実行時間（秒）"
    },
    "cost": {
      "type": [
        "number",
        "null"
      ],
      "description": "タスクの総コスト（USD）",
      "format": "double"
    },
    "tasks_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "tasks 配列内のタスク数",
      "format": "int64"
    },
    "tasks_error": {
      "type": [
        "integer",
        "null"
      ],
      "description": "エラーで返された tasks 配列内のタスク数",
      "format": "int64"
    }
  }
}
```

### Response36Afe1097B20_BaseResponseTaskInfo

`#/components/schemas/Response36Afe1097B20_BaseResponseTaskInfo`

```json
{
  "properties": {
    "id": {
      "type": [
        "string",
        "null"
      ],
      "description": "タスク識別子\n当社システム内で UUID 形式の一意のタスク識別子"
    },
    "status_code": {
      "type": [
        "integer",
        "null"
      ],
      "description": "タスクのステータスコード\nDataForSEO によって生成され、次の範囲の値になります: 10000-60000\nレスポンスコードの完全な一覧はこちらです"
    },
    "status_message": {
      "type": [
        "string",
        "null"
      ],
      "description": "タスクの情報メッセージ\n一般的な情報メッセージの完全な一覧はこちらです"
    },
    "time": {
      "type": [
        "string",
        "null"
      ],
      "description": "実行時間（秒）"
    },
    "cost": {
      "type": [
        "number",
        "null"
      ],
      "description": "タスクの総コスト（USD）",
      "format": "double"
    },
    "result_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "result 配列内の要素数",
      "format": "int64"
    },
    "path": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "string",
          "null"
        ]
      },
      "description": "URL パス"
    },
    "data": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": [
          "object",
          "null"
        ]
      },
      "description": "POST リクエストで指定したものと同じパラメーターを含みます"
    }
  }
}
```

### Response36Afe1097B20_OnPageLighthouseTaskPostResponseInfo

`#/components/schemas/Response36Afe1097B20_OnPageLighthouseTaskPostResponseInfo`

```json
{
  "type": "object",
  "allOf": [
    {
      "$ref": "#/components/schemas/Response36Afe1097B20_BaseResponseInfo"
    },
    {
      "type": "object",
      "properties": {
        "tasks": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": [
              "object",
              "null"
            ],
            "oneOf": [
              {
                "$ref": "#/components/schemas/Response36Afe1097B20_OnPageLighthouseTaskPostTaskInfo"
              }
            ]
          },
          "description": "<em>タスクの配列</em>"
        }
      }
    }
  ]
}
```

### Response36Afe1097B20_OnPageLighthouseTaskPostTaskInfo

`#/components/schemas/Response36Afe1097B20_OnPageLighthouseTaskPostTaskInfo`

```json
{
  "type": "object",
  "allOf": [
    {
      "$ref": "#/components/schemas/Response36Afe1097B20_BaseResponseTaskInfo"
    },
    {
      "type": "object",
      "properties": {
        "result": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": [
                "object",
                "null"
              ]
            }
          }
        }
      }
    }
  ]
}
```
