# OnPage API 頁面截圖

**API:** Data API

**Endpoint:** `POST /v1/beta/dataforseo/on_page/page_screenshot`

**Tags:** DataForSEO

渲染任意 `url` 並傳回截圖，`full_page_screenshot` 控制是否擷取整個捲動高度，`browser_screen_width` 和 `browser_screen_height` 設定檢視區。獨立運作——無需爬取。採用 DataForSEO 的信封結構：資料位於 `tasks[0].result`，結果狀態位於 `tasks[0].status_code`——被拒絕的請求仍會回傳 HTTP 200。⚠️ 即使代理程式還無法對影像做任何處理，影像本身也是龐大的工具結果；只有當視覺呈現才是重點時才請求截圖，如果重點是文字，請使用 `post_dataforseo_on_page_content_parsing_live`。

### 計費參考

- 計量方式：依回報的回應成本計量。
- 參考請求估算：0.0051 美元。
- 參考客戶倍率：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<br><strong>注意：</strong>如果你在此處指定的 URL 傳回 404 狀態碼，或指定的值不是有效 URL，回應陣列中將取得 <code>\"error_message\":\"Screenshot is empty\"</code>"
          },
          "accept_language": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>存取網站的語言標頭</em><br>選填欄位<br>支援所有語言地區格式（xx、xx-XX、xxx-XX 等）<br><strong>注意：</strong>如果你未指定此參數，某些網站可能會拒絕存取；此時，回應陣列中將取得 <code>\"error_message\":\"Screenshot is empty\"</code>"
          },
          "custom_user_agent": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>自訂使用者代理</em><br>選填欄位<br>用於擷取網站的自訂使用者代理<br>範例： <code>Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36<br></code><br>預設值：<code>Mozilla/5.0 (compatible; RSiteAuditor)</code>"
          },
          "browser_preset": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>瀏覽器螢幕參數預設集</em><br>選填欄位<br>如果使用此欄位，則無需指定 <code>browser_screen_width</code>、<code>browser_screen_height</code>、<code>browser_screen_scale_factor</code><p>可能的值：<br><code>desktop</code>、<code>mobile</code>、<code>tablet</code><p><code>desktop</code> 預設集將套用下列值：<p><code>browser_screen_width: 1920</code><br><code>browser_screen_height: 1080</code><br><code>browser_screen_scale_factor: 1</code><p><code>mobile</code> 預設集將套用下列值：<p><code>browser_screen_width: 390</code><br><code>browser_screen_height: 844</code><br><code>browser_screen_scale_factor: 3</code><p><code>tablet</code> 預設集將套用下列值：<p><code>browser_screen_width: 1024</code><br><code>browser_screen_height: 1366</code><br><code>browser_screen_scale_factor: 2</code><p><strong>注意：</strong>在此端點中，<code>enable_browser_rendering</code>、<code>enable_javascript</code>、<code>load_resources</code> 與 <code>enable_xhr</code> 參數一律啟用。"
          },
          "browser_screen_width": {
            "type": [
              "integer",
              "null"
            ],
            "description": "<em>瀏覽器螢幕寬度</em><br>選填欄位<br>你可以設定自訂的瀏覽器螢幕寬度，以便針對特定裝置進行稽核；<br>如果使用此欄位，則無需指定 <code>browser_preset</code>，它將被忽略；<p>            最小值（像素）：<code>240</code> <br>最大值（像素）：<code>9999</code>",
            "format": "int64"
          },
          "browser_screen_height": {
            "type": [
              "integer",
              "null"
            ],
            "description": "<em>瀏覽器螢幕高度</em><br>選填欄位<br>你可以設定自訂的瀏覽器螢幕高度，以便針對特定裝置進行稽核；<br>如果使用此欄位，則無需指定 <code>browser_preset</code>，它將被忽略；<p>            最小值（像素）：<code>240</code> <br>最大值（像素）：<code>9999</code>"
          },
          "browser_screen_scale_factor": {
            "type": [
              "number",
              "null"
            ],
            "description": "<em>瀏覽器螢幕縮放比例</em><br>選填欄位<br>你可以設定自訂的瀏覽器螢幕解析度比例，以便針對特定裝置進行稽核；<br>如果使用此欄位，則無需指定 <code>browser_preset</code>，它將被忽略；<p>            最小值：<code>0.5</code> <br>最大值：<code>3</code>"
          },
          "full_page_screenshot": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "<em>擷取整頁螢幕截圖</em><br>選填欄位<br>如果只想擷取捲動前顯示的頁面部分，請設為 <code>false</code><br>預設值：<code>true</code>"
          },
          "disable_cookie_popup": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "<em>停用 Cookie 彈出視窗 </em><br>選填欄位<br>如果要停用向使用者要求 Cookie 同意的彈出視窗，請設為 <code>true</code>；<br>預設值：<br><code>false</code>"
          },
          "switch_pool": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "<em>切換代理伺服器集區</em><br>選填欄位<br>如果為 <code>true</code>，將使用其他代理伺服器集區取得所要求的資料；<br>如果同時設定大量任務，導致偶爾出現 <code>rate-limit</code> 和/或 <code>site_unreachable</code> 錯誤，可以使用此參數"
          },
          "ip_pool_for_scan": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>代理伺服器集區</em><br>選填欄位<br>你可以選擇用於取得所要求資料的代理伺服器集區位置；<br>如果頁面內容在某個位置無法存取，導致偶爾出現 <code>site_unreachable</code> 錯誤，可以使用此參數<br>可能的值：<code>us</code>、<code>de</code>"
          }
        },
        "example": [
          {
            "url": "https://dataforseo.com/apis"
          }
        ]
      }
    ]
  },
  "example": [
    {
      "url": "https://dataforseo.com/apis"
    }
  ]
}
```

## Responses

### 200 — 操作成功

Headers:
- `X-Request-Id` (string) — 聯絡 Felo 支援時需提供的請求識別碼。

**application/json**

Schema: object | null

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

### 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": "任務總費用，美元",
      "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": "任務的狀態碼\n由 DataForSEO 產生，範圍如下：10000-60000\n完整回應碼清單請見此處"
    },
    "status_message": {
      "type": [
        "string",
        "null"
      ],
      "description": "任務的資訊訊息\n完整的一般資訊訊息清單請見此處"
    },
    "time": {
      "type": [
        "string",
        "null"
      ],
      "description": "執行時間，秒"
    },
    "cost": {
      "type": [
        "number",
        "null"
      ],
      "description": "任務總費用，美元",
      "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_OnPagePageScreenshotResponseInfo

`#/components/schemas/Response36Afe1097B20_OnPagePageScreenshotResponseInfo`

