启动用于 Agent 驱动数据提取的任务
curl --request POST \
--url https://api.firecrawl.dev/v2/agent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"exchange": {
"enabled": true,
"maxCalls": 16,
"onTermsRequired": "skip",
"requireApproval": false,
"toolkits": [
"<string>"
]
},
"maxCredits": 123,
"mode": "extract",
"model": "spark-2",
"schema": {},
"strictConstrainToURLs": true,
"threadId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"threatProtection": {
"blacklist": [
"<string>"
],
"blockedTlds": [
"<string>"
],
"riskScoreThreshold": 75,
"whitelist": [
"<string>"
]
},
"urls": [
"<string>"
],
"zeroDataRetention": false
}
'import requests
url = "https://api.firecrawl.dev/v2/agent"
payload = {
"prompt": "<string>",
"exchange": {
"enabled": True,
"maxCalls": 16,
"onTermsRequired": "skip",
"requireApproval": False,
"toolkits": ["<string>"]
},
"maxCredits": 123,
"mode": "extract",
"model": "spark-2",
"schema": {},
"strictConstrainToURLs": True,
"threadId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"threatProtection": {
"blacklist": ["<string>"],
"blockedTlds": ["<string>"],
"riskScoreThreshold": 75,
"whitelist": ["<string>"]
},
"urls": ["<string>"],
"zeroDataRetention": False
}
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({
prompt: '<string>',
exchange: {
enabled: true,
maxCalls: 16,
onTermsRequired: 'skip',
requireApproval: false,
toolkits: ['<string>']
},
maxCredits: 123,
mode: 'extract',
model: 'spark-2',
schema: {},
strictConstrainToURLs: true,
threadId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
threatProtection: {
blacklist: ['<string>'],
blockedTlds: ['<string>'],
riskScoreThreshold: 75,
whitelist: ['<string>']
},
urls: ['<string>'],
zeroDataRetention: false
})
};
fetch('https://api.firecrawl.dev/v2/agent', 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/agent",
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([
'prompt' => '<string>',
'exchange' => [
'enabled' => true,
'maxCalls' => 16,
'onTermsRequired' => 'skip',
'requireApproval' => false,
'toolkits' => [
'<string>'
]
],
'maxCredits' => 123,
'mode' => 'extract',
'model' => 'spark-2',
'schema' => [
],
'strictConstrainToURLs' => true,
'threadId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'threatProtection' => [
'blacklist' => [
'<string>'
],
'blockedTlds' => [
'<string>'
],
'riskScoreThreshold' => 75,
'whitelist' => [
'<string>'
]
],
'urls' => [
'<string>'
],
'zeroDataRetention' => false
]),
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/agent"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"exchange\": {\n \"enabled\": true,\n \"maxCalls\": 16,\n \"onTermsRequired\": \"skip\",\n \"requireApproval\": false,\n \"toolkits\": [\n \"<string>\"\n ]\n },\n \"maxCredits\": 123,\n \"mode\": \"extract\",\n \"model\": \"spark-2\",\n \"schema\": {},\n \"strictConstrainToURLs\": true,\n \"threadId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"threatProtection\": {\n \"blacklist\": [\n \"<string>\"\n ],\n \"blockedTlds\": [\n \"<string>\"\n ],\n \"riskScoreThreshold\": 75,\n \"whitelist\": [\n \"<string>\"\n ]\n },\n \"urls\": [\n \"<string>\"\n ],\n \"zeroDataRetention\": false\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/agent")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"exchange\": {\n \"enabled\": true,\n \"maxCalls\": 16,\n \"onTermsRequired\": \"skip\",\n \"requireApproval\": false,\n \"toolkits\": [\n \"<string>\"\n ]\n },\n \"maxCredits\": 123,\n \"mode\": \"extract\",\n \"model\": \"spark-2\",\n \"schema\": {},\n \"strictConstrainToURLs\": true,\n \"threadId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"threatProtection\": {\n \"blacklist\": [\n \"<string>\"\n ],\n \"blockedTlds\": [\n \"<string>\"\n ],\n \"riskScoreThreshold\": 75,\n \"whitelist\": [\n \"<string>\"\n ]\n },\n \"urls\": [\n \"<string>\"\n ],\n \"zeroDataRetention\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firecrawl.dev/v2/agent")
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 \"prompt\": \"<string>\",\n \"exchange\": {\n \"enabled\": true,\n \"maxCalls\": 16,\n \"onTermsRequired\": \"skip\",\n \"requireApproval\": false,\n \"toolkits\": [\n \"<string>\"\n ]\n },\n \"maxCredits\": 123,\n \"mode\": \"extract\",\n \"model\": \"spark-2\",\n \"schema\": {},\n \"strictConstrainToURLs\": true,\n \"threadId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"threatProtection\": {\n \"blacklist\": [\n \"<string>\"\n ],\n \"blockedTlds\": [\n \"<string>\"\n ],\n \"riskScoreThreshold\": 75,\n \"whitelist\": [\n \"<string>\"\n ]\n },\n \"urls\": [\n \"<string>\"\n ],\n \"zeroDataRetention\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"success": true,
"threadId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"threadTurn": 123
}{
"error": "Invalid JSON schema: ..."
}{
"error": "Payment required to access this resource."
}{
"error": "This URL (https://example.com) is blocked by your organization's threat protection policy (rule: blocklist). If you believe this is a mistake, contact your organization administrator to adjust the policy (e.g. whitelist the domain)."
}{
"error": "Rate limit exceeded."
}{
"error": "Failed to passthrough agent request."
}代理接口
智能体
POST
/
agent
启动用于 Agent 驱动数据提取的任务
curl --request POST \
--url https://api.firecrawl.dev/v2/agent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"exchange": {
"enabled": true,
"maxCalls": 16,
"onTermsRequired": "skip",
"requireApproval": false,
"toolkits": [
"<string>"
]
},
"maxCredits": 123,
"mode": "extract",
"model": "spark-2",
"schema": {},
"strictConstrainToURLs": true,
"threadId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"threatProtection": {
"blacklist": [
"<string>"
],
"blockedTlds": [
"<string>"
],
"riskScoreThreshold": 75,
"whitelist": [
"<string>"
]
},
"urls": [
"<string>"
],
"zeroDataRetention": false
}
'import requests
url = "https://api.firecrawl.dev/v2/agent"
payload = {
"prompt": "<string>",
"exchange": {
"enabled": True,
"maxCalls": 16,
"onTermsRequired": "skip",
"requireApproval": False,
"toolkits": ["<string>"]
},
"maxCredits": 123,
"mode": "extract",
"model": "spark-2",
"schema": {},
"strictConstrainToURLs": True,
"threadId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"threatProtection": {
"blacklist": ["<string>"],
"blockedTlds": ["<string>"],
"riskScoreThreshold": 75,
"whitelist": ["<string>"]
},
"urls": ["<string>"],
"zeroDataRetention": False
}
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({
prompt: '<string>',
exchange: {
enabled: true,
maxCalls: 16,
onTermsRequired: 'skip',
requireApproval: false,
toolkits: ['<string>']
},
maxCredits: 123,
mode: 'extract',
model: 'spark-2',
schema: {},
strictConstrainToURLs: true,
threadId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
threatProtection: {
blacklist: ['<string>'],
blockedTlds: ['<string>'],
riskScoreThreshold: 75,
whitelist: ['<string>']
},
urls: ['<string>'],
zeroDataRetention: false
})
};
fetch('https://api.firecrawl.dev/v2/agent', 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/agent",
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([
'prompt' => '<string>',
'exchange' => [
'enabled' => true,
'maxCalls' => 16,
'onTermsRequired' => 'skip',
'requireApproval' => false,
'toolkits' => [
'<string>'
]
],
'maxCredits' => 123,
'mode' => 'extract',
'model' => 'spark-2',
'schema' => [
],
'strictConstrainToURLs' => true,
'threadId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'threatProtection' => [
'blacklist' => [
'<string>'
],
'blockedTlds' => [
'<string>'
],
'riskScoreThreshold' => 75,
'whitelist' => [
'<string>'
]
],
'urls' => [
'<string>'
],
'zeroDataRetention' => false
]),
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/agent"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"exchange\": {\n \"enabled\": true,\n \"maxCalls\": 16,\n \"onTermsRequired\": \"skip\",\n \"requireApproval\": false,\n \"toolkits\": [\n \"<string>\"\n ]\n },\n \"maxCredits\": 123,\n \"mode\": \"extract\",\n \"model\": \"spark-2\",\n \"schema\": {},\n \"strictConstrainToURLs\": true,\n \"threadId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"threatProtection\": {\n \"blacklist\": [\n \"<string>\"\n ],\n \"blockedTlds\": [\n \"<string>\"\n ],\n \"riskScoreThreshold\": 75,\n \"whitelist\": [\n \"<string>\"\n ]\n },\n \"urls\": [\n \"<string>\"\n ],\n \"zeroDataRetention\": false\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/agent")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"exchange\": {\n \"enabled\": true,\n \"maxCalls\": 16,\n \"onTermsRequired\": \"skip\",\n \"requireApproval\": false,\n \"toolkits\": [\n \"<string>\"\n ]\n },\n \"maxCredits\": 123,\n \"mode\": \"extract\",\n \"model\": \"spark-2\",\n \"schema\": {},\n \"strictConstrainToURLs\": true,\n \"threadId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"threatProtection\": {\n \"blacklist\": [\n \"<string>\"\n ],\n \"blockedTlds\": [\n \"<string>\"\n ],\n \"riskScoreThreshold\": 75,\n \"whitelist\": [\n \"<string>\"\n ]\n },\n \"urls\": [\n \"<string>\"\n ],\n \"zeroDataRetention\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firecrawl.dev/v2/agent")
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 \"prompt\": \"<string>\",\n \"exchange\": {\n \"enabled\": true,\n \"maxCalls\": 16,\n \"onTermsRequired\": \"skip\",\n \"requireApproval\": false,\n \"toolkits\": [\n \"<string>\"\n ]\n },\n \"maxCredits\": 123,\n \"mode\": \"extract\",\n \"model\": \"spark-2\",\n \"schema\": {},\n \"strictConstrainToURLs\": true,\n \"threadId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"threatProtection\": {\n \"blacklist\": [\n \"<string>\"\n ],\n \"blockedTlds\": [\n \"<string>\"\n ],\n \"riskScoreThreshold\": 75,\n \"whitelist\": [\n \"<string>\"\n ]\n },\n \"urls\": [\n \"<string>\"\n ],\n \"zeroDataRetention\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"success": true,
"threadId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"threadTurn": 123
}{
"error": "Invalid JSON schema: ..."
}{
"error": "Payment required to access this resource."
}{
"error": "This URL (https://example.com) is blocked by your organization's threat protection policy (rule: blocklist). If you believe this is a mistake, contact your organization administrator to adjust the policy (e.g. whitelist the domain)."
}{
"error": "Rate limit exceeded."
}{
"error": "Failed to passthrough agent request."
}你是需要 Firecrawl API 密钥的 AI 代理吗?请参阅 firecrawl.dev/agent-onboarding/SKILL.md 了解自动化入门说明。
授权
请求体
application/json
允许代理在运行期间调用您团队的 Alexandria 数据提供商。不提供此 object 时,运行仅使用网页数据(后续轮次会沿用上一轮的设置)。请参见 使用已连接的 Alexandria 工具。
Show child attributes
Show child attributes
智能体在运行期间发出的所有请求所使用的代理所在国家:抓取、批量抓取和浏览器会话的请求均从该国家发出,且智能体无法更改此设置。搜索结果将根据该国家进行本地化。后续轮次中若省略此项,将沿用当前会话的国家设置。请参见选择位置。
Show child attributes
Show child attributes
此请求的威胁防护按请求覆盖配置。你提供的字段仅会替换此次请求中你所在组织策略的对应字段;未提供的字段则保留组织级配置值。你的团队必须已启用威胁防护(企业版功能),否则该请求会因 403 被拒绝。如果你的组织已禁用请求级覆盖,任何包含此对象的请求都会因 403 被拒绝。如果你的团队强制启用了威胁防护,则不得将 mode 设为 off。
Show child attributes
Show child attributes
以零数据保留模式运行智能体:Firecrawl 不会在日志或存储中保留任何 prompt、结果或步骤内容,仅保留计费和状态元数据。结果会保留 24 小时以供检索,随后删除。需要为您的团队启用抓取 ZDR 和搜索 ZDR,否则请求将返回 400 zdr_not_enabled。不能与 threadId 同时使用。使用 exchange 时,仅使用支持 ZDR 的功能。请参见零数据保留。

