# Waterfall ใน OnPage API

**API:** Data API

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

**Tags:** DataForSEO

ไทม์ไลน์การโหลดของ `url` ที่ crawl แล้วหนึ่งหน้า — อะไรถูกขอ ตามลำดับใด และแต่ละรายการใช้เวลานานเท่าไร อ่านการ crawl ที่เสร็จแล้ว จึงต้องใช้ `id` จาก `post_dataforseo_on_page_submit` และคืนค่า `crawl_progress` พร้อม `crawl_status` ซึ่งเป็น `max_crawl_pages`, `pages_in_queue` และ `pages_crawled` — ตรวจสอบค่าเหล่านี้ก่อนเชื่อผลลัพธ์ที่มีขนาดเล็ก เพราะการ crawl ที่ยังทำงานอยู่ย่อมมีข้อมูลให้รายงานน้อยกว่า ใช้เพื่ออธิบายว่าหน้านี้ช้าทำไม หากต้องการ audit ประสิทธิภาพแบบให้คะแนน ให้ใช้ `post_dataforseo_on_page_lighthouse_live_json` 💰 ต้นทางฟรี: การ query crawl ที่เสร็จแล้วไม่มีค่าใช้จ่าย มีแต่ตัว crawl เองเท่านั้นที่มีค่าใช้จ่าย

### ข้อมูลอ้างอิงราคา

- การวัดปริมาณการใช้งาน: ต้นทุนการตอบกลับที่รายงาน
- ค่าประมาณคำขออ้างอิง: USD 0.012
- ตัวคูณอ้างอิงสำหรับลูกค้า: 1.0 ห้ามนำไปใช้ซ้ำกับยอดที่เรียกเก็บจากลูกค้าแล้ว

เป็นข้อมูลเมตาอ้างอิงเท่านั้น ไม่ใช่ใบเสนอราคาสำหรับบัญชี ไม่ใช่ราคาที่รับประกัน และไม่ใช่เพดานการใช้จ่าย เครดิตของทรัพยากรไม่ใช่เครดิต Felo ยอดเรียกเก็บขั้นสุดท้ายเป็นไปตามบันทึกการเรียกเก็บเงินของ Felo

## Related links

- [Task POST](<https://docs.dataforseo.com/v3/on_page/task_post/>)
- [Time To Interactive (TTI)](<https://web.dev/interactive/>)
- [(TTFB)](<https://en.wikipedia.org/wiki/Time_to_first_byte>)

## 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": {
          "id": {
            "type": "string",
            "description": "<em>ID ของงาน</em><br><strong>ฟิลด์ที่จำเป็น</strong><br>คุณสามารถรับ ID นี้ได้จากการตอบกลับของ endpoint Task POST<br>ตัวอย่าง:<br>\"07131248-1535-0216-1000-17384017ad04\""
          },
          "url": {
            "type": "string",
            "description": "<em>URL ของหน้าเว็บ</em><br><strong>ฟิลด์ที่จำเป็น</strong><br>ระบุหน้าเว็บที่คุณต้องการรับข้อมูลเวลาของหน้าเหล่านั้น"
          },
          "tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>ตัวระบุงานที่ผู้ใช้กำหนด</em><br>ฟิลด์ไม่บังคับ<br><em>จำกัด 255 อักขระ</em><br>ใช้พารามิเตอร์นี้เพื่อระบุงานและจับคู่กับผลลัพธ์<br>คุณจะพบค่า <code>tag</code> ที่ระบุในออบเจ็กต์ <code>data</code> ของการตอบกลับ"
          }
        },
        "example": [
          {
            "id": "08101204-0696-0216-0000-644a7b21a48a",
            "url": "https://dataforseo.com/tag/broken-links"
          }
        ]
      }
    ]
  },
  "example": [
    {
      "id": "08101204-0696-0216-0000-644a7b21a48a",
      "url": "https://dataforseo.com/tag/broken-links"
    }
  ]
}
```

## Responses

### 200 — ดำเนินการสำเร็จ

Headers:
- `X-Request-Id` (string) — ตัวระบุคำขอที่ต้องระบุเมื่อติดต่อฝ่ายสนับสนุนของ Felo

**application/json**

Schema: object | null

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

### 400 — ไม่สามารถประมวลผลคำขอได้ ตรวจสอบพารามิเตอร์ของคำขอ

### 401 — จำเป็นต้องใช้คีย์ API ของ Felo ที่ถูกต้อง

### 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": "รหัสสถานะของงาน\nสร้างโดย DataForSEO โดยอยู่ในช่วงต่อไปนี้ได้: 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_CrawlStatusInfo

`#/components/schemas/Response36Afe1097B20_CrawlStatusInfo`

