メインコンテンツへスキップ
POST
/
scrape
/
{jobId}
/
interact
スクレイピングジョブに関連付けられたブラウザセッションを操作します
curl --request POST \
  --url https://api.firecrawl.dev/v2/scrape/{jobId}/interact \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "code": "<string>",
  "language": "node",
  "timeout": 30,
  "origin": "<string>"
}
'
{
  "success": true,
  "stdout": "<string>",
  "result": "<string>",
  "stderr": "<string>",
  "exitCode": 123,
  "killed": true,
  "error": "<string>"
}
このエンドポイントを使用すると、以前のスクレイプから初期化されたのと同じブラウザ状態で、引き続き操作できます。code または prompt のいずれか一方を指定する必要があります。両方は指定できません。 POST /v2/scrape/{jobId}/interact はライフサイクル全体を処理します。
  1. このスクレイプジョブ用のブラウザセッションがまだ存在しない場合、Firecrawl は元のスクレイプと同じページ状態でブラウザセッションを作成します。
  2. code が指定されている場合、Firecrawl はそれをブラウザサンドボックスで実行します。prompt が指定されている場合は、AI エージェントが自然言語を使ってタスクを自動化します。
  3. 同じ jobId に対する後続の POST /interact 呼び出しでは、同じライブのブラウザ状態が再利用されます。
完了したら、DELETE /v2/scrape/{jobId}/interact を呼び出してセッションを停止します。

パスパラメータ

パラメータ必須説明
jobIdstring (UUID)はいスクレイピングのレスポンス内の data.metadata.scrapeId に含まれるスクレイピングジョブ ID

リクエストボディ

パラメータ必須デフォルト説明
codestringいいえブラウザサンドボックスで実行するコード (1~100,000文字) 。promptが設定されていない場合は必須です。
promptstringいいえAIエージェント向けの自然言語タスク (1~10,000文字) 。codeが設定されていない場合は必須です。
languagestringいいえ"node""python""node""bash" のいずれか。codeを使用する場合にのみ使われます。
timeoutnumberいいえ30実行タイムアウト (秒) (1~300) 。
originstringいいえテレメトリに使用される任意のオリジンラベル。

レスポンス

フィールド説明
successboolean実行がエラーなく完了したかどうか
liveViewUrlstringブラウザセッション用の読み取り専用ライブビューURL
interactiveLiveViewUrlstringインタラクティブ ライブビューURL (閲覧者がブラウザを操作可能)
outputstringAIエージェントの最終レスポンス (prompt を使用した場合のみ存在)
stdoutstringコード実行の標準出力
resultstring戻り値 — Node.js では最後の式の値、prompt では最終ページのスナップショット
stderrstring標準エラー出力
exitCodenumber実行の終了コード (0 = 成功)
killedbooleanタイムアウトにより実行が終了したかどうか
errorstringエラーメッセージ (失敗時のみ存在)

リクエスト例 (コード)

curl -X POST "https://api.firecrawl.dev/v2/scrape/550e8400-e29b-41d4-a716-446655440000/interact" \
  -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "const title = await page.title(); JSON.stringify({ title });",
    "language": "node",
    "timeout": 30
  }'

レスポンス例 (コード)

{
  "success": true,
  "liveViewUrl": "https://liveview.firecrawl.dev/...",
  "interactiveLiveViewUrl": "https://liveview.firecrawl.dev/...",
  "stdout": "",
  "result": "{\"title\":\"Example Domain\"}",
  "stderr": "",
  "exitCode": 0,
  "killed": false
}

リクエスト例 (Prompt)

curl -X POST "https://api.firecrawl.dev/v2/scrape/550e8400-e29b-41d4-a716-446655440000/interact" \
  -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Find the pricing section and tell me the price of the Pro plan",
    "timeout": 60
  }'

レスポンス例 (Prompt)

{
  "success": true,
  "liveViewUrl": "https://liveview.firecrawl.dev/...",
  "interactiveLiveViewUrl": "https://liveview.firecrawl.dev/...",
  "output": "The Pro plan costs $49/month and includes unlimited scrapes, priority support, and custom integrations.",
  "stdout": "...",
  "result": "...",
  "stderr": "",
  "exitCode": 0,
  "killed": false
}

エラーコード

ステータス説明
402ブラウザセッションのクレジットが不足しています
403スクレイピングジョブは別のチームに属しています
404スクレイピングジョブが見つかりません
409リプレイコンテキストを利用できません — スクレイピングを再実行してもう一度お試しください
410ブラウザセッションはすでに破棄されています
429同時ブラウザセッション数の上限に達しました
502ブラウザサービスまたはAIエージェントの実行に失敗しました
503ブラウザ機能が設定されていません (セルフホスト環境のみ)
詳細な使用方法と例については、Interact機能ガイドを参照してください。

承認

Authorization
string
header
必須

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

パスパラメータ

jobId
string<uuid>
必須

スクレイピングジョブの job ID

ボディ

application/json
code
string
必須

スクレイピングに紐付けられたブラウザサンドボックスで実行するコード

Required string length: 1 - 100000
language
enum<string>
デフォルト:node

実行するコードの言語。JavaScript には node、agent-browser の CLI コマンドには bash を使用します。

利用可能なオプション:
python,
node,
bash
timeout
integer
デフォルト:30

実行タイムアウト(秒)

必須範囲: 1 <= x <= 300
origin
string

実行テレメトリーで使用する任意のオリジンラベル

レスポンス

コードは正常に実行されました

success
boolean
stdout
string | null

コード実行時の標準出力

result
string | null

標準出力(stdout の別名)

stderr
string | null

コード実行時の標準エラー出力

exitCode
integer | null

実行されたプロセスの終了コード

killed
boolean

タイムアウトによりプロセスが強制終了されたかどうか

error
string | null

コードで例外が発生した場合のエラーメッセージ