スクレイピングジョブに関連付けられたブラウザセッションを操作します
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>"
}
'import requests
url = "https://api.firecrawl.dev/v2/scrape/{jobId}/interact"
payload = {
"code": "<string>",
"language": "node",
"timeout": 30,
"origin": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({code: '<string>', language: 'node', timeout: 30, origin: '<string>'})
};
fetch('https://api.firecrawl.dev/v2/scrape/{jobId}/interact', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.firecrawl.dev/v2/scrape/{jobId}/interact",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'code' => '<string>',
'language' => 'node',
'timeout' => 30,
'origin' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.firecrawl.dev/v2/scrape/{jobId}/interact"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"language\": \"node\",\n \"timeout\": 30,\n \"origin\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.firecrawl.dev/v2/scrape/{jobId}/interact")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\",\n \"language\": \"node\",\n \"timeout\": 30,\n \"origin\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firecrawl.dev/v2/scrape/{jobId}/interact")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"<string>\",\n \"language\": \"node\",\n \"timeout\": 30,\n \"origin\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"stdout": "<string>",
"result": "<string>",
"stderr": "<string>",
"exitCode": 123,
"killed": true,
"error": "<string>"
}{
"success": false,
"error": "Invalid job ID format."
}{
"success": false,
"error": "Payment required to access this resource."
}{
"success": false,
"error": "Forbidden."
}{
"success": false,
"error": "Job not found."
}{
"success": false,
"error": "Replay context is unavailable for this scrape job. Please rerun the scrape."
}{
"success": false,
"error": "Browser session has been destroyed."
}{
"success": false,
"error": "You have reached the maximum number of active browser sessions."
}{
"success": false,
"error": "Failed to execute code in browser session."
}Interact のエンドポイント
ページを操作する
スクレイプジョブに紐付けられたブラウザセッションで、コードまたは AI プロンプトを実行します。
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>"
}
'import requests
url = "https://api.firecrawl.dev/v2/scrape/{jobId}/interact"
payload = {
"code": "<string>",
"language": "node",
"timeout": 30,
"origin": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({code: '<string>', language: 'node', timeout: 30, origin: '<string>'})
};
fetch('https://api.firecrawl.dev/v2/scrape/{jobId}/interact', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.firecrawl.dev/v2/scrape/{jobId}/interact",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'code' => '<string>',
'language' => 'node',
'timeout' => 30,
'origin' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.firecrawl.dev/v2/scrape/{jobId}/interact"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"language\": \"node\",\n \"timeout\": 30,\n \"origin\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.firecrawl.dev/v2/scrape/{jobId}/interact")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\",\n \"language\": \"node\",\n \"timeout\": 30,\n \"origin\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firecrawl.dev/v2/scrape/{jobId}/interact")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"<string>\",\n \"language\": \"node\",\n \"timeout\": 30,\n \"origin\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"stdout": "<string>",
"result": "<string>",
"stderr": "<string>",
"exitCode": 123,
"killed": true,
"error": "<string>"
}{
"success": false,
"error": "Invalid job ID format."
}{
"success": false,
"error": "Payment required to access this resource."
}{
"success": false,
"error": "Forbidden."
}{
"success": false,
"error": "Job not found."
}{
"success": false,
"error": "Replay context is unavailable for this scrape job. Please rerun the scrape."
}{
"success": false,
"error": "Browser session has been destroyed."
}{
"success": false,
"error": "You have reached the maximum number of active browser sessions."
}{
"success": false,
"error": "Failed to execute code in browser session."
}このエンドポイントを使用すると、以前のスクレイプから初期化されたのと同じブラウザ状態で、引き続き操作できます。
詳細な使用方法と例については、Interact機能ガイドを参照してください。
code または prompt のいずれか一方を指定する必要があります。両方は指定できません。
POST /v2/scrape/{jobId}/interact はライフサイクル全体を処理します。
- このスクレイプジョブ用のブラウザセッションがまだ存在しない場合、Firecrawl は元のスクレイプと同じページ状態でブラウザセッションを作成します。
codeが指定されている場合、Firecrawl はそれをブラウザサンドボックスで実行します。promptが指定されている場合は、AI エージェントが自然言語を使ってタスクを自動化します。- 同じ
jobIdに対する後続のPOST /interact呼び出しでは、同じライブのブラウザ状態が再利用されます。
DELETE /v2/scrape/{jobId}/interact を呼び出してセッションを停止します。
パスパラメータ
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
jobId | string (UUID) | はい | スクレイピングのレスポンス内の data.metadata.scrapeId に含まれるスクレイピングジョブ ID |
リクエストボディ
| パラメータ | 型 | 必須 | デフォルト | 説明 |
|---|---|---|---|---|
code | string | いいえ | — | ブラウザサンドボックスで実行するコード (1~100,000文字) 。promptが設定されていない場合は必須です。 |
prompt | string | いいえ | — | AIエージェント向けの自然言語タスク (1~10,000文字) 。codeが設定されていない場合は必須です。 |
language | string | いいえ | "node" | "python"、"node"、"bash" のいずれか。codeを使用する場合にのみ使われます。 |
timeout | number | いいえ | 30 | 実行タイムアウト (秒) (1~300) 。 |
origin | string | いいえ | — | テレメトリに使用される任意のオリジンラベル。 |
レスポンス
| フィールド | 型 | 説明 |
|---|---|---|
success | boolean | 実行がエラーなく完了したかどうか |
liveViewUrl | string | ブラウザセッション用の読み取り専用ライブビューURL |
interactiveLiveViewUrl | string | インタラクティブ ライブビューURL (閲覧者がブラウザを操作可能) |
output | string | AIエージェントの最終レスポンス (prompt を使用した場合のみ存在) |
stdout | string | コード実行の標準出力 |
result | string | 戻り値 — Node.js では最後の式の値、prompt では最終ページのスナップショット |
stderr | string | 標準エラー出力 |
exitCode | number | 実行の終了コード (0 = 成功) |
killed | boolean | タイムアウトにより実行が終了したかどうか |
error | string | エラーメッセージ (失敗時のみ存在) |
リクエスト例 (コード)
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 | ブラウザ機能が設定されていません (セルフホスト環境のみ) |
承認
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
パスパラメータ
スクレイピングジョブの job ID
ボディ
application/json
スクレイピングに紐付けられたブラウザサンドボックスで実行するコード
Required string length:
1 - 100000実行するコードの言語。JavaScript には node、agent-browser の CLI コマンドには bash を使用します。
利用可能なオプション:
python, node, bash 実行タイムアウト(秒)
必須範囲:
1 <= x <= 300実行テレメトリーで使用する任意のオリジンラベル
⌘I