```json
{
  "type": "object",
  "properties": {
    "max_crawl_pages": {
      "type": [
        "integer",
        "null"
      ],
      "description": "จำนวนหน้าสูงสุดที่ต้องรวบรวม\n ระบุขีดจำกัด max_crawl_pages ที่คุณกำหนดเมื่อตั้งงาน",
      "format": "int64"
    },
    "pages_in_queue": {
      "type": [
        "integer",
        "null"
      ],
      "description": "จำนวนหน้าที่อยู่ในคิวการรวบรวมในขณะนี้",
      "format": "int64"
    },
    "pages_crawled": {
      "type": [
        "integer",
        "null"
      ],
      "description": "จำนวนหน้าที่รวบรวมแล้ว",
      "format": "int64"
    }
  }
}
```

### Response36Afe1097B20_OnPageResourceLocationInfo

`#/components/schemas/Response36Afe1097B20_OnPageResourceLocationInfo`

```json
{
  "type": "object",
  "properties": {
    "line": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>หมายเลขบรรทัด</em><br>หมายเลขของบรรทัดที่ทรัพยากรตั้งอยู่"
    },
    "offset_left": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>ตำแหน่งในบรรทัด</em><br>จำนวนอักขระในบรรทัดก่อนหน้าทรัพยากร;<br>บางครั้งเรียกว่า <em>คอลัมน์</em><br><strong>หมายเหตุ:</strong> เริ่มนับจาก 1 กล่าวคือ หากทรัพยากรไม่มีอักขระใดๆ อยู่ทางซ้าย ค่าจะเป็น 1"
    },
    "offset_top": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>ตำแหน่งในเอกสาร</em><br>จำนวนอักขระทั้งหมดระหว่างทรัพยากรกับส่วนบนสุดของ HTML"
    }
  }
}
```

### Response36Afe1097B20_OnPageWaterfallItem

`#/components/schemas/Response36Afe1097B20_OnPageWaterfallItem`

```json
{
  "type": "object",
  "properties": {
    "page_url": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>URL ของหน้าเว็บ</em>"
    },
    "time_to_interactive": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>เมตริก Time To Interactive (TTI)</em><br>เวลาที่ใช้จนกว่าผู้ใช้จะโต้ตอบกับหน้าเว็บได้ (เป็นมิลลิวินาที)"
    },
    "dom_complete": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>เวลาในการโหลดทรัพยากร</em><br>เวลาที่ใช้จนกว่าหน้าเว็บและทรัพยากรย่อยทั้งหมดจะถูกดาวน์โหลด (เป็นมิลลิวินาที)"
    },
    "connection_time": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>เวลาที่ใช้เชื่อมต่อกับเซิร์ฟเวอร์</em><br>เวลาที่ใช้จนกว่าการเชื่อมต่อกับเซิร์ฟเวอร์จะถูกสร้างขึ้น (เป็นมิลลิวินาที)"
    },
    "time_to_secure_connection": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>เวลาในการสร้างการเชื่อมต่อที่ปลอดภัย</em><br>เวลาที่ใช้จนกว่าการเชื่อมต่อที่ปลอดภัยกับเซิร์ฟเวอร์จะถูกสร้างขึ้น (เป็นมิลลิวินาที)"
    },
    "request_sent_time": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>เวลาในการส่งคำขอไปยังเซิร์ฟเวอร์</em><br>เวลาที่ใช้จนกว่าคำขอไปยังเซิร์ฟเวอร์จะถูกส่ง (เป็นมิลลิวินาที)"
    },
    "waiting_time": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>เวลาถึงไบต์แรก (TTFB) เป็นมิลลิวินาที</em>"
    },
    "download_time": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>เวลาที่เบราว์เซอร์ใช้ในการรับการตอบกลับ (เป็นมิลลิวินาที)</em>"
    },
    "duration_time": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>เวลารวมที่ใช้จนกว่าเบราว์เซอร์จะได้รับการตอบกลับที่สมบูรณ์จากเซิร์ฟเวอร์ (เป็นมิลลิวินาที)</em>"
    },
    "fetch_start": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>เวลาในการเริ่มดาวน์โหลดทรัพยากร HTML</em><br>ระยะเวลาที่เบราว์เซอร์ต้องใช้ในการเริ่มดาวน์โหลดหน้าเว็บ"
    },
    "fetch_end": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>เวลาในการดาวน์โหลดทรัพยากร HTML จนเสร็จ</em><br>ระยะเวลาที่เบราว์เซอร์ต้องใช้ในการดาวน์โหลดหน้าเว็บจนเสร็จ"
    },
    "resources": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "object",
          "null"
        ],
        "oneOf": [
          {
            "$ref": "#/components/schemas/Response36Afe1097B20_WaterfallResourceInfo"
          }
        ]
      },
      "description": "<em>เวลาที่เฉพาะเจาะจงต่อทรัพยากร</em><br>มีอาร์เรย์แยกที่มีเวลาสำหรับแต่ละทรัพยากรที่พบบนหน้าเว็บ"
    }
  }
}
```

