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>"
]
}
'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>"]
}
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>']
})
};
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>'
]
]),
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}")
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}")
.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}"
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."
}智能体
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>"
]
}
'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>"]
}
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>']
})
};
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>'
]
]),
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}")
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}")
.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}"
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 了解自动化入门说明。
授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求体
用于描述应提取哪些数据的提示词
10000为组织启用 SIEM Logging 后,SIEM 日志事件中会包含用户归属信息。
Show child attributes
Show child attributes
代理任务的推理预算。每次运行均在 spark-2 上执行,因此无论是否指定模型,都可以传入 effort。
low, medium, high 允许代理在运行期间调用您团队的 Alexandria 数据提供商。不提供此 object 时,运行仅使用网页数据(后续轮次会沿用上一轮的设置)。请参见 使用已连接的 Alexandria 工具。
Show child attributes
Show child attributes
此代理任务可使用的最大额度。若未设置,默认值为 2500。高于 2,500 的值一律按付费请求计费。
extract 每轮都会在 data 中返回完整的结构化结果。使用 chat 时,不请求新数据的后续请求会在 message 中获得简短回复,而不会重新运行。使用 exchange.requireApproval 时,必须在同一请求中使用 chat。在后续轮次中省略此项会沿用会话的模式。
extract, chat 适用于代理任务的模型。spark-2 是默认值,也是每次运行所执行的模型。出于向后兼容性考虑,仍接受 Spark 1 模型名称,但已弃用,并会路由到 spark-2。
spark-2, spark-1-mini, spark-1-pro 用于定义提取数据结构的可选 JSON Schema
如果为 true,代理将仅访问 urls 数组中提供的 URL
继续现有会话:传入先前运行返回的 threadId,此请求将作为该会话的下一轮运行。未指定的 urls、schema、effort、mode 和 exchange 设置会沿用上一轮的设置。省略 threadId 可开始新会话。
用于限定智能体访问范围的可选 URL 列表
Webhook 规范对象。订阅代理生命周期事件(agent.started、agent.action、agent.completed、agent.failed、agent.cancelled)。
Show child attributes
Show child attributes

