Interactセッションを作成
curl --request POST \
--url https://api.firecrawl.dev/v2/interact \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"activityTtl": 1805,
"streamWebView": true,
"ttl": 300
}
'import requests
url = "https://api.firecrawl.dev/v2/interact"
payload = {
"activityTtl": 1805,
"streamWebView": True,
"ttl": 300
}
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({activityTtl: 1805, streamWebView: true, ttl: 300})
};
fetch('https://api.firecrawl.dev/v2/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/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([
'activityTtl' => 1805,
'streamWebView' => true,
'ttl' => 300
]),
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/interact"
payload := strings.NewReader("{\n \"activityTtl\": 1805,\n \"streamWebView\": true,\n \"ttl\": 300\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/interact")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"activityTtl\": 1805,\n \"streamWebView\": true,\n \"ttl\": 300\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firecrawl.dev/v2/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 \"activityTtl\": 1805,\n \"streamWebView\": true,\n \"ttl\": 300\n}"
response = http.request(request)
puts response.read_body{
"cdpUrl": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"id": "<string>",
"interactiveLiveViewUrl": "<string>",
"liveViewUrl": "<string>",
"success": true
}{
"error": "Payment required to access this resource."
}Interact エンドポイント
Interactセッションの作成
コードで操作できるスタンドアロンのInteractブラウザセッションを開始します(事前のスクレイピングは不要です)。
POST
/
interact
Interactセッションを作成
curl --request POST \
--url https://api.firecrawl.dev/v2/interact \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"activityTtl": 1805,
"streamWebView": true,
"ttl": 300
}
'import requests
url = "https://api.firecrawl.dev/v2/interact"
payload = {
"activityTtl": 1805,
"streamWebView": True,
"ttl": 300
}
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({activityTtl: 1805, streamWebView: true, ttl: 300})
};
fetch('https://api.firecrawl.dev/v2/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/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([
'activityTtl' => 1805,
'streamWebView' => true,
'ttl' => 300
]),
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/interact"
payload := strings.NewReader("{\n \"activityTtl\": 1805,\n \"streamWebView\": true,\n \"ttl\": 300\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/interact")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"activityTtl\": 1805,\n \"streamWebView\": true,\n \"ttl\": 300\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firecrawl.dev/v2/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 \"activityTtl\": 1805,\n \"streamWebView\": true,\n \"ttl\": 300\n}"
response = http.request(request)
puts response.read_body{
"cdpUrl": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"id": "<string>",
"interactiveLiveViewUrl": "<string>",
"liveViewUrl": "<string>",
"success": true
}{
"error": "Payment required to access this resource."
}ヘッダー
| ヘッダー | 値 |
|---|---|
Authorization | Bearer <API_KEY> |
Content-Type | application/json |
リクエストボディ
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
ttl | number | No | 600 | セッション全体の有効期間(秒)(30〜3600) |
activityTtl | number | No | 300 | セッションが破棄されるまでの非アクティブ状態の継続時間(秒)(10〜3600) |
profile | object | No | — | セッション間での永続的なストレージを有効化します。後述を参照してください。 |
profile.name | string | Yes* | — | プロファイルの名前(1〜128文字)。同じ名前のセッションはストレージを共有します。 |
profile.saveChanges | boolean | No | true | true の場合、ブラウザの状態は終了時にプロファイルへ保存されます。既存データの読み込みのみを行いたい場合は false を設定してください。保存処理を行えるセッションは同時に 1 つだけです。 |
レスポンス
| フィールド | 型 | 説明 |
|---|---|---|
success | boolean | セッションが作成されたかどうか |
id | string | セッションの一意の識別子 |
cdpUrl | string | CDP 接続用の WebSocket URL |
liveViewUrl | string | セッションをリアルタイムで閲覧するための URL |
interactiveLiveViewUrl | string | セッションをリアルタイムで操作(クリック、入力、スクロール)するための URL |
expiresAt | string | TTL に基づいてセッションの有効期限が切れる時刻 |
リクエストの例
curl -X POST "https://api.firecrawl.dev/v2/interact" \
-H "Authorization: Bearer $FIRECRAWL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"ttl": 120
}'
レスポンス例
{
"success": true,
"id": "550e8400-e29b-41d4-a716-446655440000",
"cdpUrl": "wss://cdp-proxy.firecrawl.dev/cdp/550e8400-e29b-41d4-a716-446655440000",
"liveViewUrl": "https://liveview.firecrawl.dev/550e8400-e29b-41d4-a716-446655440000",
"interactiveLiveViewUrl": "https://liveview.firecrawl.dev/550e8400-e29b-41d4-a716-446655440000?interactive=true"
}
Firecrawl APIキーが必要なAI agentですか?自動オンボーディング手順については、firecrawl.dev/agent-onboarding/SKILL.md を参照してください。
承認
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
ボディ
application/json
⌘I

