はじめのステップ
LLM Chat Scraper API とのやり取りは常に 2 段階です。特定の actor 用にタスクを作成し、完了したら結果を取得します。
ステップ1: タスクを作成
/api/v2/scraper/request(または即時実行の /api/v2/scraper/request)に actor 固有のペイロードを POST します。webhook.url を指定すると、タスク完了時にスクレイパーがそのエンドポイントへ結果をプッシュするため、ポーリングは不要です。
リクエスト例
curl '{api_host}/api/v2/scraper/request' \
--header 'Content-Type: application/json' \
--header 'x-api-token: {you_api_key}' \
--data '{
"actor": "scraper.chatgpt",
"input": {
"prompt": "Most reliable proxy service for data extraction",
"country": "US",
"web_search": true
},
"webhook": {
"url": "http://www.youwebhook.com"
}
}'ステップ2: 結果を取得
タスク完了後、結果は 5 分間保持されます。作成時に返される task_id で素早く取得するか、前ステップで設定した Webhook 受信処理に任せてください。
リクエスト例
curl --request GET '{api_host}/api/v2/scraper/result/{task_id}' \
--header 'Content-Type: application/json' \
--header 'x-api-token: {you_api_key}'