```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_OnPagePageScreenshotTaskInfo"
              }
            ]
          },
          "description": "<em>任務陣列</em>"
        }
      }
    }
  ]
}
```

### Response36Afe1097B20_OnPagePageScreenshotResultInfo

`#/components/schemas/Response36Afe1097B20_OnPagePageScreenshotResultInfo`

```json
{
  "type": "object",
  "properties": {
    "crawl_progress": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>擷取工作階段的狀態</em><br>可能的值：<code>in_progress</code>、<code>finished</code>"
    },
    "error_message": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>錯誤訊息</em><br>若指定的 <code>url</code> 傳回 404 狀態碼或不是有效 URL，您會取得 <code>\"error_message\":\"Screenshot is empty\"</code><br>若未發生錯誤，該值會是 <code>null</code>"
    },
    "items_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>結果陣列中的項目數</em>",
      "format": "int64"
    },
    "items": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "object",
          "null"
        ],
        "oneOf": [
          {
            "$ref": "#/components/schemas/Response36Afe1097B20_ScreenshotItem"
          }
        ]
      },
      "description": "<em>項目陣列</em>"
    }
  }
}
```

### Response36Afe1097B20_OnPagePageScreenshotTaskInfo

`#/components/schemas/Response36Afe1097B20_OnPagePageScreenshotTaskInfo`

```json
{
  "type": "object",
  "allOf": [
    {
      "$ref": "#/components/schemas/Response36Afe1097B20_BaseResponseTaskInfo"
    },
    {
      "type": "object",
      "properties": {
        "result": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": [
              "object",
              "null"
            ],
            "oneOf": [
              {
                "$ref": "#/components/schemas/Response36Afe1097B20_OnPagePageScreenshotResultInfo"
              }
            ]
          },
          "description": "<em>結果陣列</em>"
        }
      }
    }
  ]
}
```

### Response36Afe1097B20_ScreenshotItem

`#/components/schemas/Response36Afe1097B20_ScreenshotItem`

```json
{
  "type": "object",
  "properties": {
    "image": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>所請求頁面的截圖</em><br>頁面截圖在 DataForSEO 儲存空間中的 URL<br><strong>注意：儲存在 DataForSEO 儲存空間中的頁面截圖僅在提出請求後一天內可存取</strong>"
    }
  }
}
```