### Response36Afe1097B20_OnPageWaterfallResponseInfo

`#/components/schemas/Response36Afe1097B20_OnPageWaterfallResponseInfo`

```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_OnPageWaterfallTaskInfo"
              }
            ]
          },
          "description": "<em>อาร์เรย์ของงาน</em>"
        }
      }
    }
  ]
}
```

### Response36Afe1097B20_OnPageWaterfallResultInfo

`#/components/schemas/Response36Afe1097B20_OnPageWaterfallResultInfo`

```json
{
  "type": "object",
  "properties": {
    "crawl_progress": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>สถานะของเซสชันการ crawl</em><br>ค่าที่เป็นไปได้: <code>in_progress</code>, <code>finished</code>"
    },
    "crawl_status": {
      "type": [
        "object",
        "null"
      ],
      "oneOf": [
        {
          "$ref": "#/components/schemas/Response36Afe1097B20_CrawlStatusInfo"
        }
      ],
      "description": "<em>รายละเอียดของเซสชันการ crawl</em>"
    },
    "items_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>จำนวนรายการในอาร์เรย์ผลลัพธ์</em>",
      "format": "int64"
    },
    "items": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "object",
          "null"
        ],
        "oneOf": [
          {
            "$ref": "#/components/schemas/Response36Afe1097B20_OnPageWaterfallItem"
          }
        ]
      },
      "description": "<em>อาร์เรย์ items</em>"
    }
  }
}
```

### Response36Afe1097B20_OnPageWaterfallTaskInfo

`#/components/schemas/Response36Afe1097B20_OnPageWaterfallTaskInfo`

```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_OnPageWaterfallResultInfo"
              }
            ]
          },
          "description": "<em>อาร์เรย์ของผลลัพธ์</em>"
        }
      }
    }
  ]
}
```

### Response36Afe1097B20_WaterfallResourceInfo

`#/components/schemas/Response36Afe1097B20_WaterfallResourceInfo`

```json
{
  "type": "object",
  "properties": {
    "resource_type": {
      "type": [
        "string",
        "null"
      ]
    },
    "url": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>URL ของรีซอร์ส</em>"
    },
    "initiator": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>ตัวเริ่มต้นรีซอร์ส</em>"
    },
    "duration_time": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>เวลารวมที่ใช้จนกว่าเบราว์เซอร์จะได้รับการตอบกลับที่สมบูรณ์จากเซิร์ฟเวอร์ (เป็นมิลลิวินาที)</em>"
    },
    "fetch_start": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>เวลาในการเริ่มดาวน์โหลดทรัพยากร HTML</em><br>ระยะเวลาที่เบราว์เซอร์ต้องใช้ในการเริ่มดาวน์โหลดหน้าเว็บ"
    },
    "fetch_end": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>เวลาในการดาวน์โหลดทรัพยากร HTML จนเสร็จ</em><br>ระยะเวลาที่เบราว์เซอร์ต้องใช้ในการดาวน์โหลดหน้าเว็บจนเสร็จ"
    },
    "location": {
      "type": [
        "object",
        "null"
      ],
      "oneOf": [
        {
          "$ref": "#/components/schemas/Response36Afe1097B20_OnPageResourceLocationInfo"
        }
      ],
      "description": "<em>ตำแหน่งของรีซอร์สในเอกสาร</em><br>พารามิเตอร์ที่กำหนดตำแหน่งของรีซอร์สที่ระบุภายใน HTML ของเอกสาร"
    },
    "is_render_blocking": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "<em>ระบุว่ารีซอร์สบล็อกการเรนเดอร์หรือไม่</em>"
    }
  }
}
```